kora

command module
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 5 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

Kora — Config-Driven Application Engine

Kora is currently a DocType-centric application runtime with a real kernel, typed contracts, workflow runtime, AI/MCP surfaces, cloud primitives, and a React admin UI. The original RFC is broader than the codebase today, so this repository should be read as an implemented platform plus target-state architecture notes, not a finished match to the RFC.

Docker Hub GitHub

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 chat widget with tool execution over the current contract surface. 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, MariaDB, or remote LibSQL are implemented. PostgreSQL/MySQL parity work is intentionally excluded from this audit.
  • 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).
  • Shared AI Keys — superadmins can set global AI provider keys so new sites can use AI chat immediately. Toggle with KORA_SHARED_AI_ENABLED.
  • Swagger/OpenAPI — auto-generated API docs at /api/swagger-ui.
  • Mobile Responsive — tables become stacked cards in the current React UI.
  • Extensibility — JS runtime, event hooks, webhook extensions, custom API methods, workflow actions, scheduled scripts, computed fields. This surface is constrained and permission-gated, not a free-form plugin system.
  • 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.
  • Cloud Boundary — Cloud is a control plane for deployment, package rollout, worker placement, NATS validation, backups, observability, billing, and deletion workflows. Tenant business truth remains in the engine/site databases.
  • Cloud Ownership — the proprietary Cloud implementation lives in the sibling kora-cloud repo; this repo only keeps the engine-facing seam, local site lifecycle, and shared contracts.

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
workflow.actor supported
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, AI/MCP surfaces, and cloud primitives are real, but they only partially cover the original RFC.
  • Cloud implementation lives in the sibling kora-cloud repository. It owns deployment orchestration and runtime management, but not tenant business truth or site schema source of truth.
  • The RFC in this repository should be treated as the target architecture and gap reference.
  • PostgreSQL/MySQL parity work is excluded from the current implementation backlog and audit notes.

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 or libsql
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_SHARED_AI_ENABLED false Enable shared AI provider keys for all sites
KORA_SHARED_OPENAI_API_KEY — Shared OpenAI key (fallback when site has none)
KORA_SHARED_DEEPSEEK_API_KEY — Shared DeepSeek key
KORA_SHARED_ANTHROPIC_API_KEY — Shared Anthropic key
KORA_SCRIPTS_ENABLED false Enable JS script engine for extensions
KORA_SCRIPTS_MAX_RAM 64 Max RAM per script (MB)
KORA_ANALYTICS false Enable analytics event bus and rollup tables
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 Kora 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
  • Workflows — state machine editor
  • 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, workflows, permissions, roles

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 — Kora Fieldwork Sample Application

This is the entry point for the Kora Fieldwork app. It starts the Kora 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/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
Package analytics provides the dynamic, per-site analytics engine for Kora.
Package analytics provides the dynamic, per-site analytics engine for Kora.
api
Package api provides shared schema mapping from Kora field types to JSON Schema.
Package api provides shared schema mapping from Kora 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).
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 Kora Engine execution fabric.
Package contract defines the provider-neutral, versioned messaging contracts for the Kora 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 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 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 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 mcp provides a Model Context Protocol server that auto-generates tools from Kora's doctype registry.
Package mcp provides a Model Context Protocol server that auto-generates tools from Kora'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 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 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 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 scheduler provides cron-based background job scheduling.
Package scheduler provides cron-based background job scheduling.
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 Kora extensions.
Package webhook provides the webhook delivery system for Kora extensions.
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