✅ Backend works locally with MySQL
❌ Backend doesn't work on Render.com
- No separate database needed
- Works on Render's free tier
- Setup in 5 minutes
- Perfect for this application
1. Set Environment Variables on Render
Go to: https://dashboard.render.com → Your backend service → Environment
Click "Add Environment Variable" and add these:
| Key | Value |
|---|---|
APP_NAME |
Validation Engine |
APP_ENV |
production |
APP_KEY |
See below |
APP_DEBUG |
false |
APP_URL |
https://validation-engine-backend.onrender.com |
DB_CONNECTION |
sqlite |
DB_DATABASE |
/opt/render/project/src/database/database.sqlite |
LOG_CHANNEL |
stack |
LOG_LEVEL |
error |
Generate APP_KEY locally:
cd E:\work\Angular\validation-engine-backend
php artisan key:generate --showCopy the entire output (including base64:) and paste as APP_KEY value.
2. Update Render Build/Start Commands
Still in Render dashboard → Your service → Settings:
- Build Command:
bash build.sh - Start Command:
php -S 0.0.0.0:$PORT -t public
Click "Save Changes"
3. Push Your Code
cd E:\work\Angular\validation-engine-backend
git add .
git commit -m "Configure for Render with SQLite"
git push origin main4. Wait & Test (2-3 minutes)
Render will auto-deploy. Check logs for:
- ✅ "Migration table created successfully"
- ✅ "Build complete!"
Then test: https://validation-engine-backend.onrender.com/api/validation_rules
Should return: []
✅ DONE! Your backend is working!
- Better for production
- Free on Render
- More scalable
1. Create PostgreSQL Database
- Go to: https://dashboard.render.com
- Click "New +" → "PostgreSQL"
- Name:
validation-engine-db - Database:
validation_engine - Region: Same as your web service
- Plan: Free
- Click "Create Database"
2. Get Database Credentials
After creation, go to database → Info tab
Note these values:
- Hostname
- Port (usually 5432)
- Database
- Username
- Password
3. Set Environment Variables on Render
Go to your web service → Environment:
| Key | Value |
|---|---|
APP_NAME |
Validation Engine |
APP_ENV |
production |
APP_KEY |
Generate with php artisan key:generate --show |
APP_DEBUG |
false |
APP_URL |
https://validation-engine-backend.onrender.com |
DB_CONNECTION |
pgsql |
DB_HOST |
From database info |
DB_PORT |
5432 |
DB_DATABASE |
From database info |
DB_USERNAME |
From database info |
DB_PASSWORD |
From database info |
LOG_CHANNEL |
stack |
LOG_LEVEL |
error |
4. Update Build/Start Commands
In Render dashboard → Your service → Settings:
- Build Command:
bash build.sh - Start Command:
php -S 0.0.0.0:$PORT -t public
Click "Save Changes"
5. Push Your Code
cd E:\work\Angular\validation-engine-backend
git add .
git commit -m "Configure for Render with PostgreSQL"
git push origin main6. Wait & Test
Check logs, then test: https://validation-engine-backend.onrender.com/api/validation_rules
✅ DONE!
1. Root (should work):
https://validation-engine-backend.onrender.com/
Expected: {"message":"Validation Engine API"...}
2. API Test (should work):
https://validation-engine-backend.onrender.com/api/test
Expected: {"message":"API is working!"...}
3. Validation Rules (should work):
https://validation-engine-backend.onrender.com/api/validation_rules
Expected: []
4. Frontend (should work):
https://validation-engine-frontend.netlify.app
- Admin page should load
- No CORS errors
- Can create validation rules
Dashboard → Your Service → Logs
Look for errors like:
SQLSTATE[HY000]→ Database connection problemNo APP_KEY→ Need to set APP_KEYMigration failed→ Check database credentials
Problem: "No application encryption key"
php artisan key:generate --showCopy output and set as APP_KEY on Render.
Problem: "Connection refused" or "Database error"
- Check DB_* environment variables
- Verify database is running (PostgreSQL option)
- Verify DB_DATABASE path (SQLite option)
Problem: "404 Not Found" for all routes
- Check Start Command:
php -S 0.0.0.0:$PORT -t public - Redeploy: Dashboard → "Manual Deploy" → "Clear build cache & deploy"
Problem: Still seeing CORS errors
- Make sure backend is actually working (test the endpoints above)
- Check that requests are reaching the backend (look at Render logs)
- Verify CORS middleware is applied (check bootstrap/app.php)
- Option 1 (SQLite): 5-10 minutes
- Option 2 (PostgreSQL): 10-15 minutes
- Check Render logs for specific error messages
- Test each endpoint individually
- Verify all environment variables are set correctly
- Try "Clear build cache & deploy" in Render dashboard
Let's get your backend working! Choose an option above and follow the steps. 🚀