Open-source type platform

One schema.
Every type in sync.

A schema-driven platform that generates and synchronizes types across your APIs, backends, and frontends from a single source of truth.

Production-ready MIT licensed Go single binary
typegenctl
$ typegenctl init # write typegen.yaml configuration generated $ typegenctl pull # fetch images typegen-server, typegen-ui $ typegenctl run stack running on :7359 $ typegenctl dashboard

Three components, one source of truth

Inconsistent schemas and hand-maintained models cause runtime errors and slow teams down. TypeGenerator centralizes generation so the database stays the authority across every layer.

The database is the single source of truth.

Define your schema once; TypeGenerator keeps every layer in sync from it.

Database schemaone authority
generates
TypeScript + Zod Java + mappers Go structs Python models
Deterministic Repeatable Safe by default Extensible

Typegenctl CLI

The control plane: a statically compiled, single-binary Go CLI.

  • Orchestrates the full system lifecycle
  • Validates configuration and runtime safety
  • The only required entry point

Typegen Server API

The execution engine for schema processing and generation.

  • Introspects databases and contracts
  • Generates language-specific types
  • Stateless and horizontally scalable

Typegen UI DASHBOARD

The visual layer for managing connections, schemas, and previewing output. Connects exclusively through the API.

Deterministic by design

Repeatable code generation you can trust in CI, built for long-term maintainability and operational safety.

Typegenctl controls the platform from one binary

Deterministic lifecycle management, configuration validation, and runtime inspection for both local development and production.

$curl -fsSL https://raw.githubusercontent.com/khanalsaroj/typegenctl/refs/heads/main/main/install.sh | bash

On Windows, install from PowerShell as Admin, then restart your terminal. Prefer no install? Run docker-compose up -d for the same platform. Binaries are on the Releases page.

getting started
typegenctl init       # generate typegen.yaml
typegenctl pull       # pull required images
typegenctl run        # start the service stack
typegenctl status     # check health and state
typegenctl dashboard  # open the UI in your browser
CommandDescription
initBootstrap the environment and generate typegen.yaml.
checkValidate configuration, prerequisites, and Docker availability.
pullFetch and verify required Docker images.
runStart the services (creates and starts containers).
start / stopStart stopped containers, or gracefully stop running ones.
restartRestart service containers.
statusInspect and report the current runtime state.
updatePull the latest images for the services.
cleanupRemove obsolete images and stopped containers.
self-updateUpdate the CLI to the latest released version.
dashboardOpen the Typegen UI in the browser.
Global and common flags
--config <path>Full path to the typegen.yaml file.
--jsonOutput results in JSON format.
--dry-runShow planned actions without executing them.
--version, -vPrint version information.
--frontend / --backendScope a command to one service, or set ports on init.
--force / --checkOverwrite config or reinstall; check for updates without installing.
typegen.yaml
services:
  frontend:
    image:
      name: ghcr.io/khanalsaroj/typegen-ui
      tag: latest
    container_name: Frontend
    port: { host: 7359, container: 80 }
    enabled: true

  backend:
    image:
      name: ghcr.io/khanalsaroj/typegen-server
      tag: latest
    container_name: Backend
    port: { host: 8049, container: 8080 }
    enabled: true
Typegen Server

The deterministic generation engine

Database introspection, validation, and deterministic code generation across languages and styles, with strict option schemas, security controls, and runtime validation.

What it generates

DatabasesMySQL / MariaDB, MSSQL, and PostgreSQL.
TypeScriptDTOs and Zod schemas.
JavaRecords, DTOs, and XML / annotation mappers.
Go and PythonStructs; Pydantic models, dataclasses, TypedDicts, plain classes.
OperationalRate limiting, CORS, and health-check endpoints.

Run it

docker
docker pull ghcr.io/khanalsaroj/typegen-server:latest

# or run the full stack
docker compose up -d
ServiceURL
Frontendhttp://localhost:7359
Backendhttp://localhost:8049

The server runs standalone, but the recommended path is managing its lifecycle with typegenctl and the dashboard for a safer control plane.

API reference

GET/api/v1/healthHealth check
{
  "status": "ok",
  "version": "v1.2.3",
  "uptime": 172800,
  "database": { "connected": true, "latency": 12 }
}
POST/api/v1/connection/testTest a DB connection
// Request
{
  "dbType": "postgres", "host": "localhost", "port": 5432,
  "username": "admin", "password": "securepassword",
  "schemaName": "public", "databaseName": "mydb"
}

// Response
{
  "connectionId": 123,
  "message": "Connection established successfully",
  "success": true, "pingMs": 15, "tablesFound": 3, "sizeMb": 42.7,
  "tables": [
    { "name": "users", "columnCount": 12 },
    { "name": "orders", "columnCount": 8 }
  ]
}
POST/api/v1/connectionCreate a connection
// Success
{
  "success": true,
  "message": "User fetched successfully",
  "connection": {
    "dbType": "postgres", "host": "localhost", "port": 5432,
    "username": "admin", "schemaName": "public", "databaseName": "mydb"
  }
}

// Error, HTTP 500
{ "success": false, "message": "Failed to create connection", "error": "user not found" }
GET/api/v1/connectionList connections
[
  { "connectionId": 101, "name": "main-db", "dbType": "postgres",
    "host": "localhost", "port": 5432, "databaseName": "mydb" },
  { "connectionId": 102, "name": "analytics-db", "dbType": "mysql",
    "host": "db.example.com", "port": 3306, "databaseName": "analytics" }
]
POST/api/v1/typeGenerate code types

The options object is dynamic; its fields depend on the chosen language and style. See the full options docs.

{
  "connectionId": 102,
  "options": {
    "getter": true, "setter": true, "builder": true, "data": true,
    "swaggerAnnotations": true, "jacksonAnnotations": true
  },
  "prefix": "Foo", "suffix": "Response",
  "style": "DTO", "language": "java",
  "tableNames": ["users", "orders"]
}
POST/api/v1/mapperGenerate mappers
{
  "connectionId": 123,
  "options": { "allCrud": true },
  "prefix": "Db", "suffix": "Type",
  "style": "struct", "language": "go",
  "tableNames": ["users", "orders"]
}

Typegen UI: a visual workflow on the platform

A React, TypeScript, and Vite interface for managing connections, exploring schemas, configuring options, and previewing generated output.

The UI is not a standalone application and should not be deployed independently. It is provisioned and controlled by Typegenctl, which coordinates its integration with the server.

Screens render from the repository assets under ./docs/assets/; copy them there to replace the labelled placeholders.

typegen-ui/
typegen-ui/
├── public/             # static assets
├── src/
│   ├── components/     # reusable UI (common, generator, ui)
│   ├── hooks/          # custom React hooks
│   ├── pages/          # page components (UI, Generator, Mapper)
│   ├── services/       # API clients and data services
│   ├── types/          # TypeScript type definitions
│   ├── App.tsx         # root component
│   └── main.tsx        # entry point
├── tailwind.config.ts  # Tailwind CSS configuration
└── vite.config.ts      # Vite configuration

System architecture

A clean separation between the control plane (typegenctl), the runtime plane (Docker), and the managed services.

Control flow

The CLI drives configuration, validation, planning, and reconciliation onto the Docker runtime.

graph TB
    User[Developer / Operator]
    subgraph ControlPlane["Typegen Control Plane"]
        CLI[typegenctl]
        Config[typegen.yaml]
        Validator[Schema and Policy Validator]
        Planner[Plan and Reconcile Engine]
        State[Local State Store]
    end
    subgraph RuntimePlane["Runtime Plane"]
        Docker[Docker Engine]
        Network[Container Network]
        Volumes[Persistent Volumes]
    end
    subgraph Services["Managed Services"]
        API[Typegen Server]
        Dashboard[Typegen UI]
    end
    User --> CLI
    CLI --> Config
    CLI --> Validator
    Validator --> Planner
    Planner --> State
    Planner --> Docker
    Docker --> Network
    Docker --> Volumes
    Docker --> API
    Docker --> Dashboard
          

Data flow

From init through reconciliation to runtime usage in the browser.

sequenceDiagram
    autonumber
    participant U as User
    participant CLI as typegenctl
    participant CFG as Config Loader
    participant VAL as Validator
    participant PLAN as Planner
    participant STATE as State Store
    participant RT as Runtime (Docker)
    participant UI as Typegen UI
    participant API as Typegen Server
    U ->> CLI: typegenctl init
    CLI ->> CFG: Create typegen.yaml
    CFG -->> CLI: Raw config
    CLI ->> VAL: Validate ports and pull images
    VAL -->> CLI: Validated config
    CLI ->> PLAN: Compute desired state
    PLAN ->> STATE: Load current state
    STATE -->> PLAN: Existing resources
    PLAN -->> CLI: Execution plan
    CLI ->> RT: Reconcile runtime
    RT -->> CLI: Containers running
    CLI ->> STATE: Persist new state
    CLI -->> U: Platform ready
    U ->> UI: Open Dashboard (browser)
    UI ->> API: Generate schemas and types
    API -->> UI: Generated artifacts
    UI -->> U: Visual feedback and downloads
          

Request routing

Nginx serves the static UI and reverse-proxies /api/* to the backend.

flowchart LR
    Browser["User Browser"]
    Host["Host Machine (Server / Windows)"]
    subgraph Docker["Docker Network"]
        Nginx["Nginx (typegen-ui:80)"]
        Frontend["Static Files"]
        Backend["API Endpoints (typegen-server:8080)"]
    end
    Browser -->|http://localhost:7359| Host
    Host -->|port 7359 to 80| Nginx
    Nginx -->|serve static UI| Frontend
    Nginx -->|reverse proxy /api| Backend
          

What's next on the roadmap

Where TypeGenerator is headed across languages, generation, and tooling.

Platform and language support

More database connections (Oracle, SQLite, MongoDB) and target languages: Kotlin, Python, and Go.

DTO and type generation

Expanded customization with control over naming, structure, and type mapping; smart defaults with full override.

AI-assisted features

Naming suggestions and context-aware type inference for models, fields, and types.

CLI improvements

Custom file names and flexible directories; discover all .typegen.yaml files and generate across every service in one run.

Testing

Test cases from the next release, covering DTO generation, CLI behavior, and multi-service execution.

Operational safety

Continued focus on deterministic, repeatable workflows for local development and production.