How crocofied/corecontrol works
Project Type & Purpose
• CoreControl is a self-hosted, full-stack server-infrastructure management dashboard.
• It consists of a Next.js + TypeScript monolith for UI and API, a Go-based agent for background monitoring, and a PostgreSQL database.
High-Level File Structure Analysis
• Top-level “app” directory: Next.js app routes, pages, and UI components.
• “agent” directory: Go service with its own Dockerfile, modules, internal packages (server, database, models, notifications, monitoring).
• “prisma” and “lib/generated/prisma”: database schema, migrations, and generated client.
• Configuration/deployment: Dockerfile, docker-compose (compose.yml), Next.js (next.config.ts), TypeScript, PostCSS, VitePress docs.
README Insights
• Describes three runtime services: web (Next.js), agent (Go), db (Postgres).
• Shows Docker-Compose setup with environment variables, health checks, volumes.
• Highlights tech stack: Next.js, Go, Prisma, Tailwind/shadcn, React Flow, Glances, external notification channels.
Main Components & Their Interactions
a. Frontend (Next.js UI)
• Components: pages (login, dashboard, servers, applications, networks, uptime, settings), shared UI library (components/ui), theme provider.
• Serves HTML/CSS/JS to browser.
b. Backend API (Next.js serverless routes)
• Under app/api/*: CRUD endpoints for auth, servers, applications, notifications, flowchart, dashboard, settings, uptime.
• Business logic uses Prisma client (lib/prisma.ts) to query PostgreSQL.
c. Database (PostgreSQL + Prisma)
• Schema defined in prisma/schema.prisma, migrations under prisma/migrations.
• Persistent storage for users, servers, applications, notifications, uptime logs, settings.
d. Agent (Go microservice)
• Periodically polls servers via Glances (monitor.go), writes metrics to database, and triggers notifications via internal/notifications.
• Exposes minimal HTTP interface (internal/server) for potential remote control or health checks.
e. External Services
• Glances: system-monitoring tool invoked by the agent.
• Notification providers: Email, Discord, Echobell, Gotify, Ntfy, Pushover, Telegram via agent.
Architectural Patterns & Design Principles
• Separation of Concerns: UI layer, API layer, monitoring agent, data persistence, and external integrations are distinct.
• Monorepo + Polyglot Microservices: Next.js and Go live side-by-side, communicate via shared database.
• Serverless API Routes: Next.js routes act as lightweight functions, no separate backend server code.
• Event-Driven Monitoring: Agent writes metrics and events to DB; API reads and aggregates uptime.