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
Diagrams
Table of Content
- FeedItForward 🍚
- Setup Instructions
- Pre-configured Users
- Documentation
- API Docs
- App Design
- External APIs
- Contributors
- In the
/frontend
directory, install the required node modules.
npm install
- 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/
- 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
- Install the required packages.
pip install -r requirements.txt
- 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/
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.
Name | Role | 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 |
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.
The FeedItForward API Endpoints consists of 3 main category - Controller
, CRUD
, and Misc
.
Controller
: API endpoints for Controller specific functionalities as specified in the class diagrams designed.CRUD
: API endpoints for basic Create, Read, Update, and Delete Operation on classes saved in the database.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.
Credits: ztjhz
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).
📁 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.
- Controllers that uses the various services implemented in the
📁 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.