@@ -7,12 +7,11 @@ This guide covers deploying the AI Grant Crawler application to production.
77The application consists of two main components:
88
991 . ** Frontend** (SvelteKit) - Deployed to Vercel (automatic via GitHub integration)
10- 2 . ** Backend** (Node.js/Express) - Deployed to Fly.io (manual setup required)
10+ 2 . ** Backend** (Node.js/Express) - Deployed to Railway or Fly.io
1111
1212## Prerequisites
1313
14- - [ Fly.io CLI] ( https://fly.io/docs/hands-on/install-flyctl/ ) installed
15- - Fly.io account created
14+ - Railway account OR [ Fly.io CLI] ( https://fly.io/docs/hands-on/install-flyctl/ ) installed
1615- Supabase project with database schema applied
1716- API keys for Gemini (required) and OpenRouter (optional)
1817
@@ -28,7 +27,46 @@ Set these in your Vercel project settings:
2827PUBLIC_API_URL=https://your-backend.fly.dev/api
2928```
3029
31- ## Backend Deployment (Fly.io)
30+ ## Backend Deployment (Railway) - Recommended
31+
32+ Railway is the recommended deployment platform for the backend. A ` railway.json ` configuration file is already included.
33+
34+ ### 1. Connect Repository
35+
36+ 1 . Go to [ Railway Dashboard] ( https://railway.app/dashboard )
37+ 2 . Click "New Project" > "Deploy from GitHub repo"
38+ 3 . Select ` Datakult0r/ai-grant-crawler-a2a-pro `
39+ 4 . Choose the ` backend ` directory as the root
40+
41+ ### 2. Set Environment Variables
42+
43+ In Railway Dashboard > Project > Variables:
44+
45+ ```
46+ # Required
47+ SUPABASE_URL=https://your-project.supabase.co
48+ SUPABASE_ANON_KEY=your-anon-key
49+ GEMINI_API_KEY=your-gemini-key
50+ PORT=3000
51+
52+ # Optional
53+ OPENROUTER_API_KEY=your-openrouter-key
54+ LOW_COST_MODE=true
55+ AI_RESEARCHER_ENABLED=false
56+ IS_DEMO=false
57+ ```
58+
59+ ### 3. Deploy
60+
61+ Railway will automatically deploy when you push to the connected branch. You can also trigger manual deploys from the dashboard.
62+
63+ ### 4. Get Your Backend URL
64+
65+ After deployment, Railway provides a URL like ` https://your-app.up.railway.app ` . Use this for the frontend's ` PUBLIC_API_URL ` .
66+
67+ ---
68+
69+ ## Backend Deployment (Fly.io) - Alternative
3270
3371### 1. Install Fly CLI
3472
@@ -130,9 +168,23 @@ Access your app's metrics and logs at: https://fly.io/apps/your-app-name
130168
131169### Health Check
132170
133- The backend exposes a ` /health ` endpoint that returns:
134- - Database connectivity status
135- - API key configuration status
171+ The backend exposes several monitoring endpoints:
172+
173+ ** ` /health ` ** - Basic health check
174+ - Returns: ` { status: "ok", timestamp, environment } `
175+
176+ ** ` /version ` ** - Application version info
177+ - Returns: ` { version, name, buildTime, nodeVersion, environment } `
178+
179+ ** ` /metrics ` ** - Runtime metrics
180+ - Returns: ` { uptime, uptimeFormatted, requestCount, memory: { heapUsed, heapTotal, rss }, environment } `
181+
182+ Example:
183+ ``` bash
184+ curl https://your-app.fly.dev/health
185+ curl https://your-app.fly.dev/version
186+ curl https://your-app.fly.dev/metrics
187+ ```
136188
137189## Troubleshooting
138190
0 commit comments