How badrinathantv/khronos-cloud works
Purpose and entry points
Khronos Cloud is a multi-tenant workflow automation platform: users create tenants and workflows, publish versioned events, and execute matching workflow actions asynchronously. The main runnable stack is docker-compose.yml. Client entry points are the React SPA at frontend/src/main.jsx and API gateway at backend/gateway/src/main.py.
Client and API boundary
The SPA handles authentication, tenant context, workflow design, and execution monitoring. It sends JWT-bearing HTTP requests through a single gateway boundary rather than addressing backend services directly.
• frontend/src/App.jsx
• frontend/src/services/api.js
• backend/gateway/src/api/routes/auth.py
• backend/gateway/src/api/routes/workflows.py
• backend/gateway/src/services/proxy.py
Gateway orchestration
The FastAPI gateway is the external backend entry point. It validates identity and tenant access over gRPC, then reverse-proxies workflow and event requests to their owning services. This separates public HTTP routing from control-plane authorization.
• backend/gateway/src/main.py
• backend/gateway/src/grpc_clients/auth_client.py
• backend/gateway/src/grpc_clients/tenant_client.py
• shared/protos/auth.proto
• shared/protos/tenant.proto
Identity and tenancy control plane
Auth owns user accounts, JWT/security behavior, and token verification. Tenant owns workspace records and membership/access checks. Both expose REST APIs plus gRPC servers for gateway-side authorization and persist through their service database layers; migrations exist independently per service.
• backend/auth/src/api/routes/auth.py
• backend/auth/src/grpc_server/server.py
• backend/auth/src/models/user.py
• backend/tenant/src/api/routes/tenants.py
• backend/tenant/src/grpc_server/server.py
• backend/tenant/src/models/tenant.py
Workflow definition, execution, and search
The workflow service owns workflow and execution APIs, persistence, and the execution engine. Its consumer receives broker events, resolves applicable work, and the executor runs configured actions such as logging and HTTP calls. Execution logs are indexed through the OpenSearch integration for search-oriented APIs.
• backend/workflow/src/api/routes/workflows.py
• backend/workflow/src/api/routes/executions.py
• backend/workflow/src/engine/consumer.py
• backend/workflow/src/engine/executor.py
• backend/workflow/src/engine/actions.py
• backend/workflow/src/core/opensearch.py
Event ingestion and asynchronous pipeline
The event-bus service is the event publication boundary: it validates incoming event schemas, maps event types/versions, and publishes messages to Kafka. Kafka decouples external event submission from workflow execution; the workflow background consumer subscribes and triggers execution rather than executing in the request path.
• backend/event-bus/src/api/routes/publish.py
• backend/event-bus/src/api/routes/validate.py
• backend/event-bus/src/registry/mapper.py
• backend/event-bus/src/core/producer.py
• backend/event-bus/src/core/kafka.py
Runtime infrastructure and observability
Application services are containerized individually and orchestrated with Docker Compose. PostgreSQL is the transactional store used by auth, tenant, and workflow services; Kafka transports events; OpenSearch stores execution logs. Redis is provisioned by the stack, while Jaeger receives OpenTelemetry traces emitted from service telemetry modules.
• docker-compose.yml
• backend/auth/Dockerfile
• backend/workflow/Dockerfile
• backend/gateway/src/core/telemetry.py
• backend/event-bus/src/core/telemetry.py
Main entry points: main.py FastAPI gateway · publish.py Event bus API · auth_client.py gRPC auth clients · proxy.py Service proxy
Components 19
Client
- React SPA · Authentication, tenant context, workflow design, and monitoring UI.
frontend/src/App.jsx - Gateway API client · Single JWT-bearing backend access boundary.
frontend/src/services/api.js
Gateway
- FastAPI gateway · Public HTTP routing and control-plane authorization boundary.
backend/gateway/src/main.py - gRPC auth clients · Validates identity and tenant access before proxying.
backend/gateway/src/grpc_clients/auth_client.py - Service proxy · Routes workflow and event requests to owning services.
backend/gateway/src/services/proxy.py
Identity & tenancy
- Auth service · Owns accounts, JWTs, and token verification.
backend/auth/src/api/routes/auth.py - Auth gRPC server
backend/auth/src/grpc_server/server.py - Tenant service · Owns workspaces, memberships, and access checks.
backend/tenant/src/api/routes/tenants.py - Tenant gRPC server
backend/tenant/src/grpc_server/server.py
Workflow execution
- Workflow API · Owns workflow definitions and execution APIs.
backend/workflow/src/api/routes/workflows.py - Workflow consumer · Resolves applicable workflow work from broker events.
backend/workflow/src/engine/consumer.py - Action executor · Runs configured logging and HTTP actions.
backend/workflow/src/engine/executor.py
Event pipeline
- Event bus API · Validates, maps, and publishes versioned events.
backend/event-bus/src/api/routes/publish.py - Event mapper · Maps event types and versions.
backend/event-bus/src/registry/mapper.py
Runtime infrastructure
- Kafka · Decouples publication from workflow execution.
docker-compose.yml - PostgreSQL · Service persistence for auth, tenant, and workflow data.
docker-compose.yml - OpenSearch · Searchable execution logs.
docker-compose.yml - Jaeger · Receives OpenTelemetry traces.
docker-compose.yml - Docker Compose · Runs the containerized application stack and infrastructure.
docker-compose.yml
Connections 22
- React SPA → Gateway API client: uses
- Gateway API client → FastAPI gateway: JWT HTTP
- FastAPI gateway → gRPC auth clients: authorizes
- gRPC auth clients → Auth gRPC server: identity check
- gRPC auth clients → Tenant gRPC server: tenant access check
- Auth gRPC server → Auth service: serves auth state
- Tenant gRPC server → Tenant service: serves tenant state
- FastAPI gateway → Service proxy: delegates
- Service proxy → Workflow API: workflow requests
- Service proxy → Event bus API: event requests
- Event bus API → Event mapper: validates and maps
- Event bus API → Kafka: publishes
- Kafka → Workflow consumer: subscribes
- Workflow consumer → Action executor: triggers
- Auth service → PostgreSQL: persists
- Tenant service → PostgreSQL: persists
- Workflow API → PostgreSQL: persists definitions and executions
- Action executor → OpenSearch: indexes execution logs
- FastAPI gateway → Jaeger: emits traces
- Event bus API → Jaeger: emits traces
- Docker Compose → FastAPI gateway: orchestrates
- Docker Compose → Kafka: provisions