Skip to content

Commit b2515b1

Browse files
committed
Add render configuration for AegisExpress Logistics API and update build command in YAML
1 parent d170451 commit b2515b1

File tree

5 files changed

+13082
-3
lines changed

5 files changed

+13082
-3
lines changed

.github/workflows/deploy.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,12 @@ jobs:
5858
cache-dependency-path: api/package-lock.json
5959

6060
- name: Install API dependencies
61-
run: npm ci
61+
run: |
62+
if [ ! -f package-lock.json ]; then
63+
npm install
64+
else
65+
npm ci || npm install
66+
fi
6267
6368
- name: Run API tests
6469
run: npm test || echo "No tests found"
@@ -86,7 +91,12 @@ jobs:
8691
cache-dependency-path: client/package-lock.json
8792

8893
- name: Install Client dependencies
89-
run: npm ci
94+
run: |
95+
if [ ! -f package-lock.json ]; then
96+
npm install
97+
else
98+
npm ci || npm install
99+
fi
90100
91101
- name: Build Client
92102
run: npm run build

DEPLOY_GUIDE.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# 🚀 Quick Deployment Guide - AegisExpress Logistics
2+
3+
## Manual Deployment (Recommended for First Time)
4+
5+
### Step 1: Deploy API to Render
6+
7+
#### A. Sign up for Render
8+
1. Go to [render.com](https://render.com) and sign up
9+
2. Connect your GitHub account
10+
3. Import your `ExpressLogistics` repository
11+
12+
#### B. Create Web Service
13+
1. Click "New +" → "Web Service"
14+
2. Select your `ExpressLogistics` repository
15+
3. Configure the service:
16+
17+
```yaml
18+
Name: aegis-express-api
19+
Environment: Node
20+
Region: Oregon (US-West)
21+
Branch: main
22+
Build Command: cd api && npm install
23+
Start Command: cd api && npm start
24+
Plan: Free (for testing)
25+
```
26+
27+
#### C. Add Environment Variables
28+
In the Render dashboard, add these environment variables:
29+
30+
```env
31+
NODE_ENV=production
32+
PORT=10000
33+
MONGODB_URI=mongodb+srv://techagbadev:7X7Vql0Q0t2gZVOv@aegisexpresslogistics.nj62fnk.mongodb.net/logisticsDB?retryWrites=true&w=majority&appName=AegisExpressLogistics
34+
JWT_SECRET=your_secure_jwt_secret_here_change_in_production
35+
JWT_EXPIRES=7d
36+
REDIS_URL=rediss://default:AdZnAAIncDFkYzg1MTViMzVmMGI0MTFhYjhmZGQxMTczOTk5OTYzNnAxNTQ4ODc@full-skylark-54887.upstash.io:6379
37+
EMAIL_USER=techagbadev@gmail.com
38+
EMAIL_PASS=zimtqbuzrypfmkgk
39+
SMTP_HOST=smtp.gmail.com
40+
SMTP_PORT=465
41+
FROM_EMAIL=boltdropa@gmail.com
42+
CLOUDINARY_CLOUD_NAME=dk1cria0z
43+
CLOUDINARY_API_KEY=747368826295982
44+
CLOUDINARY_API_SECRET=HbljlQwEoDR6ndvo98KNQy6Lbyk
45+
FRONTEND_URL=https://your-app-name.vercel.app
46+
```
47+
48+
#### D. Deploy API
49+
1. Click "Create Web Service"
50+
2. Wait for deployment (5-10 minutes)
51+
3. Note your API URL: `https://your-service-name.onrender.com`
52+
53+
---
54+
55+
### Step 2: Deploy Client to Vercel
56+
57+
#### A. Sign up for Vercel
58+
1. Go to [vercel.com](https://vercel.com) and sign up
59+
2. Import your `ExpressLogistics` repository
60+
61+
#### B. Configure Project
62+
```yaml
63+
Framework Preset: Vite
64+
Root Directory: client
65+
Build Command: npm run build
66+
Output Directory: dist
67+
Install Command: npm install
68+
```
69+
70+
#### C. Add Environment Variables
71+
```env
72+
VITE_API_URL=https://your-render-api-url.onrender.com/api
73+
VITE_CLOUDINARY_CLOUD_NAME=dk1cria0z
74+
VITE_CLOUDINARY_UPLOAD_PRESET=delivery_invoices
75+
```
76+
77+
#### D. Deploy Client
78+
1. Click "Deploy"
79+
2. Wait for deployment (3-5 minutes)
80+
3. Note your app URL: `https://your-app-name.vercel.app`
81+
82+
---
83+
84+
### Step 3: Update Configuration
85+
86+
#### Update API with Client URL
87+
1. Go back to Render dashboard
88+
2. Update `FRONTEND_URL` environment variable:
89+
```env
90+
FRONTEND_URL=https://your-app-name.vercel.app
91+
```
92+
3. Redeploy the API service
93+
94+
---
95+
96+
## Quick Test Commands
97+
98+
### Test API Health
99+
```bash
100+
curl https://your-api-url.onrender.com/api/health
101+
```
102+
103+
### Test Client
104+
Open your Vercel URL in browser and test:
105+
1. Home page loads
106+
2. Tracking input works
107+
3. Admin login works
108+
109+
---
110+
111+
## Alternative: One-Click Deploy
112+
113+
### Render Deploy Button
114+
Click this button to deploy API instantly:
115+
116+
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy?repo=https://github.com/RabbitDaCoder/ExpressLogistics)
117+
118+
### Vercel Deploy Button
119+
Click this button to deploy Client instantly:
120+
121+
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https://github.com/RabbitDaCoder/ExpressLogistics&root-directory=client&env=VITE_API_URL&envDescription=API%20endpoint%20URL&envLink=https://your-api.onrender.com/api)
122+
123+
---
124+
125+
## Troubleshooting
126+
127+
### Common Issues
128+
129+
#### 1. API Build Fails with npm ci Error
130+
**Solution:** The render.yaml is configured to use `npm install` instead of `npm ci`
131+
132+
#### 2. Client Can't Connect to API
133+
**Solution:** Check CORS settings and update `FRONTEND_URL` in API environment variables
134+
135+
#### 3. Email Service Not Working
136+
**Solution:** Verify SMTP credentials in Render environment variables
137+
138+
#### 4. PDF Generation Fails
139+
**Solution:** Check Cloudinary credentials in both API and Client
140+
141+
---
142+
143+
## Success URLs
144+
145+
After successful deployment, you should have:
146+
147+
- **API**: `https://aegis-express-api.onrender.com`
148+
- **Client**: `https://aegis-express.vercel.app`
149+
- **Admin Panel**: `https://aegis-express.vercel.app/admin`
150+
151+
---
152+
153+
## Next Steps
154+
155+
1. Test all functionality
156+
2. Set up custom domain (optional)
157+
3. Configure monitoring and alerts
158+
4. Set up automated deployments via GitHub Actions
159+
5. Scale to paid plans for production traffic
160+
161+
---
162+
163+
**🎉 Congratulations! Your AegisExpress Logistics system is now live!**

0 commit comments

Comments
 (0)