https://github.com/telattar/simply-cafe
Simple coffeeshop management system backend application using nodejs express and mongodb. Includes integration tests and jsDocs.
https://github.com/telattar/simply-cafe
express jest jwt-authentication mongodb mongoose nodejs supertest
Last synced: about 2 months ago
JSON representation
Simple coffeeshop management system backend application using nodejs express and mongodb. Includes integration tests and jsDocs.
- Host: GitHub
- URL: https://github.com/telattar/simply-cafe
- Owner: telattar
- License: mit
- Created: 2024-06-20T21:16:43.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-11T11:43:20.000Z (about 1 year ago)
- Last Synced: 2025-06-02T06:58:58.871Z (about 1 year ago)
- Topics: express, jest, jwt-authentication, mongodb, mongoose, nodejs, supertest
- Language: JavaScript
- Homepage:
- Size: 106 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simply Cafe ☕
A simple server-side application of a coffeeshop management system.
## Tech Used





## Features
#### User Authentication
Secure user registration and login functionality. **How?**
- [Bcrypt](https://www.npmjs.com/package/bcrypt) is used to salt and hash the password during signup instead of using other encryption techniques.
- Each authenticated user is given a signed JWT token at login.
- User roles are checked at each endpoint to make sure users are **authorized** to do a specific action.
#### Order Processing
CRUD operations for managing coffee shop products and handling customer orders, including order creation, updating, and deletion. Please refer to the API Endpoints section for more information.
#### Integration Testing
Comprehensive tests using Jest and Supertest.
## API Endpoints Summary
For input/output details, refer to the description embedded above each function in any file inside the `controller` directiory.
| Endpoint | Method | Description |
| ---------------------- | ------ | ----------------------------------------- |
| /login | POST | Logs in an existing user |
| /signUp | POST | Registers a new user |
| /logout | POST | Logs out the currently logged-in user |
| /item | POST | Creates a new item |
| /item/:id | GET | Retrieves details of a specific item |
| /item/:id | PATCH | Updates details of a specific item |
| /item/:id | DELETE | Deletes a specific item |
| /bundle | POST | Creates a new bundle |
| /bundle/:id | GET | Retrieves details of a specific bundle |
| /bundle/:id | PATCH | Updates details of a specific bundle |
| /bundle/:id | DELETE | Deletes a specific bundle |
| /menu/item | POST | Adds an item to the menu |
| /menu/bundle | POST | Adds a bundle to the menu |
| /menu | GET | Retrieves the entire menu |
| /menu/item/:id/stock | PATCH | Updates the stock of an item in the menu |
| /menu/bundle/:id/stock | PATCH | Updates the stock of a bundle in the menu |
| /menu/item/:id | DELETE | Removes an item from the menu |
| /menu/bundle/:id | DELETE | Removes a bundle from the menu |
| /order | POST | Creates a new order |
| /order/:id | GET | Retrieves details of a customer's order |
| /order/:id/cancel | PATCH | Cancels a customer's order |
| /order/:id/complete | PATCH | Marks an order as complete |
## Installation
1. **Clone the repository**:
```bash
git clone https://github.com/telattar/simply-cafe.git
cd simply-cafe
```
2. **Install dependencies**:
```bash
npm install
```
3. **Set up environment variables**:
Create a `.env` file in the root directory and add the variables provided in the `.env.sample` file. More details in the file itself.
4. **Run the application**:
```bash
npm start
```
5. **Run tests**: please make sure your terminal is at `src` directory.
```bash
npx jest --node-options=--experimental-vm-modules --detectOpenHandles --verbose src/tests/TESTFILENAME.js
```