Skip to main content

Installation Guide

Complete step-by-step installation instructions for setting up FlowCampaign locally for development or deploying to production.

System Requirements

Minimum Requirements

  • Node.js: 18.x or higher
  • npm: 8.x or higher (or yarn/pnpm)
  • Git: Latest version
  • SQLite: 3.x (for local development)
  • Cloudflare Account (for production deployment)
  • RAM: 8GB or more
  • Storage: 2GB free space
  • CPU: 2+ cores
  • OS: Linux, macOS, or Windows (WSL2 recommended for Windows)

Installation Methods

Method 1: Local Development Setup

Step 1: Clone Repository

git clone https://github.com/ns-software-solutions/flowcampaign.git
cd flowcampaign

Step 2: Install Dependencies

npm install
# or
yarn install
# or
pnpm install

Step 3: Configure Environment

# Copy example environment file
cp .env.example .env

Edit .env file with your configuration:

# App Configuration
NODE_ENV=development
APP_PORT=3000
APP_URL=http://localhost:3000

# Database Configuration
DATABASE_URL=file:./dev.db

# Authentication
JWT_SECRET=your-super-secret-jwt-key-change-this
SESSION_SECRET=your-session-secret-change-this

# Email Providers
ZEPTOMAIL_API_KEY=your-zeptomail-api-key
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password

# File Storage
UPLOAD_DIR=./uploads
MAX_FILE_SIZE=10485760 # 10MB

# Rate Limiting
RATE_LIMIT_WINDOW=15
RATE_LIMIT_MAX=100

Step 4: Initialize Database

# Run database migrations
npm run db:migrate

# Seed initial data (optional)
npm run db:seed

Step 5: Start Development Server

# Frontend (React)
npm run dev:frontend
# Backend (Hono/Cloudflare Workers)
npm run dev:backend

Or start both with:

npm run dev

Step 6: Verify Installation

  1. Open browser to http://localhost:3000
  2. You should see the FlowCampaign login page
  3. Default admin credentials:

Method 2: Docker Setup

Step 1: Install Docker

Ensure Docker and Docker Compose are installed on your system.

Step 2: Clone Repository

git clone https://github.com/ns-software-solutions/flowcampaign.git
cd flowcampaign

Step 3: Configure Docker Environment

# Copy Docker environment file
cp .env.docker.example .env.docker

Edit .env.docker with your settings.

Step 4: Start Docker Containers

docker-compose up -d

Step 5: Access Application

  1. Frontend: http://localhost:3000
  2. Backend API: http://localhost:8787
  3. Database Admin: http://localhost:8080 (if enabled)

Method 3: Production Deployment (Cloudflare Workers)

Prerequisites

  1. Cloudflare Account
  2. Cloudflare Workers enabled
  3. Wrangler CLI installed

Step 1: Install Wrangler CLI

npm install -g wrangler
# or
pnpm add -g wrangler

Step 2: Configure Wrangler

wrangler login

Step 3: Update Production Configuration

Create wrangler.toml or update existing:

name = "flowcampaign"
main = "src/backend/index.ts"
compatibility_date = "2024-01-01"
compatibility_flags = ["nodejs_compat"]

[vars]
NODE_ENV = "production"
DATABASE_URL = "your-turso-database-url"
JWT_SECRET = "your-production-jwt-secret"

[build]
command = "npm run build"

[[d1_databases]]
binding = "DB"
database_name = "flowcampaign-db"
database_id = "your-database-id"

Step 4: Deploy to Cloudflare Workers

# Build project
npm run build

# Deploy
wrangler deploy

Step 5: Configure Domain (Optional)

  1. Go to Cloudflare Dashboard
  2. Navigate to Workers & Pages
  3. Select your worker
  4. Configure custom domain

Database Setup

SQLite (Development)

# Initialize SQLite database
npm run db:init

# Run migrations
npm run db:migrate

# Generate migration (when schema changes)
npm run db:generate

Turso (Production)

# Install Turso CLI
curl -sSfL https://get.tur.so/install.sh | bash

# Create database
turso db create flowcampaign

# Get connection string
turso db show flowcampaign --url

# Create tables
turso db shell flowcampaign < schema.sql

Cloudflare D1 (Alternative)

# Create D1 database
wrangler d1 create flowcampaign

# Apply migrations
wrangler d1 execute flowcampaign --file=migrations/001_initial.sql

Email Provider Configuration

ZeptoMail Setup

  1. Sign up at ZeptoMail
  2. Get API key from dashboard
  3. Verify sending domain
  4. Add API key to environment variables

SMTP Configuration

Common SMTP providers:

Gmail/Google Workspace

SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password

SendGrid

SMTP_HOST=smtp.sendgrid.net
SMTP_PORT=587
SMTP_USER=apikey
SMTP_PASS=your-sendgrid-api-key

AWS SES

SMTP_HOST=email-smtp.us-east-1.amazonaws.com
SMTP_PORT=587
SMTP_USER=your-ses-smtp-username
SMTP_PASS=your-ses-smtp-password

Environment Variables Reference

Required Variables

VariableDescriptionExample
NODE_ENVEnvironment modedevelopment, production
DATABASE_URLDatabase connection stringfile:./dev.db
JWT_SECRETJWT signing secretRandom 32+ character string
APP_URLApplication URLhttp://localhost:3000

Email Configuration

VariableDescriptionExample
ZEPTOMAIL_API_KEYZeptoMail API keyyour-zeptomail-api-key
SMTP_HOSTSMTP server hostsmtp.gmail.com
SMTP_PORTSMTP server port587
SMTP_USERSMTP usernameyour-email@gmail.com
SMTP_PASSSMTP passwordyour-app-password

Optional Configuration

VariableDescriptionDefault
APP_PORTApplication port3000
SESSION_SECRETSession secretRandom string
UPLOAD_DIRFile upload directory./uploads
MAX_FILE_SIZEMaximum file size10485760 (10MB)
RATE_LIMIT_WINDOWRate limit window (minutes)15
RATE_LIMIT_MAXMax requests per window100

Development Scripts

Available npm Scripts

{
"scripts": {
"dev": "concurrently \"npm run dev:frontend\" \"npm run dev:backend\"",
"dev:frontend": "vite",
"dev:backend": "wrangler dev",
"build": "npm run build:frontend && npm run build:backend",
"build:frontend": "vite build",
"build:backend": "wrangler deploy --dry-run",
"db:migrate": "drizzle-kit migrate",
"db:generate": "drizzle-kit generate",
"db:studio": "drizzle-kit studio",
"test": "vitest",
"test:e2e": "playwright test",
"lint": "eslint .",
"format": "prettier --write .",
"deploy": "wrangler deploy"
}
}

Troubleshooting Installation

Common Issues

1. Database Connection Failed

# Check if SQLite is installed
sqlite3 --version

# Check database file permissions
ls -la dev.db

# Reinitialize database
rm dev.db
npm run db:migrate

2. Port Already in Use

# Find process using port 3000
lsof -i :3000

# Kill process
kill -9 <PID>

# Or change port in .env
APP_PORT=3001

3. Missing Dependencies

# Clear node_modules and reinstall
rm -rf node_modules package-lock.json
npm install

4. Wrangler Login Issues

# Clear wrangler configuration
rm -rf ~/.wrangler

# Re-login
wrangler login

5. Build Failures

# Clear build artifacts
rm -rf dist build

# Reinstall dependencies
npm ci

# Rebuild
npm run build

Post-Installation Steps

1. Verify Installation

# Check if server is running
curl http://localhost:3000/health

# Check database connectivity
npm run db:check

2. Create Admin User

# Using API
curl -X POST http://localhost:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "admin@example.com",
"password": "securepassword",
"name": "Admin User",
"role": "admin"
}'

3. Configure Email Provider

  1. Login to admin panel
  2. Go to Settings > Email Providers
  3. Add your email provider
  4. Test sending

4. Set Up Monitoring

# Install monitoring tools
npm install --save-dev @cloudflare/workers-honeycomb-logger

# Configure logging
echo "HONEYCOMB_API_KEY=your-key" >> .env

Production Checklist

Before deploying to production:

  • Change all default passwords
  • Update JWT_SECRET with strong random string
  • Configure SSL/TLS certificates
  • Set up backup strategy for database
  • Configure monitoring and alerting
  • Set up log aggregation
  • Configure rate limiting
  • Test email delivery with multiple providers
  • Verify domain authentication (SPF, DKIM, DMARC)
  • Set up CI/CD pipeline
  • Configure environment-specific variables
  • Test failover between email providers
  • Verify GDPR compliance features
  • Set up user data retention policies

Upgrading

Minor Version Updates

# Pull latest changes
git pull origin main

# Update dependencies
npm update

# Run migrations if needed
npm run db:migrate

# Restart application
npm run build
npm start

Major Version Updates

  1. Check release notes for breaking changes
  2. Backup database
  3. Test upgrade in staging environment
  4. Run migration scripts
  5. Update configuration files
  6. Deploy to production

Uninstallation

Remove Local Installation

# Stop running processes
npm run stop

# Remove database files
rm -f dev.db
rm -rf migrations

# Remove uploads
rm -rf uploads

# Remove node_modules
rm -rf node_modules

# Remove repository
cd ..
rm -rf flowcampaign

Remove Docker Installation

# Stop and remove containers
docker-compose down -v

# Remove images
docker rmi flowcampaign-frontend flowcampaign-backend

# Remove volumes
docker volume prune

Need Help? Check our Troubleshooting Guide or create an issue on GitHub.

FlowCampaign is designed to be easy to install and configure, whether you're setting up for local development or deploying to production.