Table of Contents
A peer-to-peer Dartmouth Dining Service delivery app that lets students order meals using meal swipes or dining dollars, and earn extra cash by delivering orders across campus.
- LIVE DEMO https://fogo-api.onrender.com
This project is built using the MERN tech stack
To get a local copy up and running follow these simple example steps.
- You should have node installed
npm install
Follow the instruction below to get started.
- Clone the repo
git clone https://github.com/dartmouth-cs52-25s/project-api-man-to-go.git
- Install NPM packages
npm install
- Create .env file (reference .env.example)
touch .env
- Run it locally
npm start
Create a .env file at the project root. Refer to .env.example for full keys and formats.
MONGODB_URI(required): MongoDB connection stringPORT(optional): Port for the API server (defaults to 9090)FIREBASE_SERVICE_ACCOUNT_KEY(required): Stringified JSON for Firebase Admin credentialsRESEND_API_KEY(optional): Resend API key for transactional emailJWT_SECRET(required): Base64-encoded secret used to sign auth tokensJWT_EXPIRES_IN(required): Token lifetime (e.g.7d,24h)
Example .env values are provided in .env.example.
Common npm scripts:
npm start– Run in development with auto-reload (nodemon + babel-node)npm run build– Transpile todist/using Babelnpm run prod– Start the transpiled server fromdist/npm test– Lint the source using ESLint
project-api-man-to-go/
src/
controllers/ // Route handlers and business logic
firebase/ // Firebase Admin SDK initialization
middleware/ // Auth and upload middlewares
models/ // Mongoose models
routes/ // Express routers
server.js // App bootstrap and Socket.IO setup
uploads/ // Static uploads served at /uploads
- Ensure MongoDB is reachable via
MONGODB_URI - Ensure
FIREBASE_SERVICE_ACCOUNT_KEYis a valid JSON string (see.env.example) - Start the server:
npm startThe API will be available at http://localhost:${PORT || 9090}
All API routes are located in src/routes/
Auth Apis
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/auth/signup |
Sign up a user |
POST |
/api/auth/login |
Login a user |
POST |
/api/auth/forgot-password |
Request reset password code |
POST |
/api/auth/reset-password |
Reset password with the code |
GET |
/api/auth/profile |
Retrieves user's profile |
PUT |
/api/auth/profile/address |
Update user's address |
PUT |
/api/auth/profile/payment |
Update user's payment |
Cart Apis
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/cart/ |
Gets user's cart |
POST |
/api/cart/add |
Add an item to the cart |
DELETE |
/api/cart/remove |
Reduce an item in cart |
POST |
/api/cart/checkout |
Checkout user's cart |
Chat Apis
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/chat/ |
Get all chats for user |
POST |
/api/chat/order/:orderId |
Get or create a chat for an order |
GET |
/api/chat/:chatId/messages |
Get messages for a specific chat |
POST |
/api/chat/:chatId/messages |
Send a message to a chat |
POST |
/api/chat/:chatId/read |
Mark messages as read |
GET |
/api/chat/unread/count |
Get unread message count |
DELETE |
/api/chat/:chatId |
Delete a chat |
Delivery Apis
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/deliveries/available |
Get all available deliveries |
GET |
/api/deliveries/available/:deliveryID |
Get a single delivery by ID |
POST |
/api/deliveries/claim/:deliveryID |
Drivers can claim a delivery |
GET |
/api/deliveries/driver |
Gets drivers deliveries |
POST |
/api/deliveries/pickup/:deliveryID |
Mark delivery as picked up |
POST |
/api/deliveries/start/:deliveryID |
Mark delivery as enroute |
POST |
/api/deliveries/complete/:deliveryID |
Mark delivery as completed |
POST |
/api/deliveries/cancel/:deliveryID |
Mark delivery as cancelled |
Locations Apis
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/locations |
Get all locations |
GET |
/api/locations/:locationID |
Get a single location by ID |
POST |
/api/locations |
Create a new location |
GET |
/api/locations/:locationID/menu |
Get a location's menu |
DELETE |
/api/locations/:locationID |
Delete a location by ID |
Menu Apis
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/menu/ |
Get all menu items |
GET |
/api/menu/:menuItemID |
Get a single menu item by ID |
POST |
/api/menu/ |
Create a new menu item |
Notifications Apis
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/notifications/register |
Register user's device |
GET |
/api/notifications |
Gets all user's notifications |
PATCH |
/api/notifications/:id/read |
Mark notification as read |
POST |
/api/notifications/broadcast |
Broadcast notifications |
Orders Apis
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/orders |
Gets all orders |
GET |
/api/orders |
Gets a single order by ID |
PUT |
/api/orders/update/:orderID |
Update a single order by ID |
POST |
/api/orders/cancel/:orderID |
Cancel an order |
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Hamza Najam (hamzanajam7)
- Basil Lone (basillone)
- Muhammad Moiz (MuhammadMoiz20)
- Emmanuel Kasuti (ekasuti)
- Bilan Aden (Bilanaden1)
- Alexis Loveraz (alexisLoveraz)
- Ashley Liang (ashleyliangg)
- Gene The Machine (gene-themachine)
List of resources we used in this project
- Dartmouth CS52 instructors and TAs
- CS52 Expres Node backend starterpack
- Open Source ReadMe - for this ReadMe template
- DeepSeek - for debugging
- StackOverflow - for debugging
- Claude - for debugging