Deploy a React application with PostgreSQL powered by the Bun runtime to Railway.
After cloning the repository:
- Install dependencies:
bun install- Run the development server:
bun devMake sure you have the Railway CLI installed:
bun install -g @railway/cliLog into your Railway account:
railway loginAfter successfully authenticating, create a new project:
# Initialize project
railway init
# Add PostgreSQL database. Make sure to add this first!
railway add --database postgres
# Add your application service.
railway add --service bun-react-db --variables DATABASE_URL=\${{Postgres.DATABASE_URL}}After the services have been created and connected, deploy the application to Railway. By default, services are only accessible within Railway's private network. To make your app publicly accessible, you need to generate a public domain.
# Deploy your application
railway up
# Generate public domain
railway domain- Go to Railway Dashboard
- Click "New Project"
- Select "Deploy from GitHub repo"
- Choose your repository
- Select your service
- Go to "Settings" tab
- Under "Networking", click "Generate Domain"
Your website is now live! Railway auto-deploys on every GitHub push.