{"id":24850184,"url":"https://github.com/leuthra/booking-api","last_synced_at":"2026-05-08T13:44:43.875Z","repository":{"id":275118622,"uuid":"925124649","full_name":"Leuthra/booking-api","owner":"Leuthra","description":"Booking API is a lightweight RESTful API built with hono, mysql and powered by Bun","archived":false,"fork":false,"pushed_at":"2025-01-31T09:37:13.000Z","size":19,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T12:12:33.411Z","etag":null,"topics":["booking-system","bun","hono","restful-api"],"latest_commit_sha":null,"homepage":"https://hono.dev","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Leuthra.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-31T09:24:47.000Z","updated_at":"2025-01-31T09:37:16.000Z","dependencies_parsed_at":"2025-01-31T10:31:43.863Z","dependency_job_id":"09a984ab-af7f-410d-9d81-33b4359c42fe","html_url":"https://github.com/Leuthra/booking-api","commit_stats":null,"previous_names":["leuthra/booking-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leuthra%2Fbooking-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leuthra%2Fbooking-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leuthra%2Fbooking-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Leuthra%2Fbooking-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Leuthra","download_url":"https://codeload.github.com/Leuthra/booking-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245650492,"owners_count":20650105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["booking-system","bun","hono","restful-api"],"created_at":"2025-01-31T13:17:20.875Z","updated_at":"2026-05-08T13:44:43.831Z","avatar_url":"https://github.com/Leuthra.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Booking API\n\nThe **Booking API** is a lightweight RESTful API built with **Hono**, **MySQL**, **TypeScript**, and powered by **Bun**. This API allows you to manage bookings, including creating, reading, updating, and deleting reservations.\n\n## Author\n- **Romi Muharom**\n\n---\n\n## Features\n1. **Create a new booking**\n2. **View all bookings**\n3. **View booking details by ID**\n4. **Update an existing booking**\n5. **Delete a booking**\n\n---\n\n## 🛠️ Technology Stack\n- [Bun](https://bun.sh/) - A fast JavaScript runtime\n- [Hono](https://hono.dev/) - Lightweight web framework for building APIs\n- [TypeScript](https://www.typescriptlang.org/) - A superset of JavaScript with static typing\n- [MySQL](https://www.mysql.com/) - Relational database management system\n- [dotenv](https://www.npmjs.com/package/dotenv) - For managing environment variables\n\n---\n\n## 📂 Project Structure\n```bash\nbooking-api/\n├── src/\n│   ├── index.ts          # Main server file\n│   ├── db.ts             # MySQL database connection\n│   ├── migrate.ts        # Database migration script\n│   ├── routes/\n│   │   └── bookings.ts   # API routes for bookings\n│   ├── types.ts          # TypeScript type definitions\n├── .env                  # Environment variables configuration\n├── .gitignore            # Ignore files for Git\n├── package.json          # Bun project configuration\n├── tsconfig.json         # TypeScript configuration\n├── README.md             # Documentation\n```\n\n---\n\n## 🔧 Installation and Usage\n\n### 1. **Clone the Project**\n```bash\ngit clone https://github.com/leuthra/booking-api.git\ncd booking-api\n```\n\n### 2. **Install Dependencies**\n```bash\nbun install\n```\n\n### 3. **Create a `.env` File**\nAdd your MySQL database configuration in the `.env` file:\n```\nDB_HOST=localhost\nDB_USER=root\nDB_PASSWORD=yourpassword\nDB_NAME=booking_db\nDB_PORT=3306\n```\n\n### 4. **Run Database Migration**\nTo create the necessary tables and insert dummy data, run the migration script:\n```bash\nbun run src/migrate.ts\n```\n\nThis will create the **bookings** table and populate it with some dummy data.\n\n\n---\n\n## 🚀 API Endpoints\n\n### **Base URL**\n```\nhttp://localhost:3000/api\n```\n\n### **1. GET `/api/bookings`**\nRetrieve all bookings.\n\n#### Example Response\n```json\n{\n  \"author\": \"Romi Muharom\",\n  \"status\": 200,\n  \"message\": \"List of bookings\",\n  \"data\": [\n    {\n      \"id\": 1,\n      \"name\": \"John Doe\",\n      \"phone\": \"08123456789\",\n      \"date\": \"2025-02-01\",\n      \"time\": \"18:00:00\",\n      \"people\": 2\n    }\n  ]\n}\n```\n\n---\n\n### **2. POST `/api/bookings`**\nCreate a new booking.\n\n#### Request Body\n```json\n{\n  \"name\": \"Romi\",\n  \"phone\": \"08123456789\",\n  \"date\": \"2025-02-01\",\n  \"time\": \"18:00:00\",\n  \"people\": 2\n}\n```\n\n#### Example Response\n```json\n{\n  \"author\": \"Romi Muharom\",\n  \"status\": 201,\n  \"message\": \"Booking created\",\n  \"id\": 1,\n  \"name\": \"Romi\",\n  \"phone\": \"08123456789\",\n  \"date\": \"2025-02-01\",\n  \"time\": \"18:00:00\",\n  \"people\": 2\n}\n```\n\n---\n\n### **3. GET `/api/bookings/:id`**\nRetrieve booking details by ID.\n\n#### Example Response\n```json\n{\n  \"author\": \"Romi Muharom\",\n  \"status\": 200,\n  \"message\": \"Booking detail\",\n  \"data\": {\n    \"id\": 1,\n    \"name\": \"John Doe\",\n    \"phone\": \"08123456789\",\n    \"date\": \"2025-02-01\",\n    \"time\": \"18:00:00\",\n    \"people\": 2\n  }\n}\n```\n\n---\n\n### **4. PUT `/api/bookings/:id`**\nUpdate a booking by ID.\n\n#### Request Body\n```json\n{\n  \"name\": \"Updated Name\",\n  \"phone\": \"08198765432\",\n  \"date\": \"2025-02-02\",\n  \"time\": \"19:00:00\",\n  \"people\": 4\n}\n```\n\n#### Example Response\n```json\n{\n  \"author\": \"Romi Muharom\",\n  \"status\": 200,\n  \"message\": \"Booking updated\",\n  \"id\": 1,\n  \"name\": \"Updated Name\",\n  \"phone\": \"08198765432\",\n  \"date\": \"2025-02-02\",\n  \"time\": \"19:00:00\",\n  \"people\": 4\n}\n```\n\n---\n\n### **5. DELETE `/api/bookings/:id`**\nDelete a booking by ID.\n\n#### Example Response\n```json\n{\n  \"author\": \"Romi Muharom\",\n  \"status\": 200,\n  \"message\": \"Booking deleted\",\n  \"id\": 1\n}\n```\n\n---\n\n## 🧪 Testing\nYou can test the API using [Postman](https://www.postman.com/) or any API testing tool of your choice.\n\n---\n\n## 📜 License\nThis project is licensed under the [MIT License](LICENSE).\n\n---\n\nIf you have any questions or encounter any issues, feel free to reach out! 😊","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleuthra%2Fbooking-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleuthra%2Fbooking-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleuthra%2Fbooking-api/lists"}