- Monorepo: NestJS API (Fastify) + React web (antd/ProComponents) + shared packages - PostgreSQL/Prisma (unified resources, relations graph, audit, events, jobs) - Auth/RBAC/workspace isolation, credential vault (AES-256-GCM) - Servers/SSH, Docker discovery & lifecycle, Job Center - Websites & deployments (git provider credential clone, env, health verification) - Domains/DNS (Cloudflare adapter), certificates (TLS probe), monitoring - Automation (cron/event/webhook HMAC + notifications), AI Gateway, MCP (29 tools) - AI chat window (LLM function-calling + rules fallback, SSE streaming, approvals) - Notes: Vditor WYSIWYG markdown editor, non-blocking autosave - Tests: 35 unit/security tests; UI audit clean (desktop+mobile, deep links)
1.6 KiB
1.6 KiB
DevOS v1 Backend Architecture
1. Style
Modular monolith with NestJS.
2. Suggested Structure
apps/api/
├── src/
│ ├── modules/
│ │ ├── identity/
│ │ ├── workspace/
│ │ ├── resource/
│ │ ├── permission/
│ │ ├── audit/
│ │ ├── server/
│ │ ├── container/
│ │ ├── website/
│ │ ├── domain/
│ │ ├── deployment/
│ │ ├── monitoring/
│ │ ├── automation/
│ │ └── ai/
│ ├── integrations/
│ │ ├── ssh/
│ │ ├── docker/
│ │ ├── git/
│ │ ├── dns/
│ │ ├── cloud/
│ │ └── email/
│ ├── common/
│ └── main.ts
3. Rules
- Controllers handle transport only.
- DTOs define input/output contracts.
- Business logic belongs in application/domain services.
- Provider-specific logic belongs behind adapters.
- Credential access is centralized.
- Mutations are auditable.
- Long-running operations run asynchronously.
- External calls have timeouts, retries where safe, and idempotency where possible.
4. Infrastructure Adapters
DevOS does not reimplement:
- SSH
- Git
- Docker
- DNS
- SMTP
- cloud control planes
It provides unified adapters over those systems.
5. Async Execution
Use Redis-backed jobs for:
- deployment
- server discovery
- monitoring checks
- long-running SSH commands
- automation execution
6. Observability
Every operation should carry:
- request ID
- correlation ID
- actor
- workspace
- resource
- action
- outcome