Skip to main content

Installation Guide

This comprehensive guide covers all the ways you can install and deploy Openfront, from local development to production environments.

System Requirements

Before you begin, ensure your system meets these requirements:
  • Node.js: Version 20.0.0 or higher
  • PostgreSQL: Version 12 or higher
  • npm/yarn/pnpm/bun: Latest version of your preferred package manager
  • Storage: At least 1GB free disk space
  • Memory: Minimum 2GB RAM (4GB recommended)
Openfront uses Next.js 16 with the App Router and requires Node.js 20+. Make sure to update your Node.js installation if you’re using an older version.

Local Development Setup

This is the recommended setup for development and testing.
1
Install Prerequisites
2
First, install PostgreSQL on your system:
3
macOS
Using Homebrew:
brew install postgresql@15
brew services start postgresql@15
Or download Postgres.app for a GUI application.
Ubuntu/Debian
sudo apt update
sudo apt install postgresql postgresql-contrib
sudo systemctl start postgresql
Windows
Download and install from postgresql.orgOr use WSL2 with the Ubuntu instructions.
Docker
Run PostgreSQL in a container:
docker run --name openfront-db \
  -e POSTGRES_PASSWORD=postgres \
  -e POSTGRES_DB=openfront \
  -p 5432:5432 \
  -d postgres:15
4
Create Database
5
Create a new database for Openfront:
6
# Connect to PostgreSQL
psql -U postgres

# Create database
CREATE DATABASE openfront;

# Create user (optional)
CREATE USER openfront_user WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE openfront TO openfront_user;

# Exit psql
\q
7
Clone Repository
8
Clone the Openfront repository:
9
git clone https://github.com/openshiporg/openfront.git
cd openfront
10
Install Dependencies
11
Install all project dependencies:
12
npm
npm install
yarn
yarn install
pnpm
pnpm install
bun
bun install
13
Configure Environment
14
Create your environment configuration file:
15
cp .env.example .env
16
Edit .env and set the required variables:
17
# Database Connection
DATABASE_URL="postgresql://openfront_user:your_password@localhost:5432/openfront"

# Session Secret (generate with: openssl rand -base64 32)
SESSION_SECRET="your-secure-random-string-at-least-32-characters-long"

# Optional: Shadow database for migrations
SHADOW_DATABASE_URL="postgresql://openfront_user:your_password@localhost:5432/openfront_shadow"
18
Security: Never commit your .env file to version control. Always use strong, randomly generated values for SESSION_SECRET.
19
Run Migrations
20
Set up the database schema:
21
npm run migrate
22
This runs all Prisma migrations to create the database schema with 78+ data models.
23
Start Development Server
24
Launch the development server:
25
npm run dev
26
The application will be available at:
28
Initialize Admin User
29
Navigate to http://localhost:3000/dashboard/init to create your first admin user.

Deploy to Vercel

Vercel provides the easiest path to production deployment with automatic PostgreSQL setup.
1
One-Click Deploy
2
Click the deploy button to start:
3
Deploy with Vercel
4
Configure Environment
5
During deployment, you’ll be prompted to set:
6
  • SESSION_SECRET: A secure random string (32+ characters)
  • Database: Vercel will offer to create a PostgreSQL database
  • 7
    Vercel automatically sets DATABASE_URL when you add their PostgreSQL integration.
    8
    Deploy
    9
    Vercel will:
    10
  • Clone your repository
  • Install dependencies
  • Run the build process
  • Deploy to production
  • Run database migrations
  • 11
    Your store will be live in minutes!
    12
    Post-Deployment
    13
    After deployment:
    14
  • Visit your deployed URL
  • Navigate to /dashboard/init
  • Create your admin user
  • Complete onboarding
  • Deploy to Railway

    Railway provides a complete deployment platform with managed PostgreSQL included.
    1
    One-Click Deploy
    2
    Click the Railway button:
    3
    Deploy on Railway
    4
    Configure Services
    5
    Railway will automatically:
    6
  • Create a PostgreSQL database service
  • Create an application service
  • Link the database to your app
  • Set DATABASE_URL environment variable
  • 7
    Set Environment Variables
    8
    In the Railway dashboard, add:
    9
    SESSION_SECRET=your-secure-random-string-at-least-32-characters
    
    10
    Deploy
    11
    Railway will build and deploy your application automatically.
    12
    Access Your Store
    13
    Railway provides a public URL. Visit it and initialize your admin user.

    Docker Deployment

    Deploy Openfront using Docker and Docker Compose.
    1
    Create Docker Compose File
    2
    Create docker-compose.yml:
    3
    version: '3.8'
    
    services:
      postgres:
        image: postgres:15
        environment:
          POSTGRES_DB: openfront
          POSTGRES_USER: openfront
          POSTGRES_PASSWORD: your_secure_password
        volumes:
          - postgres_data:/var/lib/postgresql/data
        ports:
          - "5432:5432"
        healthcheck:
          test: ["CMD-SHELL", "pg_isready -U openfront"]
          interval: 10s
          timeout: 5s
          retries: 5
    
      openfront:
        build: .
        environment:
          DATABASE_URL: postgresql://openfront:your_secure_password@postgres:5432/openfront
          SESSION_SECRET: your-secure-random-string-at-least-32-characters
          NODE_ENV: production
        ports:
          - "3000:3000"
        depends_on:
          postgres:
            condition: service_healthy
        command: sh -c "npm run migrate && npm start"
    
    volumes:
      postgres_data:
    
    4
    Create Dockerfile
    5
    If not present, create Dockerfile:
    6
    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 . .
    
    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"]
    
    7
    Deploy
    8
    Start the services:
    9
    docker-compose up -d
    
    10
    Access your store at http://localhost:3000

    Self-Hosted Production

    Deploy to your own server or VPS.
    1
    Prepare Server
    2
    SSH into your server and install requirements:
    3
    # Update system
    sudo apt update && sudo apt upgrade -y
    
    # Install Node.js 20
    curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
    sudo apt install -y nodejs
    
    # Install PostgreSQL
    sudo apt install -y postgresql postgresql-contrib
    
    # Install PM2 for process management
    sudo npm install -g pm2
    
    4
    Clone and Build
    5
    Clone the repository and build:
    6
    git clone https://github.com/openshiporg/openfront.git
    cd openfront
    npm install
    
    7
    Configure Environment
    8
    Create .env file with production values:
    9
    DATABASE_URL="postgresql://openfront:password@localhost:5432/openfront"
    SESSION_SECRET="your-production-secret-at-least-32-characters"
    NODE_ENV="production"
    
    10
    Build Application
    11
    npm run build
    
    12
    Start with PM2
    13
    Start the application using PM2:
    14
    pm2 start npm --name "openfront" -- start
    pm2 save
    pm2 startup
    
    15
    Configure Nginx
    16
    Set up Nginx as a reverse proxy:
    17
    server {
        listen 80;
        server_name yourdomain.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;
        }
    }
    
    18
    Enable and restart Nginx:
    19
    sudo ln -s /etc/nginx/sites-available/openfront /etc/nginx/sites-enabled/
    sudo nginx -t
    sudo systemctl restart nginx
    
    20
    SSL Certificate
    21
    Install SSL with Let’s Encrypt:
    22
    sudo apt install certbot python3-certbot-nginx
    sudo certbot --nginx -d yourdomain.com
    

    Environment Configuration

    After installation, configure your environment variables. See the Environment Variables guide for a complete reference.

    Required Variables

    DATABASE_URL="postgresql://user:pass@host:5432/db"
    SESSION_SECRET="min-32-character-random-string"
    

    Optional Integrations

    Payment Providers

    Configure Stripe or PayPal for payment processing

    Shipping Providers

    Set up Shippo or ShipEngine for shipping

    File Storage

    Configure S3-compatible storage

    Email Service

    Set up SMTP for transactional emails

    Post-Installation

    After installation, complete these steps:
    1
    Create Admin User
    2
    Visit /dashboard/init and create your first admin user.
    3
    Run Onboarding
    4
    Complete the onboarding wizard to set up:
    5
  • Store details and branding
  • Default region and currency
  • Payment providers
  • Sample data (optional)
  • 6
    Configure Integrations
    7
    Go to Settings in the dashboard to configure:
    8
  • Payment providers (Stripe, PayPal)
  • Shipping providers (Shippo, manual)
  • Email templates
  • Tax rates
  • 9
    Test Your Store
    10
    Create a test product and place a test order to verify everything works.

    Troubleshooting

    If you encounter migration errors during build:
    # Reset database (WARNING: deletes all data)
    npx prisma migrate reset
    
    # Or manually run migrations
    npm run migrate
    
    Change the port in your environment:
    PORT=3001 npm run dev
    
    Check your database is running and connection string is correct:
    # Test connection
    psql "$DATABASE_URL"
    
    Increase Node.js memory limit:
    NODE_OPTIONS="--max-old-space-size=4096" npm run build
    
    Configure S3-compatible storage in your environment variables. See Environment Variables for S3 configuration.

    Next Steps

    Configure Environment

    Set up payment providers, shipping, and integrations

    API Reference

    Explore the GraphQL API

    Customize Storefront

    Tailor the look and feel of your store

    Platform Docs

    Deep dive into Openfront’s architecture

    Build docs developers (and LLMs) love