OMNI-1 Project Management Solution

Setup Installation Guide

AWS Production Deployment

Publish the application on the internet (~1–3 hours)

After local setup works, deploy to AWS so your team can access the app on the internet. You need: a domain name (optional for testing), PostgreSQL (Supabase recommended), and an AWS account.

11. Pre-Deployment Checklist

11.1 Deployment checklist

  • Local setup completed (Part 1) - you can sign in at localhost.
  • Production PostgreSQL database ready (Supabase or AWS RDS).
  • Domain name pointed to your host (for HTTPS).
  • LICENSE.txt purchase code validated on the production server.
  • .env values prepared for production (see table below).

11.2 Production environment variables

Set these in AWS Amplify Console or in .env on EC2 (never commit .env to Git):

VariableProduction example
BETTER_AUTH_URLhttps://app.yourdomain.com
NEXT_PUBLIC_APP_URLhttps://app.yourdomain.com
NEXT_PUBLIC_BASE_URLhttps://app.yourdomain.com
DATABASE_URLSupabase pooler URL (port 6543)
DIRECT_DATABASE_URLSupabase direct URL (port 5432)
BETTER_AUTH_SECRETLong random secret (32+ characters)
AWS S3 / email keysAs configured in App Settings
AWS Amplify environment variables configuration
Example: production environment variables in Amplify (set HTTPS URLs and database keys).

11.3 Choose a hosting option

OptionBest forDifficulty
AWS AmplifyFastest deploy, managed CI/CD, auto SSLEasier
AWS EC2Full server control, custom nginx/PM2Moderate

12. Deploy with AWS Amplify

AWS Amplify hosts Next.js apps with automatic builds from GitHub, GitLab, or Bitbucket.

12.1 Prerequisites

  • AWS account - https://aws.amazon.com
  • Code in a Git repository (GitHub recommended).
  • Node.js 20 supported (Amplify selects runtime automatically).

12.2 Connect repository

  1. Open AWS Console → search Amplify → Hosting → Get started.
  2. Choose Host web app → GitHub (or your provider) → Authorize AWS.
  3. Select your repository and branch (e.g. main).
  4. App name: e.g. project-management-Solution.
AWS Amplify create app - choose GitHub source
Amplify - choose your Git provider and authorize AWS.
AWS Amplify add repository and monorepo root apps/web
Select repository and branch; enable monorepo and set root to apps/web.

12.3 Configure build settings (monorepo)

Use these settings for this project (pnpm monorepo):

SettingValue
App root/ (repository root)
Build commandpnpm install && pnpm build
Start command / outputAmplify detects Next.js - use default SSR
Node.js version20.x
Package managerpnpm

Optional: add amplify.yml in repository root:

amplify.yml
version: 1
applications:
  - frontend:
      phases:
        preBuild:
          commands:
            - npm install -g pnpm
            - pnpm install
        build:
          commands:
            - pnpm build
      artifacts:
        baseDirectory: apps/web/.next
        files:
          - '**/*'
      cache:
        paths:
          - node_modules/**/*
          - .pnpm-store/**/*

12.4 Environment variables in Amplify

AWS Amplify app settings environment variables
Add every production .env key under App settings → Environment variables.
  1. Amplify app → Environment variables → Manage variables.
  2. Add every key from your production .env (Section 11.2).
  3. Save and redeploy.

12.5 Custom domain and SSL

  1. Amplify app → Hosting → Custom domains → Add domain.
  2. Follow DNS instructions (CNAME records at your registrar).
  3. Amplify provisions free SSL (HTTPS) automatically.
  4. Update BETTER_AUTH_URL and NEXT_PUBLIC_* to https://yourdomain.com.

12.6 Run the installation wizard in production

  1. Open https://yourdomain.com/install (first visit only).
  2. Complete wizard: license, database, admin account.
  3. Sign in at https://yourdomain.com/sign-in.

Verification: Site loads over HTTPS, admin login works, browser tab shows your favicon and site title.

12.7 Amplify troubleshooting

ProblemSolution
Build failsCheck Node 20, pnpm install logs; set SKIP_ENV_VALIDATION=1 only if needed for build
502 / app errorVerify env vars; check Amplify runtime logs
Database errorAllow Amplify outbound IP in Supabase; correct DATABASE_URL
Auth redirect loopBETTER_AUTH_URL must match exact HTTPS domain

13. Deploy on AWS EC2

