Open reference architecture for an AI-native internal platform — Company-as-a-Service.
⚠️ This is a concept / reference architecture, not a deployed product. No live demo, no hosted service. The repository contains source code and conventions you can study, fork, or run locally with Docker. All names, domains, customer references, and financial figures are anonymized placeholders.
A blueprint for building an AI-native operations platform: a corporate "operating system" where governance, finance, sales, HR, projects, knowledge and AI agents all live in one place — with role-based access, semantic memory, and write-tool confirmations.
Most internal tools are stitched together: Notion + Slack + Jira + Google Sheets + email + a custom dashboard nobody updates. Knowledge is fragmented, AI assistants don't know your business, and governance happens in chat threads.
CaaS Concept demonstrates a different approach:
- One platform, role-based. Every screen, widget, and AI agent is gated by user role. The CFO sees budget; the BU lead sees their team's pipeline; the secretary sees decisions to ratify.
- AI agents that know your business. L2 agents (per role) wired to live database tools — get_tasks, get_budget, create_meeting, update_deal — with explicit user confirmation before any write.
- Semantic memory. Every chat insight is auto-embedded and consolidated daily. Knowledge base and CRM entities are auto-indexed for RAG retrieval.
- Governance built in. Boards, sessions, decisions, KPIs, audit trail, IP allowlist, 2FA — not bolted on.
| Layer | Technology |
|---|---|
| Frontend | React 19 · TypeScript · Vite · Tailwind 4 · Zustand · TanStack Query · Recharts · React Flow |
| Backend | Python 3.12 · FastAPI · SQLAlchemy 2.0 (async) · Alembic |
| Database | PostgreSQL 17 + pgvector (HNSW indexes) |
| AI | LangGraph (ReAct agents) · langchain-openai · custom L1/L2/L3 hierarchy |
| Cache / Queue | Redis 7 · Celery (beat scheduler + workers) |
| Storage | MinIO (S3-compatible) |
| Auth | Google OAuth · JWT (jose + bcrypt) · TOTP 2FA · IP allowlist |
| Monitoring | Prometheus · Grafana (auto-provisioned dashboard) |
| DevOps | Docker Compose · Nginx · Let's Encrypt · GitHub Actions |
┌─────────────────────────────────────────────────────────────────────┐
│ Browser │
│ React 19 SPA · 20+ modules · role-gated dashboard · AI Assistant │
└───────────────────────────┬─────────────────────────────────────────┘
│ HTTPS (nginx + TLS)
┌───────────────────────────┴─────────────────────────────────────────┐
│ FastAPI │
│ ├─ /api/auth (OAuth, JWT, 2FA) │
│ ├─ /api/{governance,finance,crm,hr,kpi,pmo,...} │
│ ├─ /api/agents (chat + tool calls + write confirmations) │
│ ├─ /api/notifications (SSE push + Telegram/MAX bots) │
│ └─ /api/admin (RBAC, audit, integrations, metrics) │
└─┬─────────────────────────────────────────────────────────┬─────────┘
│ │
┌─┴──────────┐ ┌──────────────────┐ ┌─────────────┐ ┌────┴──────┐
│ PostgreSQL │ │ LangGraph │ │ Celery │ │ Redis │
│ + vector │ │ L2 agents (12) │ │ workers + │ │ pub/sub + │
│ + HNSW │ │ L3 skills (10) │ │ beat tasks │ │ cache │
└────────────┘ └──────────────────┘ └─────────────┘ └───────────┘
Each is a full-stack vertical with backend router, models, frontend page(s), and role-based access:
- Governance — bodies (board / executive committee / GA), sessions, decisions, annual plan, agenda items, materials
- Finance — budget items, P&L, OPEX/CAPEX/cashflow, financial model, payment calendar, plan-fact variance
- Contract Finance — billing, charge rates, P&L per contract, resource plan
- CRM — deals (kanban), contacts, partners pipeline, pipeline analytics
- Tasks — kanban with priority/status, comments, assignee, deadline tracking
- Meetings — CRUD with prep forms, protocol, decisions, exec-weekly with plan-fact tracking
- Processes — workflow engine with React Flow visual designer + LangGraph-style execution
- PMO — workload (swimlanes), resource allocation, assignments with deliverables, timesheets, employee/charge rates
- HR — departments, org chart, manager graph, roles, employees with bulk import/export
- KPI — full lifecycle (plan → mid-year → year-end) with audit log
- Knowledge — articles + fulltext + RAG semantic + AI summarization
- AI Agents — 12 L2 agents with chat UI, tool call bubbles, write confirmations, semantic memory
- Smart Digest — daily/weekly AI summary from real platform data
- Notifications — SSE push + toasts + Telegram/MAX bot integration + per-event channel triggers
- Admin — 11 tabs: dashboard, users, approvals, audit, settings, RBAC, security, notifications, integrations, metrics, superadmin
- About — architecture overview, ERD, AI tools catalog
Three-tier hierarchy:
L1 Orchestrators ← meta-agents that route to L2
│
L2 Functional Agents ← per-role: ceo, cfo, sales, hr, pmo, ...
│ LangGraph ReAct + role-mapped tools
│
L3 Skills ← reusable capabilities:
financial_modeler, document_composer,
legal_checker, research, data_analyst,
meeting_prep, competitive_intel, etc.
Write-tool confirmations. When an agent decides to create a task, update a deal, or send a notification, it pauses with interrupt() and waits for user approval. The UI renders ✅ Подтвердить / ❌ Отменить buttons. Same flow works in Telegram and MAX bots.
Semantic memory. Every meaningful chat exchange is auto-embedded into pgvector and retrieved on next conversation. Daily Celery task consolidates similar memories.
RAG. Knowledge base articles, CRM deals, budget items, and tasks are auto-indexed into knowledge_chunks (vector(1536) + HNSW). Cosine similarity search powers search_knowledge tool.
- Docker & Docker Compose
- (optional) Node 20+ and Python 3.12 for local dev
git clone https://github.com/YOUR_USERNAME/caas-concept.git
cd caas-concept
# Copy env template and fill in
cp .env.example .env
# Edit .env: set SECRET_KEY, optionally GOOGLE_CLIENT_ID, LLM_API_KEY, etc.
# Start everything
docker compose -f docker/docker-compose.yml up -d
# Apply migrations
docker exec caas-backend alembic upgrade head
# Seed demo data
docker exec caas-backend python -m app.seedOpen http://localhost:5173. Demo login: admin@example.com / demo-password-change-me (change in backend/app/seed.py).
# Backend
cd backend
pip install -r requirements.txt
uvicorn app.main:app --reload --port 8000
# Frontend (in another terminal)
cd frontend
npm install
npm run dev# Frontend type check + build
cd frontend && npm run build
# Backend lint + tests
cd backend && python -m ruff check . && python -m pytest -vcaas-concept/
├── backend/
│ ├── app/
│ │ ├── routers/ # FastAPI endpoints per module
│ │ ├── models/ # SQLAlchemy ORM
│ │ ├── schemas/ # Pydantic v2 schemas
│ │ ├── services/ # Business logic, integrations
│ │ ├── agents/ # LangGraph agents + tools + memory
│ │ ├── middleware/ # RBAC, IP allowlist, audit
│ │ └── seed.py # Demo data
│ ├── alembic/versions/ # DB migrations (idempotent)
│ └── tests/
├── frontend/
│ ├── src/
│ │ ├── pages/ # Page components per module
│ │ ├── components/ # Layout, ui, dashboard widgets
│ │ ├── stores/ # Zustand stores
│ │ ├── services/ # API client (axios + auth)
│ │ └── hooks/
│ └── e2e/ # Playwright tests
├── docker/
│ ├── docker-compose.yml
│ ├── Dockerfile.{backend,frontend}
│ └── nginx/conf.d/
├── database/
│ ├── schema.sql # Full schema snapshot (source of truth)
│ └── migrations/ # Legacy SQL migrations (pre-Alembic)
└── docs/
└── MODULES.md # Module-by-module functional description
- ✅ Core modules (governance, finance, CRM, tasks, meetings, HR, KPI, PMO, knowledge)
- ✅ AI agents L2/L3 with write confirmations
- ✅ Semantic memory + RAG
- ✅ Telegram + MAX bot integrations with dual-push notifications
- ✅ Admin panel: 11 tabs (RBAC, audit, IP allowlist, integrations, metrics)
- ✅ Process designer (React Flow + execution engine)
- ⏳ Email channel (SMTP)
- ⏳ Mobile-first PWA shell
- ⏳ E2E test coverage expansion
Issues and PRs welcome. The project follows the conventions in CLAUDE.md — read it first if you're contributing.
MIT — use this however you like, including commercially. Attribution appreciated but not required.
This snapshot is anonymized from a production internal platform. All names, domains, financial figures, and customer references are placeholders. The architecture, conventions, and code patterns are real and battle-tested.
If this project is useful to you, leave a ⭐ — it helps others find it.