Skip to content

Architecture

Modular Monolith

Arche CMS follows a modular monolith architecture — all packages live in a single process but are organized into distinct, loosely-coupled modules with well-defined interfaces.

┌─────────────────────────────────────────────┐
│                  Admin UI                    │
│    (React 19 + Vite + TanStack Router       │
│     + TanStack Query + shadcn/ui)           │
├─────────────────────────────────────────────┤
│                 API Server                   │
│         (Fastify + Mercurius GraphQL)        │
├──────────┬──────────┬──────────┬────────────┤
│  REST    │ GraphQL  │  Auth    │   Media    │
│  Routes  │  Routes  │         │   Routes   │
├──────────┴──────────┴──────────┴────────────┤
│            Plugin System                     │
├──────────┬──────────┬──────────┬────────────┤
│ Schema   │ Database │Permissions│ Storage  │
│ Engine   │ Adapter  │  Engine   │ Adapter   │
├──────────┴──────────┴──────────┴────────────┤
│              Core Framework                  │
│   (DI Container, Event Bus, Lifecycle,      │
│               Config, Logger)               │
└─────────────────────────────────────────────┘

Packages

PackageDescription
@arche-cms/cmsCLI binary, server logic, admin panel
@arche-cms/coreDI container, event bus, lifecycle, logger
@arche-cms/schemaSchema definition API (defineCollection, field helpers)
@arche-cms/databaseDatabase adapter layer (Drizzle ORM)
@arche-cms/authJWT authentication service
@arche-cms/permissionsRBAC / permissions engine
@arche-cms/storageFile storage adapters (local, S3, R2)
@arche-cms/rest-apiREST API route generator
@arche-cms/graphqlGraphQL schema generator
@arche-cms/validationZod validation schema generator
@arche-cms/generatorsCode generation pipeline (types, routes, migrations)
@arche-cms/pluginsPlugin system + official plugins
@arche-cms/create-appProject scaffolding CLI
@arche-cms/sdkTypeScript client SDK
@arche-cms/typesShared TypeScript types

Key Design Decisions

Schema-as-Code

Schema definitions are TypeScript files in cms/collections/, cms/globals/, and cms/components/. On startup, the CMS loads, validates, and generates everything from these files. No admin UI required to define content models.

Adapter Pattern

Database and storage use adapter interfaces (DatabaseAdapter, StorageAdapter) so you can swap implementations without changing application code.

Plugin System

Everything is a plugin. The plugin manager hooks into schema loading, route registration, and request handling via typed hooks and extension points.

Event-Driven Internals

The event bus enables loose coupling between packages. Plugins can listen to lifecycle events (schema loaded, route registered, CRUD operation) without importing specific packages.

Data Flow

Client Request


  Fastify Server

      ├── Auth Middleware (JWT verification + API key fallback)
      ├── Permissions Checker (RBAC)
      ├── Plugin Hooks (beforeRequest)

      ├── REST Router ──► Handler ──► Database Adapter ──► SQL/NoSQL
      │       │                        │
      │       └── OpenAPI/Swagger ──────┘

      ├── GraphQL Router ──► Resolver ──► Database Adapter
      │       │
      │       └── GraphiQL

      └── Media Routes ──► Storage Adapter ──► Local/S3/R2

      ├── Plugin Hooks (afterRequest)
      └── Response

Released under the MIT License.