EC2 gives you a Linux server. You install Node.js, build the app, and run it with PM2 behind nginx.

13.1 Create EC2 instance

  1. AWS Console → EC2 → Launch instance.
  2. Name: project-management-server.
  3. AMI: Ubuntu Server 22.04 LTS (64-bit).
  4. Instance type: t3.small minimum (t3.medium recommended).
  5. Create or select a key pair (.pem) for SSH.
  6. Security group: allow SSH (22), HTTP (80), HTTPS (443).
  7. Storage: 30 GB+.
  8. Launch instance.
AWS EC2 Launch instance configuration screen
EC2 launch settings - Ubuntu 22.04, t3.small+, security group with ports 22/80/443.

13.2 Connect to server

From your computer (replace with your key and IP):

SSH
ssh -i "your-key.pem" ubuntu@YOUR_EC2_PUBLIC_IP

Windows: Use PowerShell or PuTTY. On first connect, type yes to trust the host.

13.3 Install Node.js and pnpm on EC2

  1. Update packages: sudo apt update && sudo apt upgrade -y
  2. Install Node 20: curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt install -y nodejs
  3. Verify: node -v (must show v20+)
  4. Install pnpm: sudo npm install -g pnpm
  5. Verify: pnpm -v
  6. Install PM2: sudo npm install -g pm2
  7. Install nginx: sudo apt install -y nginx

13.4 Upload project to EC2

Choose one method:

  • Git clone: sudo apt install -y git → git clone YOUR_REPO_URL → cd project folder
  • SFTP: Upload ZIP with FileZilla/WinSCP to /home/ubuntu/ and unzip
  • Place project in e.g. /home/ubuntu/project-management-theme-forest
  • Create .env in project root with production values (Section 11.2).

13.5 Build and database on EC2

  1. cd /home/ubuntu/project-management-theme-forest
  2. pnpm install
  3. pnpm exec dotenv -e .env -- pnpm db:push (sync database schema)
  4. pnpm build

Expected: Build completes without errors. If env validation fails, fix .env before build.

13.6 Run app with PM2

PM2
cd /home/ubuntu/project-management-theme-forest
pm2 start "pnpm start" --name lottae-app
pm2 save
pm2 startup

App runs on port 3000 internally. Verify: curl http://localhost:3000

13.7 Configure NGINX reverse proxy

Create nginx site config: sudo nano /etc/nginx/sites-available/lottae

nginx config
server {
  listen 80;
  server_name app.yourdomain.com;
  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_cache_bypass $http_upgrade;
  }
}
  1. Enable site: sudo ln -s /etc/nginx/sites-available/lottae /etc/nginx/sites-enabled/
  2. Test: sudo nginx -t
  3. Reload: sudo systemctl reload nginx

13.8 Enable HTTPS with Let's Encrypt

  1. Point domain A record to EC2 public IP.
  2. sudo apt install -y certbot python3-certbot-nginx
  3. sudo certbot --nginx -d app.yourdomain.com
  4. Follow prompts; certbot configures HTTPS automatically.

13.9 Run the installation wizard in production

  1. Open https://app.yourdomain.com/install
  2. Complete license, database, and admin steps.
  3. Sign in and test file uploads and email if configured.

13.10 EC2 troubleshooting

ProblemSolution
Cannot SSHCheck security group port 22; correct .pem permissions (chmod 400)
Site not loadingpm2 status; nginx -t; sudo ufw allow 80,443 if firewall enabled
502 Bad GatewayEnsure pnpm start is running on port 3000
Out of memory on buildUse larger instance or add swap space

14. Post-Deployment Checklist

  • HTTPS works (padlock in browser).
  • https://yourdomain.com/sign-in - admin login works.
  • Install wizard completed; .install.lock exists on server.
  • Site title and favicon show in browser tab.
  • Database backups scheduled (Supabase or RDS).
  • PM2 or Amplify monitoring enabled.

15. Update Production

  1. Amplify: push to Git - Amplify rebuilds automatically.
  2. EC2: git pull (or upload new files) → pnpm install → pnpm build → pm2 restart lottae-app
  3. Always backup database before major updates.

16. Quick Reference (Production)

TaskAmplifyEC2
DeployGit push → auto buildgit pull + pnpm build + pm2 restart
Env varsAmplify Console.env file on server
LogsAmplify build/runtime logspm2 logs lottae-app
SSLAmplify custom domaincertbot --nginx

End of Setup Guide