kora

command module
v1.0.0-alpha.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Kigae — Config-Driven Application Engine

Kigae is the open-source modular business software project and application engine. It currently provides a DocType-centric runtime with a kernel, typed contracts, workflow runtime, AI/MCP surfaces, and a React admin UI. Some planned capabilities remain in progress; see the implementation and tests for the current behavior.

Kigae Cloud is the managed hosting offering, and Senumi is the company and sponsor. Some compatibility-sensitive code identifiers still use the former Kora spelling; see the brand architecture before copying technical names from this README.

Docker Hub GitHub

Architecture target

The architecture specification defines the planned module boundaries, runtime ownership, database budgets, requests and workflows, consumer contracts, implementation order and deployment gates. It describes a target; current support remains governed by the capability registry and tested implementation.

See the database support matrix for tested backend evidence and its current limits.

Quick Start (Docker)

# MySQL
docker run -d --name kora -p 8000:8000 \
  -e KORA_DB_TYPE=mysql \
  -e KORA_DB_HOST=127.0.0.1 \
  -e KORA_DB_USER=root \
  -e KORA_DB_PASSWORD=yourpassword \
  -e CONSOLE_EMAIL=admin@kora.local \
  -e CONSOLE_PASSWORD=admin123 \
  smitdockerhub/kora:latest

# LibSQL (remote)
docker run -d --name kora -p 8000:8000 \
  -e KORA_DB_TYPE=libsql \
  -e DB_DSN=http://user:pass@libsql-host:8080 \
  -e CONSOLE_EMAIL=admin@kora.local \
  -e CONSOLE_PASSWORD=admin123 \
  smitdockerhub/kora:latest

Open http://localhost:8000/console → create your first site. Runtime configuration is loaded from environment and persisted site metadata; application configuration is still DocType/config-pack driven rather than the RFC's full generic application-definition model.

Local Development

git clone https://github.com/asenawritescode/kora.git && cd kora

# With local MySQL
docker compose up -d mysql
make dev DB_PASS=kora123 ADMIN_PASS=kora123

# Or with env vars directly
make build
KORA_DB_TYPE=mysql KORA_DB_HOST=127.0.0.1 KORA_DB_USER=root KORA_DB_PASSWORD=kora123 \
  CONSOLE_EMAIL=admin@kora.local CONSOLE_PASSWORD=kora123 \
  ./kora serve --port 8000
Command What it does
make build Build UI (bun) + Go binary
make serve Build + start server
make test Run Go tests (18 packages)
make lint Run linters (Go + TypeScript)
make fmt Format code
make help Show all commands

Features

  • AI Chat Assistant — floating, page-aware chat with durable transcripts, tracked runs, and catalog-backed tool execution at /api/v1/ai/chat. A site or enabled shared provider key is required. Marked experimental in the capability registry.
  • AI Doctype Generator — AI-assisted draft creation for DocType YAML.
  • Config-Driven Admin — forms, lists, filters, workflows, and page manifests are rendered from configuration, but the runtime remains DocType-centric rather than fully generic-resource-based.
  • Multi-Site — path-based (/s/:site/workspace) by default, with host-based routing only for configured domains. Sites created from the console are persisted in the database.
  • Multi-Database — MySQL is the primary self-host backend. PostgreSQL and remote LibSQL have dialect and package-level integration coverage with remaining gaps; MariaDB is not separately validated. See the database support matrix.
  • Console UI — /console for system admin: create/edit sites, view health, manage all sites.
  • Self-Service Onboarding — public site creation at /onboard when KORA_CONSOLE_ONBOARDING_ENABLED=true. Users create their own sites with admin accounts. Rate-limited (3/hr/IP).
  • Cloud-managed AI — when connected to Kigae Cloud, workspace chat uses the provider configured by Cloud. Per-site provider keys remain available for standalone deployments.
  • Swagger/OpenAPI — auto-generated API docs at /api/swagger-ui.
  • Mobile Responsive — tables become stacked cards in the current React UI.
  • Extensibility — trigger-based automations, a permission-gated JS runtime for document hooks and custom API methods, webhook extensions, scheduled scripts, and computed fields. Automation effects use registered Engine actions.
  • MCP Server — Model Context Protocol server for Claude Desktop and similar tooling. Capability is experimental, and tenant tool execution is still projection-based rather than a full standalone agent runtime.
  • Go SDK + TypeScript SDK — SDKs for integrations and extensions.
  • API Versioning — /api/v1/ routes exist for the supported surface.
  • Analytics — automatic per-doctype metrics with rollups and time-series queries.

Capability Status

The public capability registry lives in contract.BaselineCapabilities(). It is the source of truth for what the current codebase supports, what remains experimental, and what is still planned.

Capability Status
contract.event_envelope supported
contract.command_envelope supported
contract.actor_context experimental
provider.nats supported
outbox.transactional supported
auth.oidc supported
ai.chat experimental
ai.mcp experimental
offline.sync supported

Current Architecture Truth

  • The current engine is DocType-centric, not a fully generic resource engine.
  • The current frontend is a React SPA with an embedded page-manifest runtime, not an ES-module/Franken UI runtime.
  • The current kernel, contract surface, workflow runtime, and AI/MCP surfaces are real, but still evolving.
  • PostgreSQL and LibSQL coverage is partial; the database support matrix records current evidence and open validation gates.

Configuration

Runtime config comes from environment variables plus site metadata in the database. Application configuration still uses YAML/config packs for DocType-driven runtime state.

Variable Default Description
KORA_DB_TYPE mysql mysql, postgres, or libsql; backend evidence and limits are in the database support matrix
KORA_DB_HOST 127.0.0.1 DB host (or HTTP URL for LibSQL)
KORA_DB_USER — DB user
KORA_DB_PASSWORD — DB password
DB_DSN — Full connection string (overrides host/user/password)
KORA_HTTP_PORT 8000 Server port
CONSOLE_EMAIL admin@kora.local Console admin email
CONSOLE_PASSWORD kora123 Console admin password
KORA_LOG_LEVEL info debug, info, warn, error
KORA_SESSION_HOURS 72 Session lifetime in hours
KORA_HOST — Public app hostname (e.g., app.kora.mradiafrica.com)
KORA_CLOUD_AI_GATEWAY_URL — Private Kigae Cloud AI gateway base URL (for example http://127.0.0.1:8081/internal/engine/ai)
KORA_CLOUD_AI_GATEWAY_TOKEN — Private Engine-to-Cloud bearer token; configure the matching KORA_CLOUD_ENGINE_AI_TOKEN in Cloud
KORA_CLOUD_AI_GATEWAY_MODEL cloud-managed Model label sent to Cloud; Cloud selects the actual provider model
KORA_SCRIPTS_ENABLED false Enable JS script engine for extensions
KORA_OUTBOX true Enable transactional kernel events; set false only if reports and event-driven integrations are intentionally disabled
KORA_NATS_STREAM_MAX_BYTES 1073741824 Maximum bytes retained by the JetStream event stream (1 GiB default; requires NATS)
KORA_NATS_STREAM_MAX_MESSAGES 1000000 Maximum messages retained by the JetStream event stream (requires NATS)
KORA_DB_PORT 3306 Database port (MySQL)
KORA_RELOAD_TOKEN — Bearer token for /_kora/admin/reload-site endpoint
KORA_SCRIPTS_HTTP_ALLOWLIST — Comma-separated domains allowed for script HTTP requests
KORA_LOG_FORMAT text Log format: text or json
KORA_CSRF_SECURE true Set secure flag on CSRF cookies
KORA_RATE_LIMIT 100 Max requests per minute per IP
KORA_RATE_BURST 200 Rate limiter burst allowance
KORA_CONSOLE_ONBOARDING_ENABLED false Enable public console onboarding at /onboard

SDK Quick Start

Add Kigae to your Go project:

import "github.com/asenawritescode/kora/sdk"

func main() {
    client := sdk.NewClient(sdk.Config{
        BaseURL: "http://localhost:8000/api/v1",
        APIKey: "your-api-key",
    })
    // List documents
    docs, err := client.GetList("Customer", map[string]string{})
    // Get single document
    doc, err := client.GetDoc("Customer", "CUST-0001")
    // Create document
    err := client.Insert("Customer", map[string]any{"name": "Acme Corp"})
}

Or in TypeScript:

import { KoraClient } from "@kora/sdk"

const client = new KoraClient({
  baseURL: "/api/v1",
  csrfToken: await getCSRFToken(),
})
// List documents
const customers = await client.getList("Customer", {})
// Get single document
const customer = await client.getDoc("Customer", "CUST-0001")
// Create document
await client.insert("Customer", { name: "Acme Corp" })

Multi-Site

http://host/s/airtime/workspace     → Airtime workspace (path-based, no DNS needed)
http://host/s/fieldwork/workspace   → Fieldwork workspace
http://host/console                 → System console

Sites created via console are persisted in _kora_site_registry for startup discovery, and still keep tenant-local config history in _kora_config_version. They survive container redeploys and can be hot-added immediately after onboarding.

For path-based access, set KORA_HOST to the public app hostname. That host is allowed for session and cookie flow, while tenant routing stays on /s/:site/... until you add real tenant domains.

Administrator Panel

Ten admin views — all config-driven, all mobile-responsive:

  • DocTypes — visual form builder + live YAML preview
  • Permissions — role × doctype matrix, inline editing
  • Automations — record-triggered workflows and status transitions
  • Versions — config version history, diff, rollback
  • Users — CRUD, roles, enable/disable, password reset
  • Scripts — JS script editor, test runner, console logs
  • Extensions — webhook endpoints, custom API methods, event hooks
  • Secrets — AI provider keys (encrypted at rest, AES-256-GCM)
  • Analytics — auto-generated metrics, daily/monthly rollups, time-series charts
  • API Docs — Swagger UI at /api/swagger-ui

Documentation

Document What it covers
CLAUDE.md Full architecture guide, build & run commands, package map
CONTRIBUTING.md Development workflow, project structure, PR guidelines
skills/create-config.md YAML config reference — doctypes, fields, permissions, roles; Engine v2 workflow JSON and Automations UI

Tech Stack

Layer Technology
Language Go 1.25
HTTP Gin, net/http
Database MySQL 8.0, MariaDB, LibSQL (remote HTTP)
AI / LLM OpenAI, DeepSeek V4, Anthropic Claude
Frontend React 19, TanStack Router/Query/Table/Form, shadcn/ui, Tailwind CSS v4
State Zustand, TanStack Query
Delivery Single binary — everything via go:embed, ~30MB, pure Go, no CGO

Docker

docker pull smitdockerhub/kora:latest

Pure Go, no CGO, ~30MB. Supports MySQL + LibSQL. Version injected at build time — check with curl /api/v1/ping.

Documentation

Overview

Package main — Kigae Fieldwork Sample Application

This is the entry point for the Kigae Fieldwork app. It starts the Kigae engine which loads site configs, bootstraps the database, builds the DocType registry, runs schema migrations, and starts the HTTP server.

The application is defined entirely in YAML config files under config/v0/fieldwork/. No application-specific Go code is needed beyond what the engine provides. Custom business logic can be added via Go hooks (see hooks/ directory).

Directories

Path Synopsis
api
Package api provides shared schema mapping from Kigae field types to JSON Schema.
Package api provides shared schema mapping from Kigae field types to JSON Schema.
ai
oidc
Package oidc implements the OIDC authorization-code + PKCE profile (AUTH-002).
Package oidc implements the OIDC authorization-code + PKCE profile (AUTH-002).
cmd
contractgen command
Command contractgen produces a deterministic JSON Schema snapshot for the stable wire types in contract.
Command contractgen produces a deterministic JSON Schema snapshot for the stable wire types in contract.
routeinventory command
Command routeinventory records the routes registered by the Engine's public API composition.
Command routeinventory records the routes registered by the Engine's public API composition.
Package component defines the typed component manifest (PLUGIN-004): what a component provides, what it requires, and which events it emits and handles.
Package component defines the typed component manifest (PLUGIN-004): what a component provides, what it requires, and which events it emits and handles.
Package configstore manages reading and writing DocType configuration to/from the database (_kora_doctype and _kora_field tables).
Package configstore manages reading and writing DocType configuration to/from the database (_kora_doctype and _kora_field tables).
Package contract defines the provider-neutral, versioned messaging contracts for the Kigae Engine execution fabric.
Package contract defines the provider-neutral, versioned messaging contracts for the Kigae Engine execution fabric.
Package db provides database abstraction via a Dialect interface.
Package db provides database abstraction via a Dialect interface.
Package doctype — computed field expression evaluation.
Package doctype — computed field expression evaluation.
Package effect implements the effect-scope contract (PLUGIN-003, invariant 7): every runtime effect — a timer, subscription, temp state, blob handle, or outbox listener — has an owner, a scope, a disposer, and observable cleanup evidence.
Package effect implements the effect-scope contract (PLUGIN-003, invariant 7): every runtime effect — a timer, subscription, temp state, blob handle, or outbox listener — has an owner, a scope, a disposer, and observable cleanup evidence.
Package email provides SMTP email sending.
Package email provides SMTP email sending.
Package eventstream defines the runtime change-event model and the bus contract shared by persistence, routing, and analytics adapters.
Package eventstream defines the runtime change-event model and the bus contract shared by persistence, routing, and analytics adapters.
Package expression defines the single shared expression and rule evaluation contract (PLUGIN-007).
Package expression defines the single shared expression and rule evaluation contract (PLUGIN-007).
Package extension owns installed tenant extensions and their API credentials.
Package extension owns installed tenant extensions and their API credentials.
sqlstore
Package sqlstore persists tenant extensions in the tenant database.
Package sqlstore persists tenant extensions in the tenant database.
tokencache
Package tokencache caches extension token verification for one Engine process.
Package tokencache caches extension token verification for one Engine process.
Package fieldtype implements the semantic field-type registry (GRAPH-007).
Package fieldtype implements the semantic field-type registry (GRAPH-007).
Package graph owns resource identity resolution and canonical hashing (GRAPH-001).
Package graph owns resource identity resolution and canonical hashing (GRAPH-001).
Package ingress is the Engine's compatibility router for site requests whose deployment assignment belongs to another Engine.
Package ingress is the Engine's compatibility router for site requests whose deployment assignment belongs to another Engine.
internal
application/process
Package process composes local request decisions with protected domain operations in one tenant transaction.
Package process composes local request decisions with protected domain operations in one tenant transaction.
application/purchasing
Package purchasing owns the governed Purchase Request approval policy.
Package purchasing owns the governed Purchase Request approval policy.
application/purchasing/engineadapter
Package engineadapter wires the purchasing domain into Engine's generic tenant-service extension points.
Package engineadapter wires the purchasing domain into Engine's generic tenant-service extension points.
application/purchasing/sqlstore
Package sqlstore implements the tenant-backed data reads for purchasing approval policy.
Package sqlstore implements the tenant-backed data reads for purchasing approval policy.
application/workflow
Package workflow contains transport-neutral authorization for durable workflow definitions and instances.
Package workflow contains transport-neutral authorization for durable workflow definitions and instances.
dbaccess
Package dbaccess bounds physical database connections shared by tenant and platform sql.DB pools in one Engine process.
Package dbaccess bounds physical database connections shared by tenant and platform sql.DB pools in one Engine process.
engine
Package engine owns the running Engine process boundary.
Package engine owns the running Engine process boundary.
netguard
Package netguard decides whether outbound requests may reach a host.
Package netguard decides whether outbound requests may reach a host.
tenantruntime
Package tenantruntime contains the typed, immutable service references captured by one tenant runtime generation.
Package tenantruntime contains the typed, immutable service references captured by one tenant runtime generation.
Package kernel implements the single operation kernel (architecture specification invariants 2–3, KERNEL-001..007): every mutation from every source — HTTP, SDK, MCP, AI, CLI, UI, integrations, workers — enters one pipeline that resolves tenant and actor, authorizes, validates, checks idempotency and concurrency, executes one SQL transaction containing the business mutation plus the idempotency receipt, the audit row, and the outbox events, and returns a typed OperationResult.
Package kernel implements the single operation kernel (architecture specification invariants 2–3, KERNEL-001..007): every mutation from every source — HTTP, SDK, MCP, AI, CLI, UI, integrations, workers — enters one pipeline that resolves tenant and actor, authorizes, validates, checks idempotency and concurrency, executes one SQL transaction containing the business mutation plus the idempotency receipt, the audit row, and the outbox events, and returns a typed OperationResult.
Package management owns durable control-plane operations accepted by an Engine.
Package management owns durable control-plane operations accepted by an Engine.
Package mcp provides a Model Context Protocol server that auto-generates tools from Kigae's doctype registry.
Package mcp provides a Model Context Protocol server that auto-generates tools from Kigae's doctype registry.
Package net provides the Go-native HTTP server with TLS, multi-site routing, and all production middleware (security headers, CORS, rate limiting, CSRF).
Package net provides the Go-native HTTP server with TLS, multi-site routing, and all production middleware (security headers, CORS, rate limiting, CSRF).
Package notifications owns durable recipient-specific delivery attempts.
Package notifications owns durable recipient-specific delivery attempts.
sqlstore
Package sqlstore owns durable notification event receipts and delivery rows.
Package sqlstore owns durable notification event receipts and delivery rows.
Package numeric holds exact decimal values for Float, Currency and Percent fields.
Package numeric holds exact decimal values for Float, Currency and Percent fields.
Package org contains the provider-neutral organizational execution seam.
Package org contains the provider-neutral organizational execution seam.
Package orm — filter parsing utilities.
Package orm — filter parsing utilities.
Package outbox implements the transactional outbox for durable event delivery (RFC §8.1).
Package outbox implements the transactional outbox for durable event delivery (RFC §8.1).
Package payment models payment intents, providers and the request/confirm service.
Package payment models payment intents, providers and the request/confirm service.
mpesa
Package mpesa holds provider-pure Safaricom M-Pesa helpers.
Package mpesa holds provider-pure Safaricom M-Pesa helpers.
Package plugin implements provider binding via capability handles (PLUGIN-005): components bind to providers exclusively through PLUGIN-001 handles, so removing a provider degrades only its dependents.
Package plugin implements provider binding via capability handles (PLUGIN-005): components bind to providers exclusively through PLUGIN-001 handles, so removing a provider degrades only its dependents.
Package policy contains transport-neutral identity and authorization contracts.
Package policy contains transport-neutral identity and authorization contracts.
Package print defines print-format templates and renders them to text.
Package print defines print-format templates and renders them to text.
Package query parses and validates declarative published queries (D2).
Package query parses and validates declarative published queries (D2).
Package recon implements reconciliation primitives (RECON-001/002): a typed comparison between desired generations and observed state that produces deterministic drift records.
Package recon implements reconciliation primitives (RECON-001/002): a typed comparison between desired generations and observed state that produces deterministic drift records.
Package requests owns durable human requests and assignments.
Package requests owns durable human requests and assignments.
sqlstore
Package sqlstore owns SQL schema details for durable human requests.
Package sqlstore owns SQL schema details for durable human requests.
Package scheduler provides cron-based background job scheduling.
Package scheduler provides cron-based background job scheduling.
sqlstore
Package sqlstore persists scheduled definitions and their occurrences.
Package sqlstore persists scheduled definitions and their occurrences.
Package schema manages database schema migration.
Package schema manages database schema migration.
Package script provides the JavaScript runtime using goja (pure Go ES5.1+).
Package script provides the JavaScript runtime using goja (pure Go ES5.1+).
Package secret provides an encrypted key-value store for site-specific secrets (AI API keys, SMTP credentials, etc.).
Package secret provides an encrypted key-value store for site-specific secrets (AI API keys, SMTP credentials, etc.).
Package site manages site configuration and multi-tenancy.
Package site manages site configuration and multi-tenancy.
Package storage provides a pluggable backend for file attachments.
Package storage provides a pluggable backend for file attachments.
Package webhook provides the webhook delivery system for Kigae extensions.
Package webhook provides the webhook delivery system for Kigae extensions.
sqlstore
Package sqlstore persists immutable workflow definitions in a tenant DB.
Package sqlstore persists immutable workflow definitions in a tenant DB.
Package workspace provides the per-site workspace UI (config-driven SPA).
Package workspace provides the per-site workspace UI (config-driven SPA).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL