{"id":30439963,"url":"https://github.com/eduardapontel/restaurant-api","last_synced_at":"2026-04-11T04:32:33.571Z","repository":{"id":310052200,"uuid":"1038255639","full_name":"eduardapontel/restaurant-api","owner":"eduardapontel","description":"A RESTful API for management of products, tables, table sessions, and orders.","archived":false,"fork":false,"pushed_at":"2025-08-15T11:44:00.000Z","size":56,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-23T05:19:48.394Z","etag":null,"topics":["express","knexjs","nodejs","sqlite","typescript","zod"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eduardapontel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-08-14T21:58:15.000Z","updated_at":"2025-08-16T15:59:57.000Z","dependencies_parsed_at":"2025-08-15T13:10:46.522Z","dependency_job_id":"796150d7-ef8d-4229-a99e-ede5aeeecb84","html_url":"https://github.com/eduardapontel/restaurant-api","commit_stats":null,"previous_names":["eduardapontel/restaurant-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eduardapontel/restaurant-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eduardapontel%2Frestaurant-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eduardapontel%2Frestaurant-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eduardapontel%2Frestaurant-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eduardapontel%2Frestaurant-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eduardapontel","download_url":"https://codeload.github.com/eduardapontel/restaurant-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eduardapontel%2Frestaurant-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31669114,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["express","knexjs","nodejs","sqlite","typescript","zod"],"created_at":"2025-08-23T05:19:48.354Z","updated_at":"2026-04-11T04:32:33.539Z","avatar_url":"https://github.com/eduardapontel.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🍽️ Restaurant API\n\nA RESTful API for restaurant management, built with **Node.js** and **TypeScript**, using **Express** and **Knex.js** for database interaction. This project allows efficient management of products, tables, table sessions, and orders.\n\n\u003cbr\u003e\n\n## 📌 Features\n\n- **Product Management**\n  - Create, list, update, and delete menu items.\n  - Initial product insertion via seed.\n\n- **Table Management**\n  - Create, list, update, and delete restaurant tables.\n  - Initial table insertion via seed.\n\n- **Table Sessions**\n  - Open and close sessions for customers at tables.\n  - Availability control.\n\n- **Orders**\n  - Create and list orders linked to tables.\n  - Automatic date/time registration.\n\n- **Error Handling**\n  - Centralized middleware for custom error messages.\n \n\u003cbr\u003e\n\n## 📂 Project Structure\n\n- `knexfile.ts` – Knex configuration\n- `package.json` – Dependencies and scripts\n- `tsconfig.json` – TypeScript configuration\n- `requests-insomnia.yaml` – Request collection for API testing\n- **`src/`**\n  - `server.ts` – Application entry point\n  - **`controllers/`** – Route controllers\n    - `orders-controller.ts`\n    - `products-controller.ts`\n    - `tables-controller.ts`\n    - `tables-sessions-controller.ts`\n  - **`database/`**\n    - `knex.ts` – Database connection\n    - **`migrations/`** – Table creation scripts\n    - **`seeds/`** – Initial data\n    - **`types/`** – TypeScript repository types\n  - **`middlewares/`**\n    - `error-handling.ts` – Error handling middleware\n  - **`routes/`** – Route definitions\n    - `index.ts`\n    - `orders-routes.ts`\n    - `products-routes.ts`\n    - `tables-routes.ts`\n    - `tables-sessions-routes.ts`\n  - **`utils/`**\n    - `AppError.ts` – Custom error class\n\n\u003cbr\u003e\n\n## 🛠️ Technologies Used\n\n- **Node.js**\n- **TypeScript**\n- **Express**\n- **Knex.js**\n- **SQLite**\n- **Zod** for data validation\n\n\u003cbr\u003e\n\n## 🚀 Running Locally\n\n1. **Clone the repository**\n\n    ```bash\n    git clone https://github.com/eduardapontel/restaurant-api.git\n    cd restaurant-api\n    ```\n\n2. **Install dependencies**\n\n    ```bash\n    npm install\n    ```\n\n3. **Database setup**\n\n    - Adjust `knexfile.ts` as needed.\n    - Run migrations:\n    \n      ```bash\n      npx knex migrate:latest\n      ```\n\n    - Run seeds:\n    \n      ```bash\n      npx knex seed:run\n      ```\n\n4. **Start the server**\n\n    ```bash\n    npm run dev\n    ```\n\n5. **Test requests**\n\n    - Import `requests-insomnia.yaml` into Insomnia or similar tools.\n\n\u003cbr\u003e\n\n## 📡 API Endpoints\n\n**Base URL:** `http://localhost:3333`\n\n### Products\n| Method | Endpoint        | Description                 |\n|-------:|-----------------|-----------------------------|\n| GET    | `/products`     | List products               |\n| POST   | `/products`     | Create product              |\n| PUT    | `/products/:id` | Update product by ID        |\n| DELETE | `/products/:id` | Delete product by ID        |\n\n### Tables\n| Method | Endpoint    | Description            |\n|-------:|-------------|------------------------|\n| GET    | `/tables`   | List tables            |\n\n\u003e Table creation and deletion are handled manually in the database or via the `seeds/tables.ts` file, as the tables are meant to be fixed.\n\n### Table Sessions\n| Method | Endpoint                   | Description                     |\n|-------:|----------------------------|---------------------------------|\n| GET    | `/tables-sessions`         | List table sessions             |\n| POST   | `/tables-sessions`         | Open/create a table session     |\n| PATCH  | `/tables-sessions/:id`     | Update/close a table session    |\n\n### Orders\n| Method | Endpoint                                       | Description                                    |\n|-------:|------------------------------------------------|------------------------------------------------|\n| POST   | `/orders`                                      | Create order                                   |\n| GET    | `/orders/table-session/:table_session_id`      | List orders by table session                   |\n| GET    | `/orders/table-session/:table_session_id/total`| Display total (sum) for the table session      |\n\n\n\u003cbr\u003e\n\n## 🤝 Contributing \n\nFeel free to contribute to this project by submitting issues or pull requests. Your feedback and suggestions are always welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feduardapontel%2Frestaurant-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feduardapontel%2Frestaurant-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feduardapontel%2Frestaurant-api/lists"}