Platform
Deployment Guide
Deploy XandScan to production on Docker, Railway, Vercel, or custom infrastructure
Before You Deploy
Ensure you have completed local development setup and testing. See the Quick Start Guide first.
Docker Deployment
The recommended method for production deployments.
Step 1: Create Dockerfile
Create a Dockerfile in the project root:
FROM node:20-alpine AS base
# Install dependencies only when needed
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app
COPY package*.json ./
RUN npm ci
# Rebuild the source code only when needed
FROM base AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
# Set environment variables
ENV NEXT_PUBLIC_APP_VERSION=1.0.0
ENV NODE_ENV=production
RUN npm run build
# Production image
FROM base AS runner
WORKDIR /app
ENV NODE_ENV=production
RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs
COPY --from=builder /app/public ./public
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
USER nextjs
EXPOSE 3000
ENV PORT=3000
CMD ["node", "server.js"]Step 2: Build and Run
# Build the image
docker build -t xandscan .
# Run the container
docker run -p 3000:3000 \
-e NEXT_PUBLIC_APP_VERSION=1.0.0 \
xandscanStep 3: Docker Compose (Optional)
Create docker-compose.yml:
version: '3.8'
services:
xandscan:
build: .
ports:
- "3000:3000"
environment:
- NEXT_PUBLIC_APP_VERSION=1.0.0
- NODE_ENV=production
restart: unless-stoppeddocker-compose up -dRailway Deployment
Deploy to Railway with zero configuration.
Option 1: One-Click Deploy
- 1. Click the "Deploy on Railway" button (if available in repository)
- 2. Connect your GitHub account
- 3. Configure environment variables (optional)
- 4. Deploy
Option 2: Manual Deployment
- 1. Visit railway.app and sign in
- 2. Click "New Project" → "Deploy from GitHub repo"
- 3. Select your XandScan repository
- 4. Railway auto-detects Next.js and configures build settings
- 5. Add environment variables (optional):
- •
NEXT_PUBLIC_APP_VERSION
- •
- 6. Click "Deploy" - Railway handles the rest
Railway provides: Automatic HTTPS, custom domains, auto-scaling, and CDN integration.
Custom VPS/Server Deployment
Deploy on any Linux server with Node.js.
Prerequisites
- • Ubuntu 20.04+ or similar Linux distribution
- • Node.js 20+ installed
- • Nginx or Apache for reverse proxy
- • PM2 for process management
Deployment Steps
# 1. Clone and build
git clone https://github.com/your-org/xandscan.git
cd xandscan
npm install
npm run build
# 2. Install PM2
npm install -g pm2
# 3. Start with PM2
pm2 start npm --name "xandscan" -- start
# 4. Set up PM2 to start on boot
pm2 startup
pm2 save
# 5. Check status
pm2 statusNginx Configuration
Create /etc/nginx/sites-available/xandscan:
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}# Enable site
sudo ln -s /etc/nginx/sites-available/xandscan /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginxEnvironment Variables
Configuration options for all deployment methods:
NEXT_PUBLIC_APP_VERSION
Version number displayed in UI (default: 1.0.0)
NODE_ENV
Set to "production" for production builds (auto-set by most platforms)
Post-Deployment Checklist
- Verify dashboard loads and shows network data
- Test node search and filtering
- Confirm data export (CSV/JSON) works
- Check mobile responsiveness
- Verify HTTPS is enabled (if custom domain)
- Monitor performance (should load in 6-7 seconds)
Production Best Practices
- • Use a CDN for static assets (automatic on Railway/Vercel)
- • Enable compression (gzip/brotli)
- • Set up monitoring and error tracking
- • Configure automated backups
- • Use environment-specific configurations
- • Keep dependencies up to date