How upayanmazumder/kodesphere works
Main Components
• Frontend (Web Application):
• Located in the “app” directory. It is built with Next.js (as seen from the Next configuration and _app.js, _document.js pages) and contains the UI components (e.g., login screens, dashboard, hero, GitHub login, etc.).
• This component serves the client-side experience where users can trigger deployments and manage their applications.
• Backend API:
• Found in the “api” directory. It includes controllers (authController, createUser, githubController), routes (analyze, auth, getAIresponse, github), and configuration files (passport.js).
• This API handles user requests such as deploying applications by processing Docker image specifications, subdomain details, environment variables, and deployment lifecycle events.
• Containerization and Deployment Components:
• Dockerfiles at the root, inside “k8s” and GitHub workflows indicate CI/CD pipelines.
• The “docker-compose.yml” and “k8s-config” directories contain Kubernetes deployment files (Deployment, Ingress, Service, and cluster issuer configurations) which are crucial for orchestrating deployments.
• Kubernetes Cluster & Ingress Controller:
• As described in the README, Kubernetes manages the orchestration of deployments. The ingress configurations (api-ingress.yaml in k8s-config) manage the incoming traffic based on subdomain patterns.
• External DNS mapping and port mapping are also part of this layer.
• CI/CD Pipeline:
• Several GitHub workflows (.github/workflows) handle Docker image build and deployment processes. They ensure that both the main application and the Kubernetes deployment images are updated (referencing “docker-image-k8s.yml” and “docker-image-main.yml”).
• Auxiliary Assets & Documentation:
• The assets directory (with presentation files and business model canvas) and the k8s configuration documentation provide insight into the business logic and production deployment aspects.
Relationships and Data Flow
• Users interact with the Frontend (hosted at ks.upayan.dev) which offers a dashboard and controls to deploy applications.
• The Frontend communicates with the Backend API (api.ks.upayan.dev) via HTTP/HTTPS calls.
• The API receives deployment requests that include details such as users’ Docker image references, subdomain choices, ports, and environment variables.
• The API then interacts with the Kubernetes cluster orchestrator (api.vitians.in) to trigger deployments using Kubernetes manifests defined in the “k8s-config” directory.
• The CI/CD pipeline (via GitHub workflows) automatically builds and pushes Docker images to GitHub Container Registry, updating both the main kodesphere image and the Kubernetes deployment image.
• Finally, the Ingress controller routes incoming requests from the user’s subdomain to the correct deployed application instance.
Architectural Patterns and Technologies
• Separation of Concerns / Layered Architecture: There is a clear separation between the Frontend (UI) and Backend API.
• Containerization: Docker is heavily used to package applications.
• Orchestration: Kubernetes is central to managing scalability and deployment, with precise ingress configuration for subdomain routing.
• CI/CD: GitHub workflows automate image building and deployments.
• Microservices Elements: While the project is monorepo, the separation into “app” and “api” and use of separate images hint at a microservices or at least decoupled service design.