Development
Prerequisites
- Node.js 22+
- pnpm 9.15+
Installation
bash
git clone <repo-url>
cd cadmin
pnpm installMonorepo Structure
cadmin/
├── api/ # Hono API + SQLite
│ ├── src/
│ │ ├── db/ # Drizzle schema, migrations, seed
│ │ ├── lib/ # Auth, Caddy API, Caddyfile generation
│ │ ├── middleware/ # Authentication middleware
│ │ ├── routes/ # API routes (auth, vhosts, logs, agents, changelog)
│ │ └── index.ts # Entry point
│ └── Dockerfile
├── admin/ # React SPA
│ ├── src/
│ │ ├── components/ # Components (vhost-form, diff-view, ui/)
│ │ ├── lib/ # API client, auth client
│ │ └── routes/ # Pages (TanStack Router, file-based)
│ └── Dockerfile
├── agent/ # Lightweight per-server service
│ ├── src/
│ │ ├── lib/ # Caddy API client
│ │ ├── middleware/ # Bearer token auth
│ │ ├── routes/ # Routes (caddy, logs, health)
│ │ └── index.ts # Entry point
│ └── Dockerfile
├── docs/ # VitePress documentation
├── package.json # Root scripts
└── pnpm-workspace.yamlRun in Dev Mode
bash
# Backend + Frontend
pnpm dev
# Individually
pnpm dev:api # http://localhost:3001
pnpm dev:admin # http://localhost:5173
pnpm dev:agent # http://localhost:3002TIP
The Vite dev server automatically proxies /api requests to the api.
Database
bash
# Generate migrations (after schema changes)
pnpm db:generate
# Apply migrations
pnpm db:migrate
# Create admin account
pnpm --filter api db:seedCode Conventions
- TypeScript strict
typeoverinterface- Arrow functions
- Export after declaration
