Skip to content

Aaryash-Shakya/food-delivery-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Food Delivery API

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.

Tech Stack

đź’ˇFeatures

  • 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)

🧑‍💻 Installation

Follow these steps to set up the Food Delivery API on your local development environment:

  1. Clone the repository:

    git clone https://github.com/Aaryash-Shakya/food-delivery-api.git
    cd food-delivery-api
  2. Install dependencies:

    npm install
  3. 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 me

    For 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

  4. Start the API server:

    npm start

The API should now be running locally on http://localhost:3000.

Contributing

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.

Make sure to follow the instruction below:

  1. Fork this repository.

    Click on the fork button on the repository

  2. 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
  3. 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

  4. Check the changed files

    git status
  5. If everything's good, then Commit Your Changes

    git add .
    git commit -m "<EXPLAIN-YOUR_CHANGES>"
  6. Push to Your Forked Repository

    git push -u origin <branch_name>
  7. 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.

API Reference


User Routes

Sign up

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

Verify email

PATCH /api/user/verify-email
Parameter Type Description
email string Required. Your email
verification_token number Required. Your verification OTP sent to your email

Resend verification email

PATCH /api/user/resend-verification-token
Parameter Type Description
email string Required. Your email

Login

POST /api/user/login
Parameter Type Description
email string Required. Your email
password string Required. Your password plaintext

Forgot password

POST /api/user/forgot-password
Parameter Type Description
email string Required. Your email

Reset password

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 profile

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

Update profile

PUT /api/user/update-profile
Parameter Type Description
email string Required. Your email
Authorization string Required. Bearer token received from /login

Address Routes

Add addresses

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 addresses

GET /api/user/get-addresses
Parameter Type Description
Authorization string Required. Bearer token received from /login

City Routes

Add city

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 cities

GET /api/city/get-cities
Parameter Type Description
Authorization string Required. Bearer token received from /login

Banner Routes

Add banner

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 banners

GET /api/banner/get-banners
Parameter Type Description
Authorization string Required. Bearer token received from /login

About

A extensive backend api for a food delivery service

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published