Command Sovereignty

Command Sovereignty

B2B revenue forecasting SaaS for home improvement companies.

Stack

  • Backend: Flask + SQLAlchemy + SQLite
  • Frontend: React + Vite + TypeScript
  • Port: 5003
  • Service: systemctl --user command-sovereignty.service (Gunicorn)
  • Domain: builtdomains.com via Cloudflare Tunnel

Status

Active — Live on buildomains.com, Phase 4 complete (pagination, detail pages).

Key Files

What Path Notes
SQLite DB instance/auth.db NOT auth.db at root
Env config ~/.config/command-sovereignty/env DATABASE_URL pinned
Backups backups/auth_YYYYMMDD_HHMMSS.db.gz Cron every 6h
Venv .venv/ Python 3.11, Flask + SQLAlchemy
Frontend frontend/ Vite 8 / React / TypeScript
Logs logs/app.log Rotating file logger

Database Rules

  1. NEVER run db.create_all() without verifying instance/auth.db has data
  2. NEVER run db.drop_all() — no migration system to recover
  3. Check: sqlite3 instance/auth.db "SELECT count(*) FROM profiles;"
  4. Auth model: User table = profiles in SQLite

Common Pitfalls

  • Two DB files trap: Old auth.db at project root was deleted July 2026
  • SESSION_COOKIE_SECURE=true — cookies only work on HTTPS via Cloudflare
  • Vite build quirk: Use node node_modules/vite/bin/vite.js build instead of npx vite build
  • Login is cookie-based (Flask-Login sessions), NOT JWT tokens
  • SyncLog bug — unfixed

Service Commands

systemctl --user restart command-sovereignty.service
tail -50 logs/app.log
bash scripts/backup_db.sh