Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NexusFood API

Introduction

The NexusFood API is the backbone of a sophisticated food delivery system designed to streamline and enhance the food ordering and delivery experience. Built with Spring Boot, this API serves as the communication bridge between various components within the food delivery ecosystem.

At its core, the NexusFood API provides a comprehensive set of endpoints and functionalities that enable seamless interaction between users, restaurants, delivery personnel, and admin involved in the food delivery system.

Key features of the NexusFood API include:

  1. Order Management: Users can browse menus, place orders, and track the status of their deliveries.
  2. Restaurant Integration: Allows sellers to manage menus, update item availability, and receive/fulfill orders efficiently.
  3. Delivery Logistics: Manages the logistics of food delivery, assigning orders to delivery personnel.
  4. User Authentication and Profiles: Users can create and manage their profiles.

Tech Stack

This project uses the following technologies:

  • Java 25: A versatile programming language known for its portability and performance.
  • Spring Boot 3: A robust Java framework for building scalable and maintainable applications.
  • PostgreSQL: Advanced relational database for efficient data storage.
  • Spring Data JPA: For ORM and database interactions.
  • Local File Storage: Images are stored locally in the uploads/ directory and served via the API.
  • Postman: API client for testing and documenting endpoints.

Prerequisites

Before running the application, ensure you have the following installed:

  • Java Development Kit (JDK) 25 or higher
  • PostgreSQL (running on port 5432)
  • Maven (optional, wrapper is included)

How to Run

1. Database Setup

Create a PostgreSQL database named nexusfood:

# Log in to postgres CLI
psql -U postgres

# Create database
CREATE DATABASE nexusfood;

Note: The application defaults to username postgres and password password. You can change these in src/main/resources/application.properties.

2. Run the Application

You can run the application using the Maven wrapper:

Windows:

.\mvnw.cmd spring-boot:run

Linux/Mac:

./mvnw spring-boot:run

The server will start on http://localhost:8080.

3. Run with IntelliJ IDEA

  1. Open the project in IntelliJ IDEA.
  2. Wait for Maven to sync dependencies.
  3. Locate src/main/java/com/foodsense/demo/Main.java.
  4. Click the Run (green play) button next to the main method.

Future Works

  • Security Enhancement (JWT/OAuth2)
  • Containerization (Docker)
  • Cloud Storage
  • Testing
  • Caching (Redis)
  • CI/CD

API Documentation

Authentication (/foodsense/api/v0.0.1/auth)

  • POST /register: Register a new user.
    • Payload: User (JSON)
  • POST /login: Login a user.
    • Payload: User (JSON)

Product (/foodsense/api/v0.0.1/product)

  • GET /get: Get all products.
  • GET /get/{id}: Get product by ID.
  • POST /insert: Insert a new product.
    • Query Param: sellerId
    • Payload: Product (JSON)
  • DELETE /delete/{id}: Delete product by ID.
  • PUT /update/image/{id}: Upload product image.
    • Payload: MultipartFile (key: file)
  • PUT /update/{id}: Update product info.
    • Payload: Product (JSON)
  • PUT /update/stock/{id}: Update product stock.
    • Payload: Product (JSON)

Order (/foodsense/api/v0.0.1/order)

  • GET /get: Get all orders.
  • GET /get/{id}: Get order by ID.
  • POST /placeOrder: Place a new order.
    • Query Param: customerId
    • Payload: OrderRequestDTO (JSON)

Admin (/foodsense/api/v0.0.1/admin)

  • GET /get: Get all admins.
  • GET /get/{id}: Get admin by ID.
  • POST /insert: Create admin.
    • Payload: Admin (JSON)
  • DELETE /delete/{id}: Delete admin.
  • PUT /update/{id}: Update admin.
    • Payload: Admin (JSON)

Courier (/foodsense/api/v0.0.1/courier)

  • GET /get: Get all couriers.
  • GET /get/{id}: Get courier by ID.
  • POST /insert: Create courier.
    • Payload: Courier (JSON)
  • DELETE /delete/{id}: Delete courier.
  • PUT /update/image/{id}: Upload courier image.
    • Payload: MultipartFile (key: file)
  • PUT /update/{id}: Update courier.
    • Payload: Courier (JSON)
  • PUT /takeOrder/{courierId}/order/{orderId}: Courier takes an order.

Customer (/foodsense/api/v0.0.1/customer)

  • GET /get: Get all customers.
  • GET /get/{id}: Get customer by ID.
  • POST /insert: Create customer.
    • Payload: Customer (JSON)
  • DELETE /delete/{id}: Delete customer.
  • PUT /update/image/{id}: Upload customer image.
    • Payload: MultipartFile (key: file)
  • PUT /update/{id}: Update customer.
    • Payload: Customer (JSON)

Seller (/foodsense/api/v0.0.1/seller)

  • GET /get: Get all sellers.
  • GET /get/{id}: Get seller by ID.
  • POST /insert: Create seller.
    • Payload: Seller (JSON)
  • DELETE /delete/{id}: Delete seller.
  • PUT /update/image/{id}: Upload seller image.
    • Payload: MultipartFile (key: file)
  • PUT /update/{id}: Update seller.
    • Payload: Seller (JSON)
  • GET /get/product/{id}: Get products by seller ID.

Landing (/foodsense/api/v0.0.1)

  • GET /: Welcome message.

About

Scalable food delivery platform backend engineered with Java Spring Boot. Orchestrates complex order workflows between users, restaurants, and couriers using Spring Data JPA.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages