Installation Guide
You can run Sitepins using two primary deployment methods:
- Docker Compose (Recommended for self-hosters): Spins up MongoDB 7, the Express API, and the Next.js web application with a single command.
- Manual pnpm setup: Ideal for local development, bare-metal servers, or custom orchestrators.
Method 1: Docker Compose
Sitepins includes a production-ready docker-compose.yml file in the root of the repository.
1. Clone the repository
git clone https://github.com/sitepins/sitepins.git
cd sitepins2. Prepare environment files
Copy the template environment configuration files:
cp api/.env.example api/.env
cp app/.env.example app/.envGenerate your secrets (see Generating Secrets below) and populate your .env files.
3. Launch the stack
docker compose up --build -dThis starts three orchestrated containers:
mongo: MongoDB 7 with persistent volume storage (mongo-data) and a configuredmongoshping healthcheck.api: The Express backend listening onhttp://localhost:4000. Starts automatically once MongoDB reports healthy.web: The Next.js web application listening onhttp://localhost:3000.
To view container logs in real time:
docker compose logs -fTo stop the stack:
docker compose downMethod 2: Manual Setup with pnpm
Prerequisites
Ensure your host environment has:
- Node.js:
v22.0.0or newer (node -v) - pnpm:
v11.0.0or newer (pnpm -v) - MongoDB: A running MongoDB instance locally or on MongoDB Atlas (
mongodb://localhost:27017/sitepins).
1. Clone and Install Dependencies
git clone https://github.com/sitepins/sitepins.git
cd sitepins
pnpm install2. Configure Environment Files
cp api/.env.example api/.env
cp app/.env.example app/.envEdit api/.env and app/.env using the generated secrets and provider credentials described below.
3. Start in Development Mode
Run both the app and the API concurrently:
pnpm devOr run them in separate terminals:
# Terminal 1: Express API (Port 4000)
pnpm dev:api
# Terminal 2: Next.js Web App (Port 3000)
pnpm dev:app4. Build and Run in Production
To build optimized production bundles:
# 1. Build backend TypeScript into api/dist
pnpm build:api
# 2. Build Next.js frontend into app/.next
pnpm build:appStart the production servers:
# Start API
cd api && node dist/server.js
# Start Web App
cd app && pnpm startGenerating Secrets
Several required environment variables are high-entropy cryptographic keys. Generate them using standard terminal tools:
Better Auth Secret
Used to sign and verify user session cookies:
openssl rand -base64 32Paste this value into BETTER_AUTH_SECRET in api/.env.
Token & Encryption Secrets
Generate three 64-character hexadecimal keys:
# 1. For JWT_SECRET (internal action tokens)
openssl rand -hex 32
# 2. For SANDBOX_ENCRYPTION_KEY (AES-256-GCM sandbox token encryption)
openssl rand -hex 32
# 3. For INTERNAL_API_SECRET (server-to-server authentication)
openssl rand -hex 32Crucial Configuration Rule:
INTERNAL_API_SECRET must be byte-for-byte identical in both api/.env and app/.env. If these keys do not match, frontend requests to internal API preview and validation routes will fail with 401 Unauthorized.
Essential Configuration Checklist
Before booting your instance, ensure the following core variables are configured:
api/.env
BASE_URL: Public API URL (e.g.http://localhost:4000orhttps://api.example.com).MONGO_URI: MongoDB connection string (mongodb://localhost:27017/sitepins).BETTER_AUTH_SECRET: The base64 secret generated above.JWT_SECRET: The hex token secret generated above.SANDBOX_ENCRYPTION_KEY: The hex encryption key generated above.INTERNAL_API_SECRET: Shared secret withapp/.env.S3_*: Object storage bucket credentials (see Media Storage).GITHUB_CLIENT_ID&GITHUB_CLIENT_SECRET: GitHub OAuth app for user login (see Git Apps).
app/.env
NEXT_PUBLIC_BACKEND_URL: The API URL (http://localhost:4000orhttps://api.example.com).NEXT_PUBLIC_HP_WS_URL: WebSocket URL (ws://localhost:4000/api/v1/editor/collabin dev,wss://api.example.com/api/v1/editor/collabin prod).NEXT_PUBLIC_BUCKET_URL: Public base URL of your S3 bucket.INTERNAL_API_SECRET: Identical toapi/.env.GITHUB_APP_*: GitHub App credentials for repository reading and writing (see Git Apps).
For the full catalog of optional variables (branding, mail, AI, CORS, and proxy settings), see Environment Variables.
Health Check Verification
Test whether the backend API is alive and reachable:
curl http://localhost:4000/healthzExpected response:
{
"status": "ok",
"uptime": 42.15
}You can point Docker, Kubernetes, or load balancer liveness probes directly to /healthz.
Zero-Config Email & First Sign-up
Sitepins includes a provider-agnostic mail system:
- Console Mailer (Default): When no SMTP server is configured, all verification codes, OTPs, and password reset links are printed directly to the API terminal stdout.
- This means sign-up works immediately without setting up an email service.
- When registering your first account at
http://localhost:3000/sign-up, check your API terminal logs to find your 6-digit OTP verification code.
- SMTP Relay: When ready for production email delivery, configure
SMTP_HOST,SMTP_PORT,SMTP_USER, andSMTP_PASSinapi/.env. - Bypass Verification: To disable email verification altogether for local development or closed intranets, set
REQUIRE_EMAIL_VERIFICATION=falseinapi/.env.
Next Steps
- Configure your Environment Variables
- Set up your GitHub & GitLab Apps
- Connect Media Storage
- Configure Reverse Proxy & SSL