Welcome to the Food Delivery API, a complete backend service for a food delivery system. This API provides a robust platform for handling food orders, user authentication, and restaurant management. Whether you're a restaurant owner or a developer looking to integrate food delivery functionality into your application, this API is a great starting point.
- User Authentication: Secure user registration and login with JWT (JSON Web Tokens) for authentication.
- Email Verification: Verify user email with noedmailer and mailtrap.
- Restaurant Management: Add, update, and delete restaurant information.
- Geospatial Query: Find nearby restaurants using users coordinated.
- Menu Management: Create and manage restaurant menus with items, prices, and descriptions.
- Order Management: Allow users to place orders and track their delivery status. (coming soon)
- Real-time Updates: Real-time updates on order status using WebSockets. (coming soon)
Follow these steps to set up the Food Delivery API on your local development environment:
-
Clone the repository:
git clone https://github.com/Aaryash-Shakya/food-delivery-api.git cd food-delivery-api
-
Install dependencies:
npm install
-
Set up environment variables:
For database:
Create a folder environments with environment.ts and past the code below.export function getEnvironmentVariables() { return { db_uri: <insert_string>; jwt_secret_key: <insert_string>; } }
For db_uri create/login to your mongodb account and create new cluster and go to connect > connect with mongodb driver for node.js
For detailed instruction click me
For video tutorial click meFor mail testing
Create .env folder add NODEMAILER_USER and NODEMAILER_PASS with the value in your account.NODEMAILER_USER = "your mailtrap SMTP server username" NODEMAILER_PASS = "your mailtrap SMTP server password"
Create/login to your mailtrap account go to email testing > my inbox > SMTP setting > show credentials
For detailed instruction click me
-
Start the API server:
npm start
The API should now be running locally on http://localhost:3000.
We welcome contributions from the open-source community to enhance my api's features, functionality, and documentation. Feel free to fork this repository, create your own branch, and submit pull requests.
-
Fork this repository.
Click on the fork button on the repository
-
Clone the repostory:
Go to your forked repositry, Click on the code button and copy your repositroy's
(.git)
link.Then, clone the repository in ur machine using the command below
git clone https://github.com/<your-username>/food-delivery-api.git cd food-delivery-api
-
Make a breanch and add your changes:
In your local machine create a new branch
git checkout -b <branch_name>
Add your changes to the branch
-
Check the changed files
git status
-
If everything's good, then Commit Your Changes
git add . git commit -m "<EXPLAIN-YOUR_CHANGES>"
-
Push to Your Forked Repository
git push -u origin <branch_name>
-
Create a Pull Request
Go to your forked repository on GitHub, and you should see a "Compare & pull request" button. Click on it to create a pull request (PR).
Create a pull request with a clear description of your changes.
Your contribution will be reviewed, and upon approval, it will be merged into the main repository.
POST /api/user/signup
Parameter | Type | Description |
---|---|---|
name |
string |
Required. Your name |
email |
string |
Required. Your email |
phone |
string |
Required. Your phone number |
password |
string |
Required. Your password plaintext |
type |
string |
Required. Type of account ( admin/restaurant/customer ) |
status |
string |
Required. def: active |
PATCH /api/user/verify-email
Parameter | Type | Description |
---|---|---|
email |
string |
Required. Your email |
verification_token |
number |
Required. Your verification OTP sent to your email |
PATCH /api/user/resend-verification-token
Parameter | Type | Description |
---|---|---|
email |
string |
Required. Your email |
POST /api/user/login
Parameter | Type | Description |
---|---|---|
email |
string |
Required. Your email |
password |
string |
Required. Your password plaintext |
POST /api/user/forgot-password
Parameter | Type | Description |
---|---|---|
email |
string |
Required. Your email |
PATCH /api/user/reset-password
Parameter | Type | Description |
---|---|---|
email |
string |
Required. Your email |
password |
string |
Required. New password |
password_reset_token |
number |
Required. Reset token sent in email. |
Authorization |
string |
Required. Bearer token received from /forgot-password |
GET /api/user/get-profile/:email
Parameter | Type | Description |
---|---|---|
email |
string |
Required. Your email |
name |
string |
New name |
phone |
string |
New phone |
type |
string |
New account type |
Authorization |
string |
Required. Bearer token received from /login |
PUT /api/user/update-profile
Parameter | Type | Description |
---|---|---|
email |
string |
Required. Your email |
Authorization |
string |
Required. Bearer token received from /login |
POST /api/user/add-address
Parameter | Type | Description |
---|---|---|
title |
string |
Required. Name of the place you live |
address |
string |
Required. format <title, area, city> |
landmark |
string |
Required. Landmark near your house or |
house |
string |
House number |
latitude |
number |
Required. User's latitude |
longitude |
number |
Required. User's longitude |
Authorization |
string |
Required. Bearer token received from /login |
GET /api/user/get-addresses
Parameter | Type | Description |
---|---|---|
Authorization |
string |
Required. Bearer token received from /login |
POST /api/city/add-city
Parameter | Type | Description |
---|---|---|
name |
string |
Required. City name |
longitude |
number |
Required. Longitude of city |
latitude |
number |
Required. Latitude of city |
status |
string |
Required. Is the service active (active/inactive) |
Authorization |
string |
Required. Admin bearer token received from /login |
GET /api/city/get-cities
Parameter | Type | Description |
---|---|---|
Authorization |
string |
Required. Bearer token received from /login |
POST /api/banner/add-banner
Parameter | Type | Description |
---|---|---|
banner |
file |
Required. Restaurant banner image (.jpg or .png) |
Authorization |
string |
Required. Admin bearer token received from /login |
GET /api/banner/get-banners
Parameter | Type | Description |
---|---|---|
Authorization |
string |
Required. Bearer token received from /login |