How cortezaproject/corteza works
Purpose and runtime entry points
Corteza is an open-source low-code platform for structured-data applications, workflow automation, integrations, RBAC, privacy, and federation. The primary runtime is a Go server launched by server/cmd/corteza/main.go; application bootstrapping, dependency initialization, and HTTP-server registration are centralized in server/app/app.go and server/app/servers.go. Container entry points are server/Dockerfile and client/web/Dockerfile.
Server composition and API boundary
The Go monolith is organized into domain components—System, Compose, Automation, Federation, and Discovery—each following a generated REST request/handler layer over domain services and types. REST routes are assembled per component, e.g. server/system/rest/router.go, server/compose/rest/router.go, and server/automation/rest/router.go. Handler code translates API payloads to service calls; services enforce business rules, permissions, events, and persistence.
System control plane: identity, policy, and platform services
System owns users, roles, settings, applications, attachments, queues, templates, API-gateway routes, privacy requests, and reporting. Authentication provides local login, sessions, OAuth2, SAML, MFA, and external providers through server/auth/auth.go, server/auth/handlers/routes.go, and server/auth/oauth2/oauth2.go. Authorization is flattened RBAC, implemented centrally in server/pkg/rbac/service.go and applied by generated component access-control services such as server/system/service/access_control.go. System also exposes SCIM at server/system/scim/routes.go.
Low-code data and application model
Compose is the primary application-building domain: namespaces contain modules (schemas), records, pages/layouts, charts, attachments, and notifications. Its core services are server/compose/service/namespace.go, server/compose/service/module.go, and server/compose/service/record.go. Record changes publish component events (server/compose/service/event/record.go), creating the main boundary into automation. Record values are validated, sanitized, formatted, and evaluated through server/compose/service/values/.
Automation, workflows, and asynchronous processing
Automation stores workflows, triggers, and execution sessions in server/automation/service/workflow.go, server/automation/service/trigger.go, and server/automation/service/session.go. The workflow executor interprets graph steps, gateways, iterators, prompts, state, and errors in server/pkg/wfexec/. Automation handlers bridge workflow steps to Compose, System, HTTP, email, queues, JavaScript, JWT, OAuth2, API-gateway bodies, and Corredor scripts (server/automation/automation/). Corredor is a gRPC-connected external automation service defined by def/protobuf/service-corredor.proto and integrated through server/pkg/corredor/service.go.
Data, import/export, and external infrastructure
The storage abstraction is server/store/; its RDBMS adapter supports PostgreSQL, MySQL, SQLite, and MSSQL under server/store/adapters/rdbms/drivers/. The DAL supports configurable connections, schemas, sensitivity levels, query pipelines, joins, links, aggregates, and multiple physical data sources via server/pkg/dal/service.go and server/system/service/dal_connection.go. Envoy provides graph-aware import/export of platform resources, YAML, CSV, and JSONL through server/pkg/envoy/. Supporting infrastructure includes MinIO-compatible or local object storage (server/pkg/objstore/), SMTP mail, message queues, websockets, scheduler, Sentry, and configurable HTTP clients.
Web applications and shared client contracts
Separate Vue SPAs serve distinct roles: administration (client/web/admin/src/main.js), low-code Compose authoring/runtime (client/web/compose/src/main.js), workflow graph editing (client/web/workflow/src/main.js), reporting, discovery, privacy, and application selection. Each uses routing and state stores to call server REST APIs. Shared TypeScript API clients and domain models live in lib/js/src/api-clients/ and lib/js/src/compose/; shared Vue controls, auth/API plugins, RBAC, notification, and workflow-prompt facilities live in lib/vue/src/. Nginx serves built SPA assets through client/web/nginx.conf.
Integration-facing subsystems
The API gateway dynamically routes and filters requests, supports proxying and profiling, and is implemented in server/pkg/apigw/. Federation exchanges module structure and data with remote Corteza nodes through server/federation/service/ and server/federation/rest/router.go. Discovery has both an in-server resource/feed API (server/discovery/) and an optional Elasticsearch-backed service at extra/server-discovery/, consumed by the Discovery SPA.
Main entry points: router.go Component REST API · workflow.go Workflow automation · record.go Compose low-code data · main.js Role-specific Vue SPAs
Components 22
Web clients
- Role-specific Vue SPAs · Admin, Compose, workflow, reporting, discovery, privacy, and app-selection clients.
client/web/compose/src/main.js - Shared JS contracts · API clients and Compose domain models shared by SPAs.
lib/js/src/api-clients/index.ts - Shared Vue facilities · Shared controls, auth/API plugins, RBAC, notifications, and workflow prompts.
lib/vue/src/index.ts - SPA asset server
client/web/nginx.conf
Go platform
- Corteza server · Primary monolith entry point.
server/cmd/corteza/main.go - Application bootstrap · Initializes dependencies and registers HTTP servers.
server/app/app.go - Component REST API · Generated request and handler layers assemble component routes.
server/system/rest/router.go - Authentication · Local sessions, OAuth2, SAML, MFA, and external providers.
server/auth/auth.go - RBAC policy · Central flattened role-based access control.
server/pkg/rbac/service.go
Domain services
- System control plane · Users, roles, settings, platform resources, privacy, and reporting.
server/system/service/access_control.go - Compose low-code data · Namespaces, modules, records, pages, charts, and attachments.
server/compose/service/record.go - Record events · Publishes Compose record changes to automation.
server/compose/service/event/record.go - Workflow automation · Workflows, triggers, and execution sessions.
server/automation/service/workflow.go - Workflow executor · Interprets workflow graphs, gateways, iterators, prompts, and state.
server/pkg/wfexec/graph.go - Federation · Exchanges module structure and data with remote Corteza nodes.
server/federation/service/service.go - Discovery · In-server discovery resources and feeds.
server/discovery/rest/router.go
Data and integrations
- RDBMS storage · Supports PostgreSQL, MySQL, SQLite, and MSSQL adapters.
server/store/connect.go - Data access layer · Configurable schemas, connections, query pipelines, and physical sources.
server/pkg/dal/service.go - Envoy import/export · Graph-aware YAML, CSV, and JSONL import/export.
server/pkg/envoy/builder.go - API gateway · Routes, filters, proxies, and profiles integration requests.
server/pkg/apigw/service.go - Corredor · External script automation service.
server/pkg/corredor/service.go - Optional Discovery service
extra/server-discovery/main.go
Connections 28
- Role-specific Vue SPAs → Shared JS contracts: uses
- Role-specific Vue SPAs → Shared Vue facilities: uses
- SPA asset server → Role-specific Vue SPAs: serves built assets
- Role-specific Vue SPAs → Component REST API: REST calls
- Corteza server → Application bootstrap: boots
- Application bootstrap → Component REST API: registers HTTP routes
- Component REST API → Authentication: authenticates
- Component REST API → System control plane: System endpoints
- Component REST API → Compose low-code data: Compose endpoints
- Component REST API → Workflow automation: Automation endpoints
- Component REST API → Federation: Federation endpoints
- Component REST API → Discovery: Discovery endpoints
- System control plane → RBAC policy: enforces access
- Compose low-code data → RBAC policy: enforces access
- Workflow automation → RBAC policy: enforces access
- Compose low-code data → Record events: publishes changes
- Record events → Workflow automation: triggers workflows
- Workflow automation → Workflow executor: executes
- Workflow automation → Corredor: gRPC scripts
- System control plane → RDBMS storage: persists
- Compose low-code data → Data access layer: queries data
- Data access layer → RDBMS storage: uses configured sources
- Workflow automation → RDBMS storage: persists sessions
- Federation → Compose low-code data: syncs structures and data
- Envoy import/export → System control plane: transfers resources
- Envoy import/export → Compose low-code data: transfers resources
- API gateway → Component REST API: routes integration traffic
- Discovery → Optional Discovery service: optional search backend