datly

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0

README

Datly 1.0

Go Reference Go 1.25.8

High-performance data APIs, graphs and workflows.

Keep database schemas, generated code and API contracts aligned. Datly's schema-aware transcription turns DQL and database metadata into typed Go shapes, resources and component contracts. Regenerate as projections and schemas evolve: carry type/nullability changes forward, remove generator-owned fields no longer projected, and preserve authored hooks and protected edits.

Datly is a programmable data application platform that connects databases, business logic and delivery. Compose typed data graphs across databases, orchestrate reads and mutations with scoped dependency injection, and expose the same application contracts through HTTP APIs and MCP tools for AI agents.

Build rich relational views, transactional workflows and composable analytical cubes. Extend their behavior with Go handlers, row-reading hooks, typed mutation hooks and lifecycle finalizers. Inputs, authorization predicates, validation and invocation capabilities flow through a shared execution model.

Datly's execution path combines compiled metadata, typed row processing and native SQLX readers with configurable caching, dedicated cache warmup and asynchronous jobs. Native timing records and optional OpenTelemetry export help you measure the workloads you actually run.

From a single endpoint to a data-driven service spanning multiple databases, Datly brings query execution, dependency injection, business workflows, analytics and API delivery into one programmable platform.

Start here: Programming model: DAO/service → components · DQL and grammar · Reader/writer hook flows · Generated mutators · Errors and output · Transcription · All guides

From DAO/service layers to generated components

A conventional application coordinates controllers, services, DAOs, SQL and DTOs. Datly makes the data contract and execution plan explicit, then generates the selected component artifacts while keeping business behavior in Go and scoped services.

Conventional application

sequenceDiagram
    participant API as HTTP controller
    participant Service as Application service
    participant DAO as DAO / repository
    participant DB as Database
    API->>Service: Map request and invoke business logic
    Service->>DAO: Request data or persist changes
    DAO->>DB: Execute SQL
    DB-->>DAO: Rows / write result
    DAO-->>Service: Map domain objects
    Service-->>API: Assemble response

Datly component

sequenceDiagram
    participant API as HTTP / MCP
    participant Component as Generated component
    participant Lifecycle as Application lifecycle
    participant DB as Configured databases
    Note over Component: Generated from DQL plus schema and/or Go types
    API->>Component: Bind typed input and scoped dependencies
    Component->>Lifecycle: Invoke callbacks for the selected operation
    Lifecycle-->>Component: Application behavior / validation
    Component->>DB: Execute the declared data graph
    DB-->>Component: Typed results / write outcome
    Component-->>API: Finalize and deliver output

The Datly diagram summarizes responsibilities; the reader and writer guides below show the exact callback order for each operation.

Concern Conventional DAO/service application Datly component model
Data contract SQL, DTOs and request mapping maintained across layers DQL/schema/type authority drives typed generation and regeneration
Reads DAO mapping plus service-side relationship assembly Declared views, typed data graphs and per-view query controls
Writes Application-managed comparison and persistence orchestration Explicit generated mutation policy or custom Go orchestration
Business behavior Services and callbacks Reusable services, scoped DI and typed hooks at defined phases
Database changes Manually reconcile query and DTO changes Re-transcribe, inspect protected generated diffs, rebuild and publish
Delivery Controller-specific endpoint integration Shared component contract exposed through HTTP and MCP

Reader and writer generation are separate choices. Datly does not automatically put both into one generated struct. Share domain contracts where appropriate and author each component for its own operation.

Explore the programming model · Read the DQL grammar · See reader and writer execution flows · Understand generated mutators and Has markers

Use it to:

  • Turn database queries into useful API responses. Return typed records, assembled child collections, and separate counts or bounds without writing a DAO and transport adapter for each endpoint.
  • Expose analytical views with controlled flexibility. Declare dimensions, measures, filters and selection rules; compose bounded cube queries for comparisons such as current versus previous spend.
  • Keep write behavior explicit. Combine sparse input, original identities, validation, sequencing, hooks and buffered DML in generated policies or custom handlers.
  • Reuse application contracts across HTTP and MCP. Select public packages, keep dependencies private, and describe the same input/output types in API metadata.
  • Make operational choices deliberately. Use native SQLX read caching, separately configured warmup queries, durable async services and native execution capture, with optional OpenTelemetry export.

