Deployment
Deploy Ziyarn to Vercel, self-host, or use Docker.
Deploy Ziyarn to the cloud or run it on your own infrastructure.
Vercel (Recommended)
The easiest way to deploy Ziyarn.
Prerequisites
- Vercel account
- GitHub repository
- Neon or other PostgreSQL database
Steps
- Fork the repository
- Import to Vercel
- Configure environment variables
- Deploy
Environment Variables
DATABASE_URL=postgresql://...
BETTER_AUTH_SECRET=your-secret
BETTER_AUTH_URL=https://your-domain.com
NEXT_PUBLIC_BETTER_AUTH_URL=https://your-domain.com
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...Custom Domain
- Go to Vercel project settings
- Add your domain
- Configure DNS
- SSL is automatic
Self-Hosted
Run Ziyarn on your own server.
Prerequisites
- Node.js 20+
- PostgreSQL database
- pnpm package manager
Steps
# Clone the repository
git clone https://github.com/your-org/ziyarn.git
cd ziyarn
# Install dependencies
pnpm install
# Build the application
pnpm build
# Start the server
pnpm startProcess Manager
Use PM2 for production:
npm install -g pm2
pm2 start pnpm --name ziyarn -- start
pm2 save
pm2 startupNginx Reverse Proxy
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;
}
}Docker
Run Ziyarn in containers.
Dockerfile
FROM node:20-alpine AS base
RUN apk add --no-cache libc6-compat
WORKDIR /app
FROM base AS deps
COPY package.json pnpm-lock.yaml ./
RUN corepack enable pnpm && pnpm install --frozen-lockfile
FROM base AS builder
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN corepack enable pnpm && pnpm build
FROM base AS runner
WORKDIR /app
ENV NODE_ENV production
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
EXPOSE 3000
CMD ["node", "server.js"]Docker Compose
version: "3.8"
services:
ziyarn:
build: .
ports:
- "3000:3000"
environment:
- DATABASE_URL=postgresql://postgres:password@db:5432/ziyarn
- BETTER_AUTH_SECRET=your-secret
- BETTER_AUTH_URL=http://localhost:3000
depends_on:
- db
db:
image: postgres:16
environment:
- POSTGRES_DB=ziyarn
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=password
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
postgres_data:Running
docker-compose up -dEnvironment Variables
Required
| Variable | Description |
|---|---|
DATABASE_URL | PostgreSQL connection string |
BETTER_AUTH_SECRET | Auth secret key |
BETTER_AUTH_URL | Application URL |
NEXT_PUBLIC_BETTER_AUTH_URL | Public application URL |
BASE_APP_URL | Public URL used in invite links and emails |
Optional
| Variable | Description |
|---|---|
GOOGLE_CLIENT_ID | Google OAuth client ID |
GOOGLE_CLIENT_SECRET | Google OAuth client secret |
LINKEDIN_CLIENT_ID | LinkedIn OAuth client ID |
LINKEDIN_CLIENT_SECRET | LinkedIn OAuth client secret |
GEMINI_API_KEY | Gemini API key for the platform AI model and embeddings |
AI_KEY_ENCRYPTION_SECRET | Encrypts owner-supplied AI provider keys. Required for AI Provider; keep it stable once keys are saved |
OPENROUTER_API_KEY | OpenRouter fallback key, used when Gemini is unavailable |
AI_MODEL | Model used for chat |
EMBEDDING_MODEL | Model used for embeddings |
EMBEDDING_DIMENSIONS | Embedding size (1536) |
PAYSTACK_SECRET_KEY | Paystack secret key (payments and webhook signatures) |
PAYSTACK_PUBLIC_KEY | Paystack public key (checkout) |
PAYSTACK_CURRENCY | Currency charges are made in (default GHS) |
PAYSTACK_PRICE_STANDARD | Override the Plus price, in kobo |
PAYSTACK_PRICE_PRO | Override the Business price, in kobo |
PAYSTACK_PRICE_ULTIMATE | Override the Enterprise price, in kobo |
STRIPE_SECRET_KEY | Stripe secret key, if Stripe is enabled |
STRIPE_WEBHOOK_SECRET | Stripe webhook signature secret |
SMTP_HOST | SMTP server for transactional email and campaigns |
SMTP_PORT | SMTP port |
SMTP_USER | SMTP username |
SMTP_PASS | SMTP password |
SMTP_FROM | Sender address |
BLOB_READ_WRITE_TOKEN | Blob storage token for uploaded files |
CRON_SECRET | Secret that guards the scheduled-jobs endpoint |
LOG_LEVEL | Log level for the server |
Database Setup
Neon (Recommended)
- Create a Neon account
- Create a new project
- Copy the connection string
- Run migrations:
pnpm --filter @repo/database exec drizzle-kit migrateSupabase
- Create a Supabase project
- Get the connection string from Settings → Database
- Run migrations
Self-Hosted PostgreSQL
# Create database
createdb ziyarn
# Run migrations
DATABASE_URL=postgresql://localhost:5432/ziyarn pnpm --filter @repo/database exec drizzle-kit migrateSSL/TLS
Let's Encrypt
Use Certbot for free SSL:
sudo certbot --nginx -d your-domain.comCloudflare
- Add domain to Cloudflare
- Enable proxy
- SSL is automatic
Monitoring
Health Check
GET /api/healthLogs
Vercel: Dashboard → Logs Self-hosted: Check PM2 or Docker logs
Analytics
Built-in analytics in Dashboard → Analytics.
Best Practices
- Use environment variables — Never hardcode secrets
- Enable SSL — Always use HTTPS
- Set up monitoring — Track uptime and errors
- Backup database — Regular automated backups
- Update regularly — Keep dependencies current