Skip to content

A community-driven initiative that connects the surplus food from local hawkers directly to families in need.

Notifications You must be signed in to change notification settings

xJQx/sc2006-feeditforward

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FeedItForward 🍚

Welcome to the official repository for NTU SC2006 Software Engineering group project FeedItForward.

Frontend | Backend | Demo Video

FeedItForward is a community-driven initiative that connects the surplus food from local hawkers directly to families in need. It not only reduces food waste but also ensures that nutritious meals reach those most vulnerable in our society.

This project applied software engineering best practices and design patterns to ensure high reliability, performance, and extensibility for future enhancements.

Demo Video
Demo.Video.mov
Supporting Documentations
  1. Software Requirements Specification
  2. Code and API Documentations
  3. Use Case Diagram and Descriptions
  4. User Interface Mockups
Diagrams
  1. App Overview Diagram
  2. Use Case Diagram
  3. Architecture Diagram
  4. Class Diagram
  5. Stereotype Class Diagram
  6. Sequence Diagrams
  7. Dialog Map

Table of Content

Setup Instructions

Frontend

  1. In the /frontend directory, install the required node modules.
npm install
  1. Start the application.
npm run start

And you are ready to start using the FeedItForward Frontend! The frontend application is running on https://localhost:3000/

Backend

  1. In the /backend directory, create a python virtual environment and activate it.
python -m venv .venv
. .venv/Scripts/activate # The .venv activation command might differ depending on your operating system
  1. Install the required packages.
pip install -r requirements.txt
  1. In the /backend/app directory, start the application.
cd app
uvicorn main:app --reload

And you are ready to start using the FeedItForward Backend! The server application is running on https://127.0.0.1:8000/

Database Seeding

If you would like to seed the database with pre-configured data, please uncomment the following line in the backend/app/main.py before re-starting the application.

# app/main.py
# Uncomment this line 👇🏻
# add_event_listener_to_seed_database()

Note: Please ensure that the sql_app.db in the app directory is deleted before re-starting the application.

Pre-configured Users

Name Role Email Password
Admin Jane Admin [email protected] 123123123
Janice Consumer [email protected] 123123123
Alicia Consumer [email protected] 123123123
James Consumer [email protected] 123123123
Alex (A Hot Hideout) Hawker [email protected] 123123123
Adam (North Spine Koufu - Cai Fan Store) Hawker [email protected] 123123123
Aaron (The Crowded Bowl) Hawker [email protected] 123123123
Tim Driver [email protected] 123123123
Thomas Driver [email protected] 123123123

Documentation

API Docs

The FeedItForward Backend application uses FastAPI, which comes with an in-built documentation for API routes created. You may access it via https://127.0.0.1:8000/docs#/

*Note: A total of 100 API routes are documented.

docs preview

API Endpoints

The FeedItForward API Endpoints consists of 3 main category - Controller, CRUD, and Misc.

  1. Controller: API endpoints for Controller specific functionalities as specified in the class diagrams designed.
  2. CRUD: API endpoints for basic Create, Read, Update, and Delete Operation on classes saved in the database.
  3. Misc: Other API endpoints such as file uploads and retrievals.

Please refer to the the API Docs page for the specific endpoints and the required request body and expected response.

App Design

Overview

App Overview Design Diagram Credits: ztjhz

Frontend

The frontend (React.js) mainly consists of the different User Interfaces (Screens), which are structured and categorized into AdminUI, ConsumerUI, DriverUI, HawkerUI, and MainUI as designed in the class diagrams. More detailed sub-screens can be found in the respective UI screen folders. They can be found in the /src/screens directory.

The /src/App.tsx is the entry point of the frontend application.

Other folders such as /components, /contexts, /data, /utils, /schemas, /hooks, and /contexts contains helper files that makes the frontend code more organized and easier to read for ease of collaboration (as recommended by the React.js framework).

Backend

  • 📁 app/assets
    • Contains server assets like data files and uploads.
  • 📁 app/models
    • Contains the Business Objects.
  • 📁 app/services
    • Contains methods to create, read, update, and delete business objects.
  • 📁 app/controllers
    • Controllers that uses the various services implemented in the app/services directory.
    • They implements the Facade Pattern by masking the more complex underlying implementation details from the frontend.
  • 📁 app/routers
    • Routers that implements REST API endpoints for communication between frontend and backend. They allow the frontend to use the controllers in the backend.
    • Routers use the controllers implemented in the app/controllers directory.
  • 📁 app/schemas
    • Defines all the request and response fields.
  • 📁 app/factory
    • Factory design pattern implementation of the database.
  • 📁 app/database.py
    • Entry point to database that will store all the business objects.
  • 📁 app/websocket.py
    • Implements the Publisher-Subscriber Pattern via websockets for real-time text messaging communication between different users.

Design Patterns