Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ¦‚ Scorpion OS

Central Operations Orchestrator - Your personal AI stack dashboard for managing operations, workflows, and side hustles.

Note: This workspace contains Scorpion (central orchestrator), LightningFlow (side hustle), and supporting development tools.

πŸš€ Quick Start

Local Development (macOS)

# One-command setup
./scripts/setup-all.sh

# Access your services
open http://lightningflow.local
open http://app.lightningflow.local
open http://n8n.local

Production Deployment (VPS)

# Upload to VPS and run
./scripts/setup-all.sh

# Fix 502 issues
./scripts/fix-502.sh

# Health check
./scripts/health-check.sh

πŸ—οΈ Architecture

Central System

  • πŸ¦‚ Scorpion (scorpion.local / port 3003) - Main operations console and orchestrator
    • Operations monitoring
    • Workflow builder
    • Knowledge base
    • Multi-agent council
    • Agent management
    • Chat interface

Side Hustles

  • πŸ’° LightningFlow - Lightning Network SaaS platform
    • Landing (lightningflow.local / port 3000) - Public marketing site
    • Web (app.lightningflow.local / port 3001) - Customer dashboard
    • Ops (ops.lightningflow.local / port 3002) - Internal admin panel

Supporting Tools

  • πŸ”§ Lovable Frontend - n8n workflows testing dashboard
  • πŸ”§ n8n-cursor - n8n development tools and scripts

Services

  • API - Express.js backend with BullMQ workers
  • n8n - Workflow automation engine
  • Redis - Job queue and caching
  • Caddy - Reverse proxy and SSL termination

πŸ› οΈ Development

Local Development Stack

# Start all services
docker compose -f infra/docker/docker-compose.dev.yml up -d

# Check health
./scripts/health-check.sh

# View logs
docker compose -f infra/docker/docker-compose.dev.yml logs -f

Environment Variables

# Copy template
cp env.dev.example .env.dev

# Edit with your values
nano .env.dev

Required values:

  • NEXT_PUBLIC_SUPABASE_URL - Your Supabase project URL
  • NEXT_PUBLIC_SUPABASE_ANON_KEY - Your Supabase anon key
  • SUPABASE_SERVICE_ROLE - Your Supabase service role key
  • LNBITS_API_KEY - Your LNbits dev wallet key

πŸš€ Production

VPS Deployment

# Deploy production stack
docker compose -f infra/docker/docker-compose.prod.yml up -d

# Configure Caddy
sudo cp infra/caddy/Caddyfile.prod /etc/caddy/Caddyfile
sudo systemctl reload caddy

# Health check
./scripts/smoke.sh

Blue/Green Deployment

# Deploy to GREEN
./scripts/flip_green.sh

# Rollback to BLUE
./scripts/flip_blue.sh

πŸ”§ Troubleshooting

502 Bad Gateway

# Diagnose the issue
./scripts/diagnose-502.sh

# Auto-fix common issues
./scripts/fix-502.sh

Common Issues

  1. Services not running - Check docker ps
  2. Caddy misconfigured - Check /etc/caddy/Caddyfile
  3. Port conflicts - Check ss -Hlnpt | grep -E ':80|:443|:3000|:3001|:3002|:4000|:5678'
  4. Cloudflare SSL mode - Set to "Full (strict)"

πŸ“ Project Structure

n8n-cursor/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ landing/          # Public marketing site
β”‚   β”œβ”€β”€ lightningflow/web/ # Customer dashboard
β”‚   β”œβ”€β”€ ops/              # Internal admin panel
β”‚   └── n8n-cursor/backend/ # API and workers
β”œβ”€β”€ infra/
β”‚   β”œβ”€β”€ docker/           # Docker Compose files
β”‚   └── caddy/            # Caddy configurations
β”œβ”€β”€ scripts/              # Deployment and utility scripts
└── packages/             # Shared packages

πŸ”’ Security Features

  • Idempotency - All POST requests are idempotent
  • Rate Limiting - Per-IP and per-tenant limits
  • HMAC Signatures - Webhook validation
  • RLS Policies - Row-level security in Supabase
  • Security Headers - CSP, HSTS, XSS protection
  • Secrets Management - Environment-based configuration

πŸ“Š Monitoring

Health Endpoints

  • http://lightningflow.local/healthz
  • http://api.lightningflow.local/healthz
  • http://n8n.local/healthz

Logs

  • Dozzle: http://logs.local
  • Caddy: sudo journalctl -u caddy -f
  • Docker: docker compose logs -f

πŸš€ CI/CD

GitHub Actions

  • Guards - Prevent env file changes, enforce API contracts
  • Deploy - Blue/green deployment with health gates
  • Security - Trivy vulnerability scanning

Deployment Flow

  1. Integration - Auto-deploy on int branch
  2. Staging - Manual deploy on staging branch
  3. Production - Blue/green deploy on main branch

πŸ“š Documentation

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and linting
  5. Submit a pull request

πŸ“„ License

MIT License - see LICENSE for details.

πŸ†˜ Support


Built with ❀️ for the Lightning Network community

About

Hive monorepo: evenslouis.ca path map, portfolio, Scorpion, n8n tooling. Not Client Engine or Outer Heaven.

Topics

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages