Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automation & Intelligence Hub

A self-hosted platform for monitoring, automation, and information aggregation. Standalone monorepo with a FastAPI backend + SvelteKit frontend, deployable via Docker Compose.

Stack: FastAPI + SvelteKit 5 + SQLite/Postgres + Docker License: MIT


Quick Start (dev)

git clone https://github.com/<your-user>/automation-hub.git
cd automation-hub
cp backend/.env.example backend/.env  # configure JWT_SECRET_KEY, ANTHROPIC_API_KEY, etc.
./start-dev.sh
# Backend: http://localhost:8001/api/docs
# Frontend: http://localhost:5174/auto

The first start creates the SQLite database and applies the Alembic migrations. To create an initial admin account, follow the instructions printed at backend startup (CLI or bootstrap endpoint).

Quick Start (production via Docker Compose)

cp backend/.env.example .env.production
# Edit .env.production: JWT_SECRET_KEY, ANTHROPIC_API_KEY, etc.
docker compose up -d
# Access: http://localhost:8010

Stack

Layer Technology
Backend FastAPI + Python 3.11 + SQLAlchemy Core async + aiosqlite
Frontend SvelteKit 5 + TypeScript + Tailwind CSS 4
Auth JWT httpOnly cookies + bcrypt
DB SQLite (dev) / PostgreSQL-ready (production)
AI Anthropic Claude API (Sonnet/Haiku)
Migrations Alembic (SQLite batch mode)

Structure

automation-hub/
├── backend/                    # FastAPI :8001
│   ├── alembic/               # Migrations
│   ├── src/app/
│   │   ├── models/            # SQLAlchemy Core models
│   │   ├── schemas/           # Pydantic v2 schemas
│   │   ├── services/          # Business services
│   │   │   ├── ssh_collector  # SSH polling
│   │   │   ├── automation_engine
│   │   │   ├── claude_ai      # Anthropic SDK + Vision
│   │   │   ├── user_service   # Auth + bcrypt
│   │   │   ├── org_service    # Multi-tenant
│   │   │   ├── audit_service  # Audit trail
│   │   │   ├── template_service
│   │   │   └── integrations/  # ntfy, healthchecks, miniflux, github
│   │   ├── api/v1/            # Routers
│   │   ├── core/              # config, auth, permissions, response
│   │   ├── middleware/        # audit auto-logging
│   │   ├── db/                # SQLite async + TenantConnection
│   │   └── main.py
│   ├── pyproject.toml
│   └── .env.example
├── frontend/                   # SvelteKit 5 :5174
│   ├── src/
│   │   ├── routes/
│   │   │   ├── login/
│   │   │   └── auto/          # Pages + IDE Console layout
│   │   └── lib/
│   │       ├── api/           # client + auth
│   │       ├── stores/
│   │       ├── components/    # PermissionGate + auto/*
│   │       └── themes.ts      # Midnight, Nord, Light
│   ├── package.json
│   └── vite.config.ts         # proxy /api -> :8001
├── docker-compose.yml
├── deploy.sh                  # Optional remote deploy script
├── start-dev.sh
└── README.md

Features

Multi-Tenant

  • Organizations with full data isolation
  • A TenantConnection wrapper that transparently injects organization_id
  • X-Organization-Id header to switch organizations

RBAC

  • 3 roles: admin (full access), operator (read + execute), viewer (read-only)
  • Mutating endpoints protected by require_permission()
  • A <PermissionGate> frontend component for conditional rendering
  • Per-organization member management page

Audit Trail

  • Automatic middleware that logs POST/PATCH/DELETE
  • Sanitization (excludes password, token)
  • Frontend page filterable by action, resource, and date

PDF to Workflow

  • PDF import via Claude Vision
  • Automatic extraction of steps, inputs, outputs
  • Preview + save as an executable automation

Dashboard IDE Console

  • 3-column layout: tree panel + main content + bottom panel
  • Collapsible sidebar navigation
  • Background-service monitoring
  • 3 themes: Midnight (dark), Nord, Light

Automation Templates (built-in)

  • Monitoring: health check, watchdog, disk, uptime pinger
  • Communication: email digest, GitHub, Telegram, daily briefing
  • Data: RSS, Miniflux sync, web scraper, database backup
  • AI: email parser, feed summarizer, log anomaly detector
  • DevOps: git monitor, cron auditor
  • Security: SSH login monitor, firewall status, failed-login detector

API

POST   /api/v1/auth/login              # JWT login (httpOnly cookie)
POST   /api/v1/auth/logout
GET    /api/v1/auth/me                  # Profile + organizations
POST   /api/v1/auth/register            # Admin only

GET    /api/v1/auto/dashboard/summary
GET    /api/v1/auto/dashboard/tree
GET    /api/v1/auto/dashboard/sessions

CRUD   /api/v1/auto/projects
CRUD   /api/v1/auto/machines            # + test-ssh, scan
CRUD   /api/v1/auto/jobs                # + run, restart, enable/disable
CRUD   /api/v1/auto/sources             # + poll, enable/disable
CRUD   /api/v1/auto/automations         # + run, enable/disable
CRUD   /api/v1/auto/skills              # + test
CRUD   /api/v1/auto/alerts              # rules + history + acknowledge

GET    /api/v1/auto/automations/templates
POST   /api/v1/auto/automations/from-template/{id}

POST   /api/v1/auto/workflows/import-pdf
POST   /api/v1/auto/workflows/save
GET    /api/v1/auto/workflows

GET    /api/v1/auto/audit
POST   /api/v1/auto/webhooks/{source_id}

Security

  • JWT httpOnly cookies + secure flag in production
  • JWT secret validated at startup (the default is rejected outside dev)
  • RBAC: endpoints protected by granular permissions
  • Registration restricted to admins
  • password_hash never exposed in responses
  • create_subprocess_exec + shlex.split() (no shell injection)
  • SSH known_hosts verification enabled
  • Webhook signature verification (X-Webhook-Secret)
  • Pydantic validation (username regex, password min 8, EmailStr)
  • PDF magic-bytes validation
  • Audit trail with sanitization of sensitive fields
  • Restricted CORS, Swagger disabled in production

Production configuration

# .env.production
ENVIRONMENT=production
JWT_SECRET_KEY=<openssl rand -hex 32>
ANTHROPIC_API_KEY=<your-anthropic-key>

Database

Table Description
users User accounts (bcrypt)
organizations Multi-tenant organizations
organization_members User-org links with role
projects Logical grouping
machines Monitored SSH servers
jobs Cron/systemd/services
sources Data sources (RSS, API, webhook)
feed_items Unified feed with SHA-256 dedup
auto_automations Scheduled automations
automation_results Execution history
execution_history Job history
alert_rules Alert rules
alert_history Alert history
ai_skills Reusable AI prompts
audit_logs Audit log
automation_templates Pre-configured templates

Docker Deployment (production)

# On the target server
git clone https://github.com/<your-user>/automation-hub.git
cd automation-hub
cp backend/.env.example .env.production
# Edit .env.production with the real values
docker compose up -d
docker compose ps

To deploy from a dev machine to a remote host:

DEPLOY_HOST=user@host DEPLOY_DIR=/path/to/automation-hub ./deploy.sh

License

MIT — see LICENSE for details.

About

Self-hosted automation and intelligence hub: multi-tenant FastAPI + SvelteKit dashboard for monitoring, automations, and AI-driven workflows

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages