zc-admin
A modular full-stack administration platform: FastAPI + React with RBAC (users, roles, menus, API modules), S3 object storage, scheduled jobs, and system observability. Runs on Python 3.15.

Overview
zc-admin is the internal administration platform: one place to manage users, permissions, menus, files, scheduled jobs, and system health across internal services. It is the shared back office every internal tool plugs into, instead of each service re-implementing its own admin surface.
The stack is Python 3.15 + FastAPI on the backend (async SQLAlchemy, PostgreSQL, Alembic) and React 19 + Ant Design 6 on Vite+ for the frontend, with the TypeScript API client generated from the backend's OpenAPI schema so the two sides never drift apart.
Access Control
Permissions are data, not code. Four pieces compose the model:
- Users — accounts with roles, including a personal profile and account settings;
- Roles — the binding between users and what they may do;
- Menus — a sortable menu tree that drives frontend navigation, so what a user sees is exactly what they are allowed to open;
- Modules — a registry of every API endpoint (path, method, interface name) with its own auth level:
0no check,1valid token,2permission check, plus an optional per-endpoint rate limit such as10t/60s.
Authentication is JWT access + refresh tokens, with refresh sessions stored hashed in the database and a scheduled job purging sessions older than 30 days. A request that fails its module's auth level never reaches business logic.
Architecture
C4Component
title Component diagram for zc-admin
Container(spa, "Web Application", "React 19, Ant Design 6", "Provides the admin console to operators via their web browser.")
ContainerDb(db, "Database", "PostgreSQL", "Stores users, roles, menus, modules, logs, and token sessions.")
ContainerDb(s3, "Object Storage", "S3-compatible", "Stores attachments uploaded through the admin console.")
ContainerDb(redis, "Cache", "Redis", "In-memory data store.")
System_Ext(es, "Search Cluster", "Elasticsearch", "Provides full-text search.")
Container_Boundary(api, "API Application") {
Component(auth, "Token Controller", "FastAPI Router", "Issues and refreshes JWT access tokens")
Component(users, "User Controller", "FastAPI Router", "Manages user accounts and role assignments")
Component(rbac, "Access Control", "RBAC Service", "Enforces module-level permissions and per-endpoint rate limits")
Component(attach, "Attachment Controller", "FastAPI Router", "Manages file uploads and presigned URLs")
Component(store, "Storage Facade", "OpenDAL", "A facade onto S3-compatible object storage.")
Component(tasks, "Task Scheduler", "APScheduler", "Runs background jobs and maintenance tasks")
Component(sysinfo, "System Info", "FastAPI Service", "Reports CPU, memory, disk, database, and storage status")
Rel(auth, rbac, "")
Rel(users, rbac, "")
Rel(users, db, "Read & write to", "SQL")
Rel(rbac, db, "Reads", "SQL")
Rel(attach, store, "")
Rel(store, s3, "", "S3 API")
Rel(tasks, db, "Read & write to", "SQL")
Rel(sysinfo, db, "Reads", "SQL")
Rel(sysinfo, s3, "Reads", "S3 API")
Rel(sysinfo, redis, "Reads")
Rel(sysinfo, es, "Reads")
}
Rel(spa, auth, "", "JSON/HTTPS")
Rel(spa, users, "", "JSON/HTTPS")
Rel(spa, attach, "", "JSON/HTTPS")
Rel(spa, sysinfo, "", "JSON/HTTPS")
Each backend module follows one flat layout — route.py, view.py, service.py, db.py, schema.py — with services owning transactions and CRUD, Pydantic schemas for every request and response, and shared conventions for soft delete, UUID keys, and paginated lists. There are no parallel repository or service layers to keep in sync.
The frontend mirrors that structure: dashboard, login, account settings, and manage pages for base data (users, roles, menus, modules), attachments, operation logs, system info, and scheduled tasks. User-visible strings go through a CSV-backed i18n pipeline, and the generated OpenAPI client keeps frontend calls type-safe against the real backend.
Storage & Attachments
Files go through OpenDAL's standard S3 interface, with presigned URLs for upload (900s) and download (300s). The backend never assumes which S3-compatible server sits behind the endpoint, so the storage backend is a configuration choice, not a code dependency.
Operations, Observability & Quality
- Scheduled jobs — APScheduler powers background work, including token-session cleanup and recurring maintenance;
- System info — a live view of CPU, memory, disks, database tables, Redis, object storage, and Elasticsearch, plus health checks and operation logs;
- Search & context — Elasticsearch integration and IP geolocation enrich requests and logs; OpenTelemetry traces requests end to end;
- Quality gates — pytest with a 100% line-and-branch coverage gate on the backend, Ruff and
tyfor lint and types, Vitest and oxlint/oxfmt on the frontend. Coverage is a hard gate, not a badge: untested lines block the merge; - Delivery — Docker Compose deployment; merges do not trigger builds. Releases are triggered manually and published to GHCR and a private container registry.


