Restore hosted backend configuration#1
Open
alizahh-7 wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR restores hosted deployment configuration by migrating the expired Railway backend to Render (via Docker-based services) and updating the frontend/backend to use environment-driven base URLs for the backend and AI services.
Changes:
- Add a Render Blueprint (
render.yaml) plus Dockerfiles/env examples forbackend/(Node/Express) andai/(Flask/Gunicorn). - Centralize frontend API base URL handling (
frontend/src/config/api.js) and update pages/components to use it instead of hardcoded URLs. - Update backend/AI CORS configuration and backend integration points (AI base URL, Twilio webhook base URL, Firebase Admin credential loading).
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| render.yaml | Adds Render Blueprint for backend + AI services and env var wiring. |
| frontend/src/pages/VolunteerPortal.jsx | Switches task update call to environment-based API helper. |
| frontend/src/pages/Volunteer.jsx | Switches volunteer registration call to environment-based API helper. |
| frontend/src/pages/PredictiveAlerts.jsx | Switches predictive alerts call to environment-based API helper. |
| frontend/src/pages/Landing.jsx | Switches start-call endpoint to environment-based API helper. |
| frontend/src/pages/Intake.jsx | Switches AI analyze call to shared AI URL helper. |
| frontend/src/pages/Dashboard.jsx | Replaces deprecated Google Maps Marker usage with Advanced Markers; adds mapId/libraries. |
| frontend/src/pages/Analytics.jsx | Switches analytics call to environment-based API helper. |
| frontend/src/firebase.js | Allows overriding Firebase web config via VITE_FIREBASE_* env vars with fallbacks. |
| frontend/src/config/api.js | Introduces shared API_BASE/AI_BASE and apiUrl/aiUrl helpers. |
| frontend/src/components/Chatbot.jsx | Switches chatbot backend call to environment-based API helper. |
| frontend/.env.example | Adds documented Vite env vars for backend/AI URLs and Maps/Firebase settings. |
| docs/render-migration.md | Documents the Render migration approach, env vars, and verification steps. |
| docs/deployment-checklist.md | Adds a step-by-step deployment checklist for Render + Firebase Hosting. |
| backend/package.json | Adds a start script for hosted execution. |
| backend/index.js | Adds CORS allowlist, Firebase credential loading from env, hosted base URL config, and updates AI/Twilio URL usage. |
| backend/Dockerfile | Adds Docker build/run definition for backend service. |
| backend/.env.example | Documents required backend env vars for local + hosted deployments. |
| ai/requirements.txt | Adds gunicorn dependency for production serving. |
| ai/Dockerfile | Adds Docker build/run definition for AI service using gunicorn. |
| ai/app.py | Tightens CORS origin allowlist and makes debug mode env-controlled. |
| ai/.env.example | Documents AI service env vars (port, CORS, API keys). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+6
to
+8
| rootDir: backend | ||
| healthCheckPath: / | ||
| envVars: |
Comment on lines
+31
to
+38
| app.use(cors({ | ||
| origin(origin, callback) { | ||
| if (!origin || allowedOrigins.includes(origin)) return callback(null, true); | ||
| return callback(new Error(`CORS blocked origin: ${origin}`)); | ||
| }, | ||
| methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS'], | ||
| allowedHeaders: ['Content-Type', 'Authorization'] | ||
| })); |
Comment on lines
1998
to
2002
| actions: [ | ||
| { | ||
| label: "Open Intake Form", | ||
| link: `${baseUrl}/intake?msg=${encodeURIComponent(message)}` | ||
| link: `${frontendUrl}/intake?msg=${encodeURIComponent(message)}` | ||
| }, |
Comment on lines
35
to
39
| const fullText = `${form.need_type ? form.need_type + ': ' : ''}${form.message}. Location: ${form.location}` | ||
|
|
||
| const AI_BASE = import.meta.env.VITE_AI_URL | ||
|
|
||
| const aiRes = await fetch(`${AI_BASE}/analyze`, { | ||
| const aiRes = await fetch(aiUrl('/analyze'), { | ||
| method: 'POST', | ||
| headers: { 'Content-Type': 'application/json' }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.