Railway is the fastest path to production. It manages PostgreSQL and Redis as plugins, and deploys from your GitHub repository automatically on every push.Documentation Index
Fetch the complete documentation index at: https://docs.aspfox.com/llms.txt
Use this file to discover all available pages before exploring further.
Create a Railway account and project
- Go to railway.app and sign up
- Click New Project
- Select Empty Project
- Name the project (e.g.,
Acme Production)
Add PostgreSQL
- In your project, click New → Database → Add PostgreSQL
- Railway creates a PostgreSQL instance and adds it to your project
- Click on the PostgreSQL service → Variables tab
- Copy the
DATABASE_URLvalue — you will need it shortly
Add Redis
- Click New → Database → Add Redis
- Click on the Redis service → Variables tab
- Copy the
REDIS_URLvalue
Deploy the API
- Click New → GitHub Repo
- Connect your GitHub account and select your repository
- Railway detects the
Dockerfilein the project root and uses it - Before the first deploy, go to the service’s Variables tab
- Add all required environment variables (see Environment Variables):
- Click Deploy — Railway builds the Docker image and starts the container
Run migrations
- Install the Railway CLI:
npm install -g @railway/cli - Log in:
railway login - Link your project:
railway link - Run migrations against the production database:
Run the database seeder
--seed-only flag runs seeders and exits without starting the HTTP server.Deploy the frontend
- In your Railway project, click New → GitHub Repo again
- Select the same repository, but this time set the Root Directory to
frontend/ - Add the frontend environment variable:
- Railway detects
package.jsonand uses the Vite build command (npm run build) - Set the Start Command to
npx serve -s dist -l 3000
Configure custom domains
- For the API service: Settings → Domains → Generate Domain or Add Custom Domain
- Add a CNAME record in your DNS pointing
api.yourdomain.comto the Railway-provided domain - Repeat for the frontend service at
yourdomain.comorapp.yourdomain.com - Railway provisions SSL automatically via Let’s Encrypt
Register the Stripe webhook
Now that you have a production API URL:
- Stripe Dashboard → Developers → Webhooks → Add endpoint
- URL:
https://api.yourdomain.com/api/v1/webhooks/stripe - Select all five required events (checkout.session.completed, customer.subscription.updated, customer.subscription.deleted, invoice.payment_failed, invoice.payment_succeeded)
- Copy the signing secret → update
STRIPE_WEBHOOK_SECRETin Railway
Verify
- Open
https://yourdomain.com— the login page should load - Log in with admin credentials (email set via
--AdminEmailat scaffold time, passwordAdmin123!) - Change the admin password immediately
- Test a complete checkout with a real payment method
- Confirm the Stripe webhook delivered successfully in the Stripe Dashboard