How hardikkhyal/self-host works
Purpose and entry points
DevOpsHub is a full-stack DevOps/SaaS dashboard for user authentication, project management, server/deployment orchestration, monitoring views, and cloud integrations. The executable application roots are the TypeScript backend at DevOpsHub/backend/src/server.ts and Vite/React frontend at DevOpsHub/frontend/src/main.tsx, composed by DevOpsHub/docker-compose.yml.
Frontend application shell
The frontend is a React/TypeScript SPA. DevOpsHub/frontend/src/App.tsx selects application pages, while DevOpsHub/frontend/src/components/layout/AppLayout.tsx provides persistent navigation via Navbar.tsx and Sidebar.tsx. Feature pages include projects, servers, monitoring, integrations, and auth under DevOpsHub/frontend/src/pages/.
Client state and API boundary
The browser communicates with the backend through DevOpsHub/frontend/src/services/api.ts. Authentication state is maintained separately in DevOpsHub/frontend/src/store/authStore.ts, and user-facing request/error feedback in DevOpsHub/frontend/src/store/toastStore.ts. This establishes the client/server boundary: pages render and initiate actions; API services carry authenticated requests to backend routes.
HTTP API, authentication, and request control
The backend is a Node.js/TypeScript HTTP service rooted at DevOpsHub/backend/src/server.ts. Route modules split the public API into authentication (DevOpsHub/backend/src/routes/authRoutes.ts) and project operations (DevOpsHub/backend/src/routes/projectRoutes.ts), with controller implementations in DevOpsHub/backend/src/controllers/authController.ts and projectController.ts. DevOpsHub/backend/src/middleware/authMiddleware.ts gates protected operations; rate limiting and centralized error handling are defined in rateLimiter.ts and errorHandler.ts.
Persistence and tenant/domain model
Prisma owns persistence configuration and schema evolution through DevOpsHub/backend/prisma/schema.prisma and DevOpsHub/backend/prisma/migrations/. The migrations indicate an evolving SaaS model with OTP support and deployment stages. Backend controllers access the shared Prisma client from DevOpsHub/backend/src/prisma.ts; seed data is provisioned by DevOpsHub/backend/prisma/seed.ts. Database credentials and operational settings are expected through backend environment configuration.
Deployment orchestration and cloud integration
Project actions can cross from the API layer into infrastructure execution. DevOpsHub/backend/src/services/sshOrchestrator.ts represents remote-server orchestration over SSH, while DevOpsHub/backend/src/services/awsService.ts integrates AWS capabilities. Sensitive connection or provider material is protected through DevOpsHub/backend/src/utils/encryption.ts; service failures are normalized/logged through errorClassifier.ts and logger.ts.
Infrastructure runtime
Local/container deployment is defined by DevOpsHub/docker-compose.yml and the backend image at DevOpsHub/backend/Dockerfile. Provisioning artifacts target AWS-oriented infrastructure with Terraform in DevOpsHub/infrastructure/terraform/main.tf and host configuration/deployment automation through Ansible in DevOpsHub/infrastructure/ansible/hosts.ini and playbook.yml. The principal runtime boundaries are browser → HTTP API → Prisma database, plus API → AWS/SSH-managed servers.
Main entry points: App.tsx App shell and pages · authController.ts Auth and project controllers · server.ts HTTP server · main.tsx Vite entry
Components 19
React SPA
- Vite entry
DevOpsHub/frontend/src/main.tsx - App shell and pages · Selects feature pages within persistent navigation.
DevOpsHub/frontend/src/App.tsx - Persistent layout
DevOpsHub/frontend/src/components/layout/AppLayout.tsx - API client · Carries authenticated browser requests to the API.
DevOpsHub/frontend/src/services/api.ts - Auth state
DevOpsHub/frontend/src/store/authStore.ts - Request feedback
DevOpsHub/frontend/src/store/toastStore.ts
Backend API
- HTTP server
DevOpsHub/backend/src/server.ts - Auth and project routes
DevOpsHub/backend/src/routes/authRoutes.ts - Auth and project controllers
DevOpsHub/backend/src/controllers/authController.ts - Auth and error controls · Protects operations and applies rate/error handling.
DevOpsHub/backend/src/middleware/authMiddleware.ts - Prisma client
DevOpsHub/backend/src/prisma.ts - SSH orchestrator
DevOpsHub/backend/src/services/sshOrchestrator.ts - AWS integration
DevOpsHub/backend/src/services/awsService.ts
Persistence
- SaaS database · Schema includes tenant, OTP, and deployment-stage evolution.
DevOpsHub/backend/prisma/schema.prisma
Infrastructure
- Container composition
DevOpsHub/docker-compose.yml - AWS provisioning
DevOpsHub/infrastructure/terraform/main.tf - Host automation
DevOpsHub/infrastructure/ansible/playbook.yml
Other components
- Browser user
- AWS and managed servers
Connections 19
- Browser user → Vite entry: loads
- Vite entry → App shell and pages: mounts
- App shell and pages → Persistent layout: renders in
- App shell and pages → Auth state: reads session
- App shell and pages → Request feedback: shows feedback
- App shell and pages → API client: initiates actions
- API client → HTTP server: HTTPS API requests
- HTTP server → Auth and error controls: applies
- Auth and error controls → Auth and project routes: permits requests
- Auth and project routes → Auth and project controllers: dispatches
- Auth and project controllers → Prisma client: persists domain data
- Prisma client → SaaS database: queries
- Auth and project controllers → SSH orchestrator: triggers deployments
- Auth and project controllers → AWS integration: uses cloud capabilities
- SSH orchestrator → AWS and managed servers: SSH execution
- AWS integration → AWS and managed servers: AWS API
- Container composition → HTTP server: runs backend image
- AWS provisioning → AWS and managed servers: provisions
- Host automation → AWS and managed servers: configures