Skip to content

bun-templates/railway-react-postgres-starter

Repository files navigation

Bun + React + PostgreSQL Starter on Railway

Deploy a React application with PostgreSQL powered by the Bun runtime to Railway.

Deploy on Railway

Local Development

After cloning the repository:

  1. Install dependencies:
bun install
  1. Run the development server:
bun dev

Deployment

Method 1: Deploy via CLI

Make sure you have the Railway CLI installed:

bun install -g @railway/cli

Log into your Railway account:

railway login

After 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

Method 2: Deploy via Dashboard

Step 1: Create New Project

  1. Go to Railway Dashboard
  2. Click "New Project"
  3. Select "Deploy from GitHub repo"
  4. Choose your repository

Step 2: Generate Public Domain

  1. Select your service
  2. Go to "Settings" tab
  3. Under "Networking", click "Generate Domain"

Your website is now live! Railway auto-deploys on every GitHub push.


About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published