Skip to content

Commit c39fb9e

Browse files
update the readme file
1 parent 6cb7c3c commit c39fb9e

1 file changed

Lines changed: 107 additions & 0 deletions

File tree

README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# 🍹 blendRUSH Backend
2+
3+
This is the backend of the **Juice Bar Ordering System**, implemented using a **Node.js microservices architecture** with an **API Gateway**.
4+
It provides secure and modular APIs for menu, user, order, and cart management.
5+
6+
The backend is containerized with **Docker** and deployed on **AWS EC2** using **Terraform** and **GitHub Actions** for CI/CD.
7+
8+
---
9+
10+
## 🚀 Tech Stack
11+
- **Node.js + Express** – Backend framework for services
12+
- **Microservices Architecture** – Independent services for modularity
13+
- **MongoDB** – Database for storing menu, users, orders, and carts
14+
- **API Gateway** – Single entry point using `http-proxy-middleware`
15+
- **Docker & Docker Compose** – Containerization and orchestration
16+
- **Terraform** – Infrastructure provisioning on AWS EC2
17+
- **GitHub Actions** – CI/CD automation for backend deployments
18+
- **Nginx + SSL** – Reverse proxy and HTTPS support
19+
20+
---
21+
22+
## 📂 Project Structure
23+
24+
```
25+
backend/
26+
│── .github/ # GitHub Actions workflows (CI/CD)
27+
│── api-gateway/ # API Gateway service
28+
│── cart-service/ # Cart microservice
29+
│── menu-service/ # Menu microservice
30+
│── order-service/ # Order microservice
31+
│── terraform/ # Terraform IaC for AWS EC2 provisioning
32+
│── user-service/ # User microservice
33+
│── .env # Environment variables
34+
│── .gitignore
35+
│── docker-compose.yml # Docker Compose file
36+
```
37+
38+
---
39+
40+
## ⚙️ Installation & Running Locally
41+
42+
### 1. Clone the repository
43+
```bash
44+
git clone https://github.com/BlendRush/backend.git
45+
cd backend
46+
```
47+
48+
### 2. Configure environment variables
49+
Create a `.env` file with the following variables:
50+
```
51+
MONGODB_URI=your_mongodb_connection
52+
MONGODB_URI_USER_SERVICE=your_mongodb_connection
53+
MONGODB_URI_ORDER_SERVICE=your_mongodb_connection
54+
MONGODB_URI_CART_SERVICE=your_mongodb_connection
55+
56+
CLOUDINARY_CLOUD_NAME=your_cloudinary_name
57+
CLOUDINARY_API_KEY=your_cloudinary_key
58+
CLOUDINARY_API_SECRET=your_cloudinary_secret
59+
60+
ENCRYPTION_KEY=your_encryption_key
61+
ACCESS_TOKEN=your_access_token
62+
CLIENT_ID=your_google_client_id
63+
CLIENT_SECRET=your_google_client_secret
64+
CLIENT_URL=your_oauth_redirect_url
65+
```
66+
67+
### 3. Run with Docker Compose
68+
```bash
69+
docker-compose up --build
70+
```
71+
72+
Services will run on:
73+
- API Gateway → `http://localhost:3000`
74+
- Menu Service → `http://localhost:3001`
75+
- Order Service → `http://localhost:3002`
76+
- User Service → `http://localhost:3003`
77+
- Cart Service → `http://localhost:3005`
78+
79+
---
80+
81+
## ☁️ Deployment to AWS
82+
83+
### 1. Provision Infrastructure with Terraform
84+
Terraform is used to create:
85+
- EC2 instance with **t2.micro** (Free Tier)
86+
- Security group with ports 22 (SSH), 80 (HTTP), 443 (HTTPS), and 3000–3005
87+
88+
```bash
89+
cd terraform
90+
terraform init
91+
terraform apply
92+
```
93+
94+
### 2. Deploy via GitHub Actions
95+
When code is merged into `main`, GitHub Actions automatically:
96+
1. Builds Docker images
97+
2. Connects to EC2 via SSH
98+
3. Runs `docker-compose down`
99+
4. Runs `docker-compose up --build -d`
100+
5. Deploys the latest version of all backend services
101+
102+
### 3. Nginx + SSL
103+
- Nginx is configured as a reverse proxy
104+
- Routes HTTPS (port 443) → API Gateway (port 3000)
105+
- A **self-signed SSL certificate** is used for testing
106+
- In production, a **Let’s Encrypt certificate** should be used
107+

0 commit comments

Comments
 (0)