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.
Strategy + Factory Patterns
for Database Implementation. a. Refer tobackend/app/factory/database.py
Facade Pattern
via the Controllers. a. Refer tobackend/app/controllers/*.py
Publisher-Subscriber Pattern
for real-time text messaging communication between different users (websocket). a. Refer tobackend/app/websocket.py
Single Responsibility Principle (SRP)
a. Different packages with different distinct responsibilities are created. Specific classes in each package are responsible for a specific business model or logic group.Open-Closed Principle (OCP)
a. The application is open to extension through the use of strategy pattern (database) as well as facade pattern (controllers).Interface Segregation Principle (ISP)
a. Numerous small and specific interfaces are used. b. For example, inbackend/app/schemas/consumer.py
, there areConsumer
,ConsumerCreate
, andConsumerUpdate
interfaces which are used for different purposes (Display, Creation, and Update).Dependency Inversion Principle (DIP)
a. High level and low level modules depends on abstractions through the use of the interfaces (backend/app/schemas
andfrontend/src/schemas
).
Frontend:
- React.js
- TypeScript
- Tailwind CSS
Backend:
- FastAPI
- Python
- MySQL
- Singapore's OneMap API
- Weather API (Live)
- 24-hour Weather Forecast (https://beta.data.gov.sg/datasets/d_50d2bbe678607d78d74a0fe6e8b5b6dd/view)
- 4-day Weather Forecast (https://beta.data.gov.sg/datasets/d_1efe4728b2dad26fd7729c5e4eff7802/view)
- Hawker GeoJson Dataset
- Google OAuth 2.0 API
The following contributors have contributed to the whole Software Developement Life-cycle, including (not exhausive):
- Ideation and refinement
- Generation of functional and non-funtional requirements
- Generation of Use Cases and Descriptions
- UI/UX Mockup and Prototyping (Figma)
- Design of Architecture Diagram, Class Diagram, Sequence Diagrams, and Dialog Map Diagram
- Development of Application
- Black-box and White-box Testing
- Documentations
Name | Github Username | Role |
---|---|---|
Toh Jing Qiang | xJQx | Full-Stack |
Toh Jing Hua | ztjhz | Backend |
Denise Tay | denisetay8 | Frontend |
Minze | min-ze | Frontend |
Tommy Wee | toomywee | Frontend |
Pinyang | druggoat888 | Frontend |