Skip to main content

Deployment Guide

This guide covers multiple deployment strategies for the Pet Service Management System.

Docker

Containerized deployment

Railway

One-click deployment with Railway MCP

Cloud Platforms

AWS, GCP, Vercel

Docker Deployment

Prerequisites

  • Docker 20.10+
  • Docker Compose 2.0+

Step 1: Build Docker Images

Create a Dockerfile in the root directory:

Step 2: Docker Compose Configuration

Create docker-compose.yml in the root directory:
docker-compose.yml

Step 3: Environment Configuration

Create .env file in the root directory:
.env
Security: Never commit .env to version control. Use .env.example as template.

Step 4: Build and Run

1

Build Images

2

Start Services

3

Verify Services

4

Access Application

  • Frontend: http://localhost:3000
  • Backend API: http://localhost:3001
  • Prisma Studio: docker-compose exec backend npx prisma studio

Docker Management Commands


Railway Deployment

Railway provides automatic deployments with built-in PostgreSQL and zero-config setup.

Option 1: Deploy via Railway CLI

1

Install Railway CLI

2

Login to Railway

3

Initialize Project

4

Add PostgreSQL Database

Railway automatically sets DATABASE_URL environment variable.
5

Set Environment Variables

6

Deploy Backend

7

Deploy Frontend

8

Run Migrations

Option 2: Deploy via Railway Button

Deploy to Railway

Click to deploy with one button
  1. Click “Deploy on Railway” button
  2. Connect your GitHub repository
  3. Railway auto-detects backend/frontend
  4. Add PostgreSQL database from Railway marketplace
  5. Set environment variables in Railway dashboard
  6. Deploy automatically on git push

Railway Environment Variables

Set these in Railway dashboard or CLI:

Railway MCP Integration

Railway MCP (Model Context Protocol) enables AI assistants to manage your deployments.
Configure Railway MCP:
  1. Install Railway MCP server:
  1. Configure in your Claude Code settings:
  1. Use AI commands:

Cloud Platform Deployment

Vercel (Frontend)

1

Install Vercel CLI

2

Deploy Frontend

3

Set Environment Variables

4

Production Deployment

Heroku (Backend)

1

Install Heroku CLI

2

Create Heroku App

3

Add PostgreSQL

4

Set Environment Variables

5

Deploy

6

Run Migrations

AWS (Full Stack)


Production Checklist

  • HTTPS/TLS enabled (use Let’s Encrypt or cloud provider SSL)
  • Strong secrets (32+ characters, randomly generated)
  • Environment variables properly set (no hardcoded secrets)
  • CORS configured for specific origins
  • Rate limiting enabled on API endpoints
  • Database backups configured (daily/hourly)
  • Security headers configured (Helmet.js)
  • CDN configured for static assets
  • Database connection pooling enabled
  • Query optimization with proper indexes
  • Caching strategy implemented (Redis optional)
  • Image optimization enabled
  • Gzip compression enabled
  • Application logging configured
  • Error tracking (Sentry, LogRocket)
  • Uptime monitoring (UptimeRobot, Pingdom)
  • Performance monitoring (New Relic, DataDog)
  • Database monitoring (pgAdmin, Railway analytics)
  • Production database created
  • Migrations applied: npx prisma migrate deploy
  • Seed data loaded (if needed)
  • Backup strategy configured
  • Connection pool configured
  • Indexes optimized
  • NODE_ENV=production set
  • All required environment variables configured
  • Frontend API URL points to production backend
  • Backend CORS allows production frontend
  • Email service configured (SMTP credentials)

Continuous Deployment

GitHub Actions

Create .github/workflows/deploy.yml:

Monitoring & Maintenance

Health Checks

View Logs

Database Backup


Troubleshooting

Solution:
  • Check build logs: railway logs or docker-compose logs
  • Verify environment variables are set
  • Ensure dependencies are installed: npm ci
  • Check Dockerfile syntax
Solution:
  • Verify DATABASE_URL is correct
  • Check database is running
  • Confirm firewall rules allow connection
  • Test connection: psql $DATABASE_URL
Solution:
  • Set FRONTEND_URL in backend environment
  • Verify CORS configuration in main.ts
  • Check frontend uses correct API URL
Solution:
  • Use Railway/Vercel automatic SSL
  • For custom domains, configure SSL certificate
  • Use Let’s Encrypt for free SSL: certbot

Next Steps

Architecture Overview

Understand system design

API Reference

Explore REST endpoints

Installation Guide

Set up development environment

Back to Home

Return to homepage

Deployment Complete! Your Pet Service Management System is now live.