Installation Guide
Complete guide to setting up StreamVault on your server or local development machine.
System Requirements
| Requirement | Minimum | Recommended |
|---|---|---|
| Node.js | 18.17+ | 20 LTS |
| npm | 9+ | 10+ |
| Database | SQLite 3.x | PostgreSQL 15+ |
| RAM | 512 MB | 2 GB+ |
| Storage | 1 GB | 10 GB+ |
| OS | Ubuntu 20.04 / macOS 12 | Ubuntu 22.04 LTS |
Quick Start
If you just want to get running fast, follow these 5 commands. For a full production setup, read the detailed sections below.
git clone https://github.com/yourusername/streamvault.git
cd streamvault
npm install
cp .env.example .env
npm run devInstallation
1. Clone the repository
Clone StreamVault from GitHub and navigate into the project directory:
git clone https://github.com/yourusername/streamvault.git
cd streamvault2. Install dependencies
Install all Node.js dependencies:
npm installConfiguration
3. Copy environment file
Copy the example environment file and edit it with your values:
cp .env.example .envOpen .env and fill in the required values:
# Required — your database connection string
DATABASE_URL="file:./dev.db"
# or for PostgreSQL:
# DATABASE_URL="postgresql://user:password@localhost:5432/streamvault"
# Required — generate with: openssl rand -base64 32
NEXTAUTH_SECRET="your-random-secret-here"
# Required — your application URL
NEXTAUTH_URL="http://localhost:3000"
NEXT_PUBLIC_APP_URL="http://localhost:3000"
# Optional — Stripe payment integration
STRIPE_SECRET_KEY="sk_live_..."
STRIPE_PUBLISHABLE_KEY="pk_live_..."
# Optional — Email (SMTP)
SMTP_HOST="smtp.gmail.com"
SMTP_PORT="587"
SMTP_USER="[email protected]"
SMTP_PASS="your-app-password"
SMTP_FROM="StreamVault <[email protected]>"Environment Variables Reference
| Variable | Description | Required |
|---|---|---|
DATABASE_URL | PostgreSQL or SQLite connection string | Required |
NEXTAUTH_SECRET | Random 32+ character string for session encryption | Required |
NEXTAUTH_URL | Full URL of your application (e.g. https://example.com) | Required |
STRIPE_SECRET_KEY | Stripe secret key for payment processing | Optional |
STRIPE_PUBLISHABLE_KEY | Stripe publishable key for frontend checkout | Optional |
SMTP_HOST | SMTP server hostname for outbound email | Optional |
SMTP_PORT | SMTP port (typically 587 or 465) | Optional |
SMTP_USER | SMTP authentication username | Optional |
SMTP_PASS | SMTP authentication password | Optional |
SMTP_FROM | From address for outbound emails | Optional |
NEXT_PUBLIC_APP_URL | Public-facing application URL | Required |
ADMIN_EMAIL | Email address for the initial admin account | Optional |
Database Setup
4. Run Prisma migrations
Apply all database migrations and seed initial data:
npx prisma migrate deploy
npx prisma db seedThis creates all tables and populates the database with default plans, admin user, and sample content.
Running the App
Development mode
npm run devThe app will be available at http://localhost:3000
5. Build for production
npm run buildStart production server
npm startProduction Deploy
Using PM2 (recommended)
Install PM2 globally and start StreamVault as a managed process:
npm install -g pm2
pm2 start npm --name streamvault -- start
pm2 save
pm2 startupNginx configuration
Sample Nginx reverse proxy configuration:
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name yourdomain.com www.yourdomain.com;
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}
}Docker
Using Docker Compose
The easiest way to run StreamVault with Docker:
# Pull and start all services
docker compose up -d
# Run migrations inside the container
docker compose exec app npx prisma migrate deploy
docker compose exec app npx prisma db seeddocker-compose.yml
version: '3.8'
services:
app:
build: .
ports:
- "3000:3000"
environment:
- DATABASE_URL=postgresql://postgres:password@db:5432/streamvault
- NEXTAUTH_SECRET=your-secret-here
- NEXTAUTH_URL=http://localhost:3000
depends_on:
- db
db:
image: postgres:15-alpine
environment:
POSTGRES_DB: streamvault
POSTGRES_USER: postgres
POSTGRES_PASSWORD: password
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data:Troubleshooting
Port 3000 already in use
Run `npx kill-port 3000` or specify a different port: `PORT=3001 npm start`
Prisma migration fails
Ensure your DATABASE_URL is correct and the database server is running. For SQLite, confirm the file path is writable.
NEXTAUTH_SECRET is not set
Generate a secret with `openssl rand -base64 32` and add it to your .env file.
npm install fails with ERESOLVE
Try `npm install --legacy-peer-deps` to bypass peer dependency conflicts.
Build error: Module not found
Run `npm install` again to ensure all dependencies are present, then clear `.next` and rebuild.