{"id":23564442,"url":"https://github.com/pragati-c19/snackmates-server","last_synced_at":"2026-04-11T12:02:30.319Z","repository":{"id":253825264,"uuid":"844644651","full_name":"Pragati-C19/SnackMates-Server","owner":"Pragati-C19","description":"SnackMates-Server is a food ordering platform that provides a server-side API to manage restaurants, menus, user favorites, and authentication.","archived":false,"fork":false,"pushed_at":"2024-08-31T15:23:52.000Z","size":3083,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-26T17:15:16.045Z","etag":null,"topics":["body-parser","dotenv","expressjs","jwt","mysql","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/Pragati-C19.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}},"created_at":"2024-08-19T17:21:26.000Z","updated_at":"2024-10-16T09:25:11.000Z","dependencies_parsed_at":"2024-08-29T08:48:34.249Z","dependency_job_id":"705b3fc5-6a77-4e96-b8eb-2108db1219d2","html_url":"https://github.com/Pragati-C19/SnackMates-Server","commit_stats":null,"previous_names":["pragati-c19/snackmates-server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pragati-C19%2FSnackMates-Server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pragati-C19%2FSnackMates-Server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pragati-C19%2FSnackMates-Server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pragati-C19%2FSnackMates-Server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pragati-C19","download_url":"https://codeload.github.com/Pragati-C19/SnackMates-Server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239323961,"owners_count":19620108,"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":["body-parser","dotenv","expressjs","jwt","mysql","nodejs"],"created_at":"2024-12-26T17:15:24.819Z","updated_at":"2025-10-26T14:31:44.038Z","avatar_url":"https://github.com/Pragati-C19.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SnackMates-Server\n\nSnackMates-Server is a food ordering platform that provides a server-side API to manage restaurants, menus, user favorites, and authentication. This server-side application is built with Node.js and Express, and it interfaces with a MySQL database to handle various CRUD operations.\n\n## Features\n\n- User authentication (registration and login)\n- CRUD operations for restaurants and menus\n- Favorites management (add, get, and delete)\n- Search functionality for menus by type\n\n## Technologies\n\n- Node.js\n- Express.js\n- MySQL\n- JWT (JSON Web Tokens) for authentication\n- dotenv for environment variables\n- body-parser for parsing JSON request bodies\n\n## Architecture Diagram\n\n![Wireframe](docs/wireframe.png)\n\n## Setup and Installation\n\n1. **Clone the Repository**\n\n   ```bash\n   git clone https://github.com/Pragati-C19/SnackMates-Server.git\n   cd SnackMates-Server\n   ```\n2. **Install Dependencies**\n   \n   ```bash\n   npm install\n    ```\n3. **Configure Environment Variables**\n    \n    Create a `.env` file in the root directory and add your environment variables. Example:\n\n    ```makefile\n    JWT_SECRET=your_jwt_secret_key\n    DB_HOST=localhost\n    DB_USER=root\n    DB_PASSWORD=your_db_password\n    DB_NAME=snackmates_db\n    ```\n4. **Run the Server**\n    \n    Run the following command to start the server:\n\n    ```bash\n    npm start\n    ```\n\n## Database Schema\n\n- **User Table**\n  - `user_id` (INT,Primary Key)\n  - `email` (Varchar, Unique Key)\n  - `user_name` (Varchar)\n  - `password` (Varchar)\n  - `created_at` (Timestamp)\n\n- **Restaurant Table**\n  - `restaurant_id` (INT,Primary Key)\n  - `restaurant_name` (Varchar)\n  - `restaurant_description` (Text)\n  - `restaurant_location` (Varchar)\n  - `restaurant_rating` (Float)\n  - `restaurant_img_url` (Varchar)\n\n- **Menu Table**\n  - `menu_id` (INT,Primary Key)\n  - `restaurant_id` (INT,Foreign Key)\n  - `menu_name` (Varchar)\n  - `menu_description` (Text)\n  - `menu_type` (Varchar)\n  - `menu_price` (Decimal)\n  - `menu_img_url` (Varchar)\n\n- **Fav Table**\n  - `favorite_id` (INT,Primary Key)\n  - `user_id` (INT,Foreign Key)\n  - `menu_id` (INT,Foreign Key)\n  - `created_at` (Timestamp)\n\n    ![ER Diagram1](docs/database_temp/ER-diagram1.png)\n\n    ![ER Diagram2](docs/database_temp/ER-diagram2.png)\n## API Endpoints\n\n1. **Auth Routes**\n\n    - **Register User**\n\n        - **POST** `/auth/register`\n        - **Request Body**: \n            ```json\n            {\n                \"userID\": \"string\",\n                \"emailID\": \"string\",\n                \"userName\": \"string\",\n                \"password\": \"string\"\n            }\n            ```\n        - **Response**: Success or error message\n         \n        ![User Register](docs/API's/auth-api-sample/user-register.png)\n\n    - **Login User**\n\n        - **POST** `/auth/login`\n        - **Request Body**:\n            ```json\n            {\n                \"emailID\": \"string\",\n                \"password\": \"string\"\n            }\n            ```\n        - **Response**: JWT token and user details \n\n        ![User Login](docs/API's/auth-api-sample/user-login.png)\n        \n2. **Menu Routes**\n\n    - **Get All Menus**\n\n        - **GET** `/menus/all`\n        - **Response**: List of all menus\n\n        ![Get All Menus](docs/API's/menus-api-sample/get-all-menus.png)\n\n\n    - **Get Menu by ID**\n\n        - **GET** `/menus/:menu_id`\n        - **Response**: Menu details for the specified ID\n\n        ![Get Menu by ID](docs/API's/menus-api-sample/get-menu.png)\n\n    - **Get Menus by Type**\n\n        - **GET** `/menus/:menu_type`\n        - **Response**: List of menus filtered by the specified type\n\n        ![Get Menus by Type](docs/API's/menus-api-sample/get-menu-by-type.png)\n\n3. **Restaurant Routes**\n\n    - **Get All Restaurants**\n\n        - **GET** `/restaurants/all`\n        - **Response**: List of all restaurants\n\n        ![Get All Restaurants](docs/API's/restaurants-api-sample/get-all-restaurants.png)\n\n    - **Get Restaurant Menu**\n\n        - **GET** `/restaurants/menu/:restaurant_id`\n        - **Response**: List of menus for the specified restaurant\n\n        ![Get Restaurant Menus](docs/API's/restaurants-api-sample/get-menus-of-restaurant.png)\n\n4. **Favorites Routes**\n\n    - **Get User's Favorites**\n\n        - **GET** `/favorites/all/:user_id`\n        - **Response**: List of favorite items for the specified user\n\n        ![Get User's Favorites](docs/API's/favorites-api-sample/get-all-favorites.png)\n\n    - **Add to Favorites**\n\n        - **POST** `/favorites/:user_id`\n        - **Request Body**:\n            ```json\n            {\n                \"menu_id\": \"number\"\n            }\n            ```\n        - **Response**: Success or error message\n\n        ![Add to Favorites](docs/API's/favorites-api-sample/add-to-favorites.png)\n\n    - **Remove from Favorites**\n\n        - **DELETE** `/favorites/:user_id/:favorite_id`\n        - **Response**: Success or error message\n\n        ![Remove from Favorites](docs/API's/favorites-api-sample/delete-favorites.png)\n\n## Contributing\n\n- Contributions are welcome! Please fork this repository and submit pull requests for any enhancements or bug fixes.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpragati-c19%2Fsnackmates-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpragati-c19%2Fsnackmates-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpragati-c19%2Fsnackmates-server/lists"}