How akhil-naidu/dflow works
Project type and purpose
• This is a full-stack, self-hosted PaaS/web platform (“dFlow”) built with Next.js (React/TypeScript) for the frontend, Payload CMS for admin/content and Node.js for backend logic and background processing.
• Purpose: allow users to deploy/manage apps (via Dokku, Docker, AWS, etc.), with automated workflows and monitoring.
High-level components
a. Users & Browser – end users access the web UI
b. Next.js Frontend – renders pages (SSR/SSG), serves static assets, hosts React components and API routes
c. Payload CMS – embedded admin UI + authenticated content/API layer on /payload
d. API / Business-Logic Layer – Next.js API routes invoke “actions” modules and enqueue jobs
e. Job Queue & Workers – BullMQ via Redis: background tasks process deployments, backups, plugin operations, monitoring, etc.
f. Data Stores – MongoDB (Payload collections for projects, servers, services, users, etc.) and Redis (queues, pub/sub)
g. External Services – AWS/dFlow cloud, Docker registries, Git providers, Dokku servers, Netdata, SSH, Railpack
Relationships and interactions
• Browser → Next.js Frontend (page requests, client-side fetch)
• Frontend → Next.js API Routes (e.g., /api/deploy, /api/webhook)
• API layer → “actions/*” modules (validation + orchestration)
• Actions → enqueue jobs to Redis queues
• Workers → dequeue jobs, call “lib/*” connectors to interact with external systems (Docker, Dokku, AWS, Netdata)
• API layer + Workers → read/write MongoDB via Payload CMS models
• Real-time updates → Redis pub/sub pushes status back to front end
Architectural patterns & design principles
• Modular separations:
• Presentation (Next.js pages & components)
• API/Orchestration (actions + validators)
• Asynchronous Processing (queues & workers)
• Data Persistence (Payload/MongoDB, Redis)
• Event-driven, queue-based background processing for reliability and scalability
• Single codebase monolith but logically layered
• Use of Payload CMS for built-in RBAC, hooks, and REST endpoints