Release preparation on the local v1 branch. This checkout uses the canonical github.com/viant/datly module and published github.com/viant/xdatly SDK v0.5.4-0.20260914204318-08752d9972c1, with pinned native dependencies. No Datly 1.0 release tag or published CLI version is claimed. The Go Reference badge links to the public module index; it may show an earlier published version. Status records integrated behavior and remaining release gates, including separate DQL destination and native dependency integration.

Try a typed API locally

This SQLite demo builds a custom application with a reader, a writer, input initialization and output finalization. datly build discovers components and links their types and factories internally. Authors do not maintain registration or import lists.

Prerequisites: this v1 checkout, Go 1.25.8, a C compiler for SQLite, Python 3 and curl. Dependencies use the exact published versions in go.mod. Run from datly:

export GOWORK=off
export GOTOOLCHAIN=go1.25.8
export DATLY_DEMO_DIR="$(python3 doc/examples/prepare-demo.py)"
go run ./cmd/datly init -dir "$DATLY_DEMO_DIR"
go -C "$DATLY_DEMO_DIR" list -mod=mod -deps ./... > /dev/null
go run ./cmd/datly build -dir "$DATLY_DEMO_DIR" -o bin/records
"$DATLY_DEMO_DIR/bin/records" run -conf "$DATLY_DEMO_DIR/config.json"

The setup script copies the checked-in project fixture to a new disposable directory, preserves exact dependency requirements and maps the unpublished Datly main module to this checkout. Its v0.0.0 main-module requirement is a local-only placeholder paired with an explicit replacement, not a downloadable version. The go list step resolves the application build graph; Go may raise that placeholder to satisfy dependency requirements while the explicit replacement continues to select this checkout. Configuration selects a package pattern for route exposure; component discovery and linking remain build-owned.

Leave the server running. In another terminal:

curl --fail-with-body http://127.0.0.1:8080/records/1
curl --fail-with-body -H 'Content-Type: application/json' \
  -d '{"data":{"id":2,"name":"second"}}' http://127.0.0.1:8080/records
curl --fail-with-body http://127.0.0.1:8080/records/2
curl --fail-with-body http://127.0.0.1:8080/v1/api/meta/openapi

GET returns rows containing the seeded record and then the inserted record. POST returns the record under data and finalized: true. Stop with Ctrl-C; the printed demo directory retains the source, configuration and database. The demo is an unauthenticated loopback application. Add your declared authorization policy before exposing business data.

Keep the source and resources available while running this executable: custom builds are source-backed. Embedding selected assets does not make the entire application a relocatable, source-free deployment. Quickstart details and project builds explain authoring and deployment.

The source baseline's integration acceptance covers real TCP reader/mutation endpoints and add/remove package rebuilds for the custom-build fixture. Release validation must repeat these paths against the selected published dependencies.

Choose how to author

Approach Best fit Start here
Go shapes and tags Existing domain types and compiled application hooks Readers, custom handlers
DQL with imported Go types SQL-centered authoring with reusable named contracts Source and generation
DQL with generated shapes and Go handlers A declared query or write graph that should produce typed artifacts Generation, mutations
Embedded application manager Application-owned service wiring and atomic reload Architecture, configuration

A complete DQL reader explicitly declares its package, input/output type names, a named typed output/view holder and the root row type(...). The holder binds the root result to the response field; global case_format('lc') gives the envelope and nested fields lowerCamel names. Naming an output type alone does not define that shape. See the complete Records reader and Orders reader with JSON output.

A component has typed input/output contracts and registered behavior. A view is one query-shaped dataset; relations connect datasets. A DerivedView computes another output from a parent query, while SelfReference describes an entity tree. Learn the model.

Guides

Build an API Operate and integrate
Quickstart Configuration and linked CLI
DQL, types, Go generation and regeneration AFS/Aerospike caching and warmup
Readers, relations, projections and hooks Async jobs, storage events and completion
Cubes, reports and composition Native observability and optional OTel
Mutations, validation, IDs and foreign keys HTTP and MCP
JWT inputs and authorization predicates OpenAPI and documentation resources
Custom handlers, bytes and finalizers Static content
Feature-to-skill coverage checklist Implementation status

The documentation index includes reading paths. The status and evidence guide explains what each example proves and which requested features still need implementation or integration.

Develop with Datly

The authoring skills provide focused reader, writer and custom-component workflows, with grammar, examples and acceptance references. They describe both current behavior and requested contracts; pending capabilities must be checked against the connected build.

Public authoring contracts belong to the matching xdatly SDK. Datly reuses Bindly for binding, viant/x for canonical type mechanics, and SQLX for typed reads, native caches and database primitives. Original Datly is the behavior and service-boundary reference; the 1.0 implementation separates immutable metadata from invocation state. Architecture and ownership explains these boundaries.

For contribution scope and quality rules, read CONTRIBUTING.md. Review and release evidence is maintained separately from these product guides.

License and notices

Datly is licensed under the Apache License 2.0. Preserve NOTICE and the attribution files described in third-party notices when redistributing source, binaries or generated authoring bundles. The separate xdatly SDK and native dependencies retain their own licenses.

Directories

Path Synopsis
Package application stages and atomically publishes complete executable generations.
Package application stages and atomically publishes complete executable generations.
authoring
readerbuilder
Package readerbuilder provides stateless, source-preserving DQL reader edits.
Package readerbuilder provides stateless, source-preserving DQL reader edits.
Package bootstrap owns package-authority component discovery and artifact composition.
Package bootstrap owns package-authority component discovery and artifact composition.
cacheconfig
Package cacheconfig creates native SQLX cache services from authored settings.
Package cacheconfig creates native SQLX cache services from authored settings.
connector
Package connector composes explicitly configured database/sql connections.
Package connector composes explicitly configured database/sql connections.
index
Package index owns the immutable bootstrap map from protocol identities to authored component sources.
Package index owns the immutable bootstrap map from protocol identities to authored component sources.
resources
Package resources loads manifest-declared package assets into the shared Bindly filesystem authority used by compilation and invocation.
Package resources loads manifest-declared package assets into the shared Bindly filesystem authority used by compilation and invocation.
routes
Package routes compiles canonical URI activation and protocol exposure metadata shared by DQL transcription and Go-package bootstrap.
Package routes compiles canonical URI activation and protocol exposure metadata shared by DQL transcription and Go-package bootstrap.
cmd
command
Package command provides executable standalone commands for stock and linked applications.
Package command provides executable standalone commands for stock and linked applications.
datly command
Package main provides Datly application-developer commands.
Package main provides Datly application-developer commands.
datly-developer command
Package main serves the Datly developer MCP service over stdio.
Package main serves the Datly developer MCP service over stdio.
Package constant owns immutable, application-supplied constant values.
Package constant owns immutable, application-supplied constant values.
Package data owns immutable reader projections over detached spec snapshots.
Package data owns immutable reader projections over detached spec snapshots.
Package docs resolves shared annotations without changing executable contracts.
Package docs resolves shared annotations without changing executable contracts.
example
reader
Package reader contains a package-authored Datly 1.0 reader example.
Package reader contains a package-authored Datly 1.0 reader example.
write
Package write contains a package-authored Datly 1.0 writer example.
Package write contains a package-authored Datly 1.0 writer example.
Package exec defines narrow execution ports consumed across Datly runtime and SQL ownership boundaries.
Package exec defines narrow execution ports consumed across Datly runtime and SQL ownership boundaries.
gateway
async
Package async adapts the original Datly .job storage-event transport to the durable jobs service.
Package async adapts the original Datly .job storage-event transport to the durable jobs service.
http
Package http adapts Datly runtime execution to HTTP transport.
Package http adapts Datly runtime execution to HTTP transport.
openapi
Package openapi generates OpenAPI 3.0.1 from compiled Datly registrations.
Package openapi generates OpenAPI 3.0.1 from compiled Datly registrations.
openapi/openapi3
Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0).
Adapted from viant/datly gateway/router/openapi/openapi3 (Apache-2.0).
internal
cmd/skillpack command
Package main implements skillpack, which reproducibly packages canonical skills for embedding.
Package main implements skillpack, which reproducibly packages canonical skills for embedding.
httpserver
Package httpserver owns shared listener defaults for HTTP and MCP.
Package httpserver owns shared listener defaults for HTTP and MCP.
packageasset
Package packageasset defines the shared generated-package asset descriptor.
Package packageasset defines the shared generated-package asset descriptor.
testfixture/castmodel
Package castmodel supplies imported rich Go shapes for CAST integration tests.
Package castmodel supplies imported rich Go shapes for CAST integration tests.
testharness
Package testharness provides test-only request, SQLite, and generated-module fixtures.
Package testharness provides test-only request, SQLite, and generated-module fixtures.
testharness/auth
Package auth supplies local RSA/JWT fixtures using the actual Datly verifier.
Package auth supplies local RSA/JWT fixtures using the actual Datly verifier.
testharness/devapp
Package devapp provides linked SQLite application fixtures for developer MCP tests.
Package devapp provides linked SQLite application fixtures for developer MCP tests.
testharness/genpatch
Package genpatch owns the shared high-level generation acceptance fixture.
Package genpatch owns the shared high-level generation acceptance fixture.
testharness/mcpclient
Package mcpclient runs real viant/mcp client/server transport tests.
Package mcpclient runs real viant/mcp client/server transport tests.
testharness/otlp
Package otlp provides a real protobuf HTTP collector for integration tests.
Package otlp provides a real protobuf HTTP collector for integration tests.
testharness/sqlite
Package sqlite provides shared SQLite fixtures and typed SQLX result verification for dependency-light data-driven tests.
Package sqlite provides shared SQLite fixtures and typed SQLX result verification for dependency-light data-driven tests.
mcp
Package mcp compiles route exposures into an immutable Datly MCP catalog and a fresh upstream protocol registry.
Package mcp compiles route exposures into an immutable Datly MCP catalog and a fresh upstream protocol registry.
developer
Package developer exposes explicitly configured authoring tools separately from Datly's business component catalog and runtime invocation engine.
Package developer exposes explicitly configured authoring tools separately from Datly's business component catalog and runtime invocation engine.
developer/skills
Package skills contains the complete canonical authoring skill snapshot.
Package skills contains the complete canonical authoring skill snapshot.
input
Package input projects compiled MCP payloads into canonical Bindly request providers.
Package input projects compiled MCP payloads into canonical Bindly request providers.
invocation
Package invocation adapts MCP calls to the protocol-neutral component port.
Package invocation adapts MCP calls to the protocol-neutral component port.
resource
Package resource compiles and resolves MCP resource route exposures.
Package resource compiles and resolves MCP resource route exposures.
server
Package server adapts a compiled Datly MCP service to the upstream protocol handler.
Package server adapts a compiled Datly MCP service to the upstream protocol handler.
tool
Package tool compiles route-effective component contracts into MCP tools.
Package tool compiles route-effective component contracts into MCP tools.
Package observability owns application-scoped native Datly counters and logs.
Package observability owns application-scoped native Datly counters and logs.
otel
Package otel exports completed native Datly records in one application-owned worker.
Package otel exports completed native Datly records in one application-owned worker.
plugins module
project
build
Package build owns custom project initialization and compilation.
Package build owns custom project initialization and compilation.
Package report derives ordinary cube components from canonical reader components without coupling derivation to MCP or duplicating reader execution.
Package report derives ordinary cube components from canonical reader components without coupling derivation to MCP or duplicating reader execution.
cubecompose
Package cubecompose validates and renders bounded compositions of typed cube queries.
Package cubecompose validates and renders bounded compositions of typed cube queries.
Package runtime owns registered-component lookup and small method/path dispatch into the unified handler engine.
Package runtime owns registered-component lookup and small method/path dispatch into the unified handler engine.
auth
Package auth configures the original Datly JWT verification contract for explicitly declared input codecs.
Package auth configures the original Datly JWT verification contract for explicitly declared input codecs.
differ
Package differ adapts native godiff comparisons to the public handler contract.
Package differ adapts native godiff comparisons to the public handler contract.
handler
Package handler defines invocation-facing binder and handler abstractions plus capability keys shared by the unified engine.
Package handler defines invocation-facing binder and handler abstractions plus capability keys shared by the unified engine.
handler/codec/structql
Package structql implements the built-in StructQL parameter codec.
Package structql implements the built-in StructQL parameter codec.
handler/compiler
Package compiler converts canonical component parameters and Go input types into immutable Bindly plans and codec bindings.
Package compiler converts canonical component parameters and Go input types into immutable Bindly plans and codec bindings.
handler/custom
Package custom adapts typed user-defined Go handlers to the shared runtime handler contract.
Package custom adapts typed user-defined Go handlers to the shared runtime handler contract.
handler/engine
Package engine owns the common invocation path shared by runtime handler flavors: one Bindly scope, one input plan, and one lifecycle.
Package engine owns the common invocation path shared by runtime handler flavors: one Bindly scope, one input plan, and one lifecycle.
handler/mutation
Package mutation adapts generated mutation programs to the canonical handler engine.
Package mutation adapts generated mutation programs to the canonical handler engine.
handler/provider
Package provider adapts runtime-owned values into Bindly providers.
Package provider adapts runtime-owned values into Bindly providers.
handler/reader
Package reader adapts a registered read execution to the unified handler engine without owning SQL plans, connections, caches, or mutable read state.
Package reader adapts a registered read execution to the unified handler engine without owning SQL plans, connections, caches, or mutable read state.
handler/velty
Package velty adapts cached typed Velty programs to the shared handler engine.
Package velty adapts cached typed Velty programs to the shared handler engine.
handler/writer
Package writer provides the metadata-driven built-in mutation handler.
Package writer provides the metadata-driven built-in mutation handler.
jobs
Package jobs owns durable scheduling over the original Datly DATLY_JOBS table.
Package jobs owns durable scheduling over the original Datly DATLY_JOBS table.
output
Package output compiles component output encoding independently of transport and delegates wire formats to their native codec owners.
Package output compiles component output encoding independently of transport and delegates wire formats to their native codec owners.
predicate/velty
Package velty compiles Datly predicate metadata into Velty-backed runtime evaluators exposed through the exec.PredicateEvaluator port.
Package velty compiles Datly predicate metadata into Velty-backed runtime evaluators exposed through the exec.PredicateEvaluator port.
registry
Package registry owns the registered-component carrier consumed by runtime lookup.
Package registry owns the registered-component carrier consumed by runtime lookup.
route
Package route owns immutable route metadata and pure method/path matching.
Package route owns immutable route metadata and pure method/path matching.
Package spec defines canonical authored and transcribed Datly metadata.
Package spec defines canonical authored and transcribed Datly metadata.
sql
Package sql owns stable SQL primitives shared by transcription, compilation, and execution: source resolution, projections, tables, connections, and trace identity.
Package sql owns stable SQL primitives shared by transcription, compilation, and execution: source resolution, projections, tables, connections, and trace identity.
builder
Package builder assembles reader SQL from resolved views, selectors, relations, partitions, templates, and dialect capabilities.
Package builder assembles reader SQL from resolved views, selectors, relations, partitions, templates, and dialect capabilities.
criteria
Package criteria validates client predicates using the SQL parser's AST and emits only approved columns, operators, and bound values.
Package criteria validates client predicates using the SQL parser's AST and emits only approved columns, operators, and bound values.
dml
Package dml provides the SQLX-backed buffered write and transaction scope.
Package dml provides the SQLX-backed buffered write and transaction scope.
fragment
Package fragment owns authored SQL predicate fragments and their ordered invocation bindings.
Package fragment owns authored SQL predicate fragments and their ordered invocation bindings.
macro
Package macro parses and expands Datly SQL macros such as ParentJoinOn, ParentKey, and parent NonWindowSQL access.
Package macro parses and expands Datly SQL macros such as ParentJoinOn, ParentKey, and parent NonWindowSQL access.
reader
Package reader owns immutable SQL read plans and SQLX-backed execution with fresh invocation sessions, typed rows, relations, partitions, hooks, and the native SQLX cache path.
Package reader owns immutable SQL read plans and SQLX-backed execution with fresh invocation sessions, typed rows, relations, partitions, hooks, and the native SQLX cache path.
reader/collector
Package collector owns reader-compiled relation graphs and typed row assembly.
Package collector owns reader-compiled relation graphs and typed row assembly.
reader/compiler
Package compiler converts canonical view metadata and typed contracts into immutable SQL reader plans.
Package compiler converts canonical view metadata and typed contracts into immutable SQL reader plans.
reader/provider
Package provider adapts SQL reader dependencies to Bindly providers.
Package provider adapts SQL reader dependencies to Bindly providers.
reader/readmeta
Package readmeta carries immutable evidence from actual typed SQL reads.
Package readmeta carries immutable evidence from actual typed SQL reads.
reader/rowcodec
Package rowcodec compiles column codecs into typed SQLX scan wrappers.
Package rowcodec compiles column codecs into typed SQLX scan wrappers.
sequencer
Package sequencer provides SQLX-backed identifier allocation.
Package sequencer provides SQLX-backed identifier allocation.
template
Package template owns compiled SQL-template programs.
Package template owns compiled SQL-template programs.
validation
Package validation combines native Go and SQL constraint checks for one invocation-scoped typed entity.
Package validation combines native Go and SQL constraint checks for one invocation-scoped typed entity.
Package standalone composes source-backed applications and owns their listeners.
Package standalone composes source-backed applications and owns their listeners.
config
Package config loads standalone configuration without opening listeners or databases.
Package config loads standalone configuration without opening listeners or databases.
Package tag owns Datly-specific Go struct-tag metadata.
Package tag owns Datly-specific Go struct-tag metadata.
Package transcribe owns authored source parsing, canonical component assembly, component-graph SQL resource traversal, and generated package production.
Package transcribe owns authored source parsing, canonical component assembly, component-graph SQL resource traversal, and generated package production.
column
Package column refines canonical view columns during explicit transcription.
Package column refines canonical view columns during explicit transcription.
compile
Package compile lowers prepared DQL into normalized transcribe plans.
Package compile lowers prepared DQL into normalized transcribe plans.
dql
Package dql implements focused DQL syntax parsing for the transcribe pipeline.
Package dql implements focused DQL syntax parsing for the transcribe pipeline.
dql/statement
Package statement segments preprocessed DQL into top-level SQL and Velty operations.
Package statement segments preprocessed DQL into top-level SQL and Velty operations.
generate
Package generate emits Go package artifacts from resolved transcribe products and type authority.
Package generate emits Go package artifacts from resolved transcribe products and type authority.
handler/ast
Package ast defines the target-neutral semantic tree used to generate Go and Velty handlers.
Package ast defines the target-neutral semantic tree used to generate Go and Velty handlers.
handler/compiler
Package compiler validates canonical component metadata and produces the target-neutral handler AST.
Package compiler validates canonical component metadata and produces the target-neutral handler AST.
handler/golang
Package golang lowers semantic handler transcription plans into Go AST.
Package golang lowers semantic handler transcription plans into Go AST.
handler/velty
Package velty lowers target-neutral handler transcription plans into Velty.
Package velty lowers target-neutral handler transcription plans into Velty.
Package typecatalog owns structural type lookup, resolution context, and layered package/generated/DQL type authority.
Package typecatalog owns structural type lookup, resolution context, and layered package/generated/DQL type authority.
xdatly module
xregistry
types/core module
types/custom module

Jump to

Keyboard shortcuts

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