Documentation
¶
Overview ¶
Package lidza is the runtime a Līdza application links against. The app's main.go embeds its frontend build and calls Run; `lidza dev` starts the same binary in dev mode with the frontend proxied from its dev server.
Index ¶
- Constants
- func DirFS(dir string) (fs.FS, error)
- func HTTPClient(ctx context.Context) *http.Client
- func Handler(app App) (http.Handler, error)
- func Log(ctx context.Context) *slog.Logger
- func NewLogger() *slog.Logger
- func Now(ctx context.Context) time.Time
- func Optional[T any](ctx context.Context) (T, bool)
- func Provide[T any](s *Services, v T)
- func Reconfigure(ctx context.Context, s *Services) error
- func Run(app App)
- func Serve(ctx context.Context, app App) error
- func Service[T any](ctx context.Context) T
- func Sub(fsys fs.FS, dir string) fs.FS
- func WithServices(ctx context.Context, s *Services) context.Context
- type App
- type Booted
- type Clock
- type Head
- type HeadMeta
- type LocaleNegotiator
- type Middlewarer
- type Pack
- type RealClock
- type Reconfigurable
- type Services
- type TLSHost
- type TLSRefusal
- type TLSReporter
- type TLSSnapshot
- type Tool
Constants ¶
const ( MetricsPath = "/metrics" HealthzPath = "/healthz" ReadyzPath = "/readyz" // TLSAllowPath answers a TLS terminator in front of the binary // (Caddy's on-demand TLS "ask") whether a hostname may get a // certificate: GET /tls-allow?domain=<host> is 200 for a name in // LIDZA_TLS_DOMAINS or one App.TLSHosts approves, 404 otherwise. It // is served when the app has either, and like /metrics it is for // the operator: keep it off the public side of the proxy. TLSAllowPath = "/tls-allow" )
Paths every app serves besides /api and the frontend.
const ( // EnvLog selects the format: "json" or "text". Default: text under // lidza dev and lidza test, json otherwise. EnvLog = "LIDZA_LOG" // EnvLogLevel is debug, info, warn or error; default info. EnvLogLevel = "LIDZA_LOG_LEVEL" )
Logging environment.
const ( // EnvTLSDomains lists the domains to serve, comma-separated; the first // is the app's public name (APP_URL when unset). EnvTLSDomains = "LIDZA_TLS_DOMAINS" // EnvTLSEmail is the ACME account contact (expiry warnings). EnvTLSEmail = "LIDZA_TLS_EMAIL" // EnvTLSAddr and EnvTLSHTTPAddr are the HTTPS and HTTP listen // addresses, :443 and :80 by default. EnvTLSAddr = "LIDZA_TLS_ADDR" EnvTLSHTTPAddr = "LIDZA_TLS_HTTP_ADDR" // EnvTLSCacheDir stores certificates on disk instead of Postgres: // one node only. EnvTLSCacheDir = "LIDZA_TLS_CACHE_DIR" // EnvTLSDirectory is the ACME directory URL; Let's Encrypt by // default, its staging directory for rehearsals. EnvTLSDirectory = "LIDZA_TLS_DIRECTORY" )
TLS from the environment: with LIDZA_TLS_DOMAINS set the binary serves HTTPS itself, with certificates from Let's Encrypt (ACME) obtained and renewed by golang.org/x/crypto/acme/autocert, and answers plain HTTP only to redirect to HTTPS and to prove domain ownership. No proxy is needed in front. The certificates live in Postgres through the db pack, so every node of the app shares them, as the stateless rule requires; a single node without the db pack names a directory in LIDZA_TLS_CACHE_DIR instead.
const ( // EnvMCP set to "stdio" makes the binary serve its tools over stdio // instead of HTTP; `lidza mcp` uses it. EnvMCP = "LIDZA_MCP" // EnvMCPToken enables /mcp on the running binary for clients that // send it as a bearer token. EnvMCPToken = "LIDZA_MCP_TOKEN" //nolint:gosec // G101: a setting's name, not its value // MCPPath is the Streamable HTTP endpoint. MCPPath = "/mcp" )
Environment for app tools.
const DefaultStreamTimeout = 10 * time.Minute
DefaultStreamTimeout is the deadline for streamed operations and WebSockets.
const DefaultTimeout = 30 * time.Second
DefaultTimeout is the per-request deadline for API handlers.
const SecurityTxtPath = "/.well-known/security.txt"
SecurityTxtPath is where the app says how to report a vulnerability (RFC 9116), served when SECURITY_CONTACT is set.
Variables ¶
This section is empty.
Functions ¶
func DirFS ¶
DirFS serves a directory on disk as an fs.FS that cannot leave it: a symlink inside pointing elsewhere, or any path that would escape, is refused (os.Root). For App.Dist from disk instead of the embedded build; os.DirFS follows symlinks out of the directory.
func HTTPClient ¶
HTTPClient returns the client for outbound HTTP calls: the services' http.RoundTripper (a recorder or replayer under test) behind a 30-second timeout, or a plain client. Handlers use it for every external call so tests run offline against recorded fixtures.
func Handler ¶
Handler builds the app's http.Handler: the API router under /api with the standard pipeline and, for every other path, the proxy to the frontend dev server (dev mode), the embedded build, or the app's own Frontend. Packs are not started; Serve does that.
func Log ¶
Log returns the app logger for a request, with the request id attached so every line of one request can be found together. Outside a request it is the app logger.
func Now ¶
Now returns the current time from the clock in ctx (the services' Clock, or the real one). Handlers use it instead of time.Now so a test can freeze or advance time.
func Optional ¶
Optional returns the T provided at start and whether there is one: for code that adapts to which packs are enabled (the admin pages).
func Provide ¶
Provide registers v under its static type T. Providing the same type twice replaces the first value.
func Reconfigure ¶
Reconfigure asks every service that can to read its configuration again. Every error is returned, joined.
func Run ¶
func Run(app App)
Run serves the app until SIGINT or SIGTERM and exits the process with a non-zero status on error. Configuration comes from the environment:
LIDZA_ADDR listen address, default 127.0.0.1:3000
LIDZA_MODE "dev" to proxy the frontend instead of serving Dist
LIDZA_FRONTEND_URL the frontend dev server (dev mode; set by `lidza dev`)
LIDZA_TRUSTED_PROXIES proxies whose X-Forwarded-For counts (IPs,
CIDRs, loopback, private); ClientIP resolves
through them
LIDZA_TLS_DOMAINS serve HTTPS on :443 for these domains with Let's
Encrypt certificates (stored in Postgres through the
db pack), redirect :80; APP_URL and AUTH_COOKIE_SECURE
follow unless set (see tls.go)
func Serve ¶
Serve is Run without the process exit: it blocks until ctx is cancelled or a termination signal arrives, then shuts the server down.
func Service ¶
Service returns the T provided at start. A missing service is a wiring mistake, not a runtime condition, so it panics with the type name.
Types ¶
type App ¶
type App struct {
// Name is shown in logs.
Name string
// Dist is the built frontend, served in production. Nil for templates
// without a static build.
Dist fs.FS
// Frontend serves every non-API path when there is no Dist (the htmx
// template renders pages in Go). Ignored while the dev proxy is active.
Frontend http.Handler
// Routes registers the app's API handlers. May be nil.
Routes func(r *router.Router)
// Middleware wraps the whole app, API and frontend alike, outermost
// first. The API router already runs request ids, logging, panic
// recovery and the timeout; add CORS or auth here or with router.Use.
Middleware []middleware.Middleware
// Timeout is the deadline every API request's context gets; default
// DefaultTimeout.
Timeout time.Duration
// StreamTimeout is the deadline of a streamed operation or WebSocket
// (router.Stream, asked for with Accept: text/event-stream, as the
// generated clients do); default DefaultStreamTimeout. A model's
// answer streams for longer than a JSON reply takes.
StreamTimeout time.Duration
// CSP is the Content-Security-Policy sent with every response. Empty
// sends middleware.DefaultCSP, except in dev mode (LIDZA_MODE=dev),
// where Vite's dev server needs inline scripts and none is sent;
// middleware.AddCSP extends it for another origin (a script CDN, an
// image host). middleware.NoCSP sends none anywhere. A value set here
// is sent in dev mode too.
CSP string
// PermissionsPolicy is the Permissions-Policy sent with every
// response. Empty sends middleware.DefaultPermissionsPolicy (camera,
// microphone and location off); an app that asks for the visitor's
// location sets middleware.AllowGeolocation.
PermissionsPolicy string
// HSTS is the Strict-Transport-Security value. Empty sends
// middleware.DefaultHSTS outside dev mode when APP_URL is https://
// (as LIDZA_TLS_DOMAINS sets it), and none otherwise;
// middleware.HSTSSubdomains covers the subdomains too, and
// middleware.NoHSTS sends none.
HSTS string
// Head sets the <head> of each page served from Dist (the shell and
// the prerendered pages, the SSR sidecar's and, under lidza dev, the
// dev server's): title, description, canonical address, social tags
// and JSON-LD, per request. A route with a parameter is one shell for
// every address until Head names it. Return false to leave a page as
// built. See Head.
Head func(r *http.Request) (Head, bool)
// Logger receives request and error logs. Default: NewLogger from
// LIDZA_LOG and LIDZA_LOG_LEVEL, also installed as slog's default so
// packs log the same way. Handlers use lidza.Log(ctx).
Logger *slog.Logger
// Packs are started in order before OnStart and stopped in reverse
// after OnShutdown. packs.go, generated from lidza.json, lists them.
Packs []Pack
// Tools are the app's MCP tools (see Tool); tools.go lists them.
Tools []Tool
// OnStart runs after the packs and before the listener opens: connect
// what the packs do not, warm caches, Provide services. An error
// aborts the start.
OnStart func(ctx context.Context, s *Services) error
// OnReady runs once the app is listening.
OnReady func()
// OnShutdown runs after in-flight requests finished, before exit:
// close pools, flush queues.
OnShutdown func(ctx context.Context) error
// TLSHosts approves a hostname beyond LIDZA_TLS_DOMAINS for a
// certificate (a customer's own domain the app serves): nil approves
// it, an error refuses it; a nil TLSHosts approves none. It is asked
// during TLS handshakes, ACME challenges and before every certificate
// order, renewals included, with the services in ctx (db.From works);
// the verdict is cached per node, an approval 5 minutes and a refusal
// 1 minute, so a host the app stops approving is refused within 5
// minutes and never renewed. Certificates live in the same shared
// cache as the listed domains'. Requests on an approved host reach the
// whole app, as on a listed domain: a path outside /api is served
// with r.Mount, and a middleware that checks r.Host keeps the rest
// (the frontend, /api) to the app's own domains. Behind a terminator
// that issues certificates itself, TLSAllowPath asks it the same way.
TLSHosts func(ctx context.Context, host string) error
// PrivateTLS serves the normal LIDZA_ADDR listener using explicit TLS1.3
// and required verified client certificates (for a trusted gateway). Build
// it with gateway.ServerTLS. It is mutually exclusive with ACME TLS and
// opens no plaintext fallback. Gateway evidence still needs route middleware;
// a backend TLS handshake alone does not prove original-client transport.
PrivateTLS *tls.Config
// PrivateTLSAddr optionally opens PrivateTLS on a second listener instead of
// LIDZA_ADDR, retaining the ordinary listener for internal HTTP services.
// Sensitive routes must enforce gateway.Verify on both listeners; the
// ordinary listener never acquires verified gateway evidence implicitly.
PrivateTLSAddr string
// ReadyTimeout bounds the checks behind /readyz; default 3s.
ReadyTimeout time.Duration
}
App describes one application.
type Booted ¶
type Booted struct {
Handler http.Handler
Services *Services
// contains filtered or unexported fields
}
Booted is an app with its packs started and its handler built, not yet listening: what Serve runs and what tests drive through lidzatest.
type Clock ¶
Clock is where the app reads the time, so tests can set it. The real clock is the default; lidzatest provides a controllable one.
type Head ¶
Head is a page's head as the App.Head hook sets it: Title, Description, Canonical, Image, Type, SiteName, NoIndex, Meta, JSONLD and Status (devserver.Head documents each).
Head: func(r *http.Request) (lidza.Head, bool) {
id, ok := strings.CutPrefix(r.URL.Path, "/products/")
if !ok {
return lidza.Head{}, false
}
p, err := queries.New(db.From(r.Context())).GetProduct(r.Context(), id)
if err != nil {
return lidza.Head{Title: "Not found", NoIndex: true, Status: http.StatusNotFound}, true
}
return lidza.Head{Title: p.Name, Description: p.Summary, Canonical: "https://example.com/products/" + id}, true
},
type LocaleNegotiator ¶
LocaleNegotiator is implemented by packs that pick a request's locale, such as i18n: the embedded build serves the page prerendered in that locale (dist/.locales). It returns "" before the pack has started.
type Middlewarer ¶
type Middlewarer interface {
Middleware() middleware.Middleware
}
Middlewarer is implemented by packs that wrap every API request, such as i18n's locale negotiation. The middleware resolves the running pack from the request context, so it may be built before Start.
type Pack ¶
type Pack interface {
Name() string
Start(ctx context.Context, s *Services) error
Stop(ctx context.Context) error
}
Pack is a unit the app starts and stops: an official or local pack. Start registers whatever it offers (a pool, a client) with Provide.
type Reconfigurable ¶
Reconfigurable is a pack that can read its configuration again while the app runs: after a credential is saved from the admin pages, the mail, llm and storage packs pick up the new provider or key without a restart.
type Services ¶
type Services struct {
// contains filtered or unexported fields
}
Services holds what packs and OnStart provide, keyed by static type, and hands it to handlers through the request context. It is filled at start and read-only afterwards.
func ServicesFrom ¶
ServicesFrom returns the services in ctx, nil outside the app.
type TLSHost ¶
TLSHost is a hostname with the certificate expiry last seen (zero before the first handshake) and, for a host the hook approved, when.
type TLSRefusal ¶
TLSRefusal is a hostname refused a certificate, and why.
type TLSReporter ¶
type TLSReporter interface {
Snapshot() TLSSnapshot
}
TLSReporter is what this node's TLS server knows about its hostnames, for the admin pages: the listed domains, the hosts App.TLSHosts approved, each with the expiry of the certificate last served, and the latest refusals. It is provided as a service while the binary serves TLS itself.
type TLSSnapshot ¶
type TLSSnapshot struct {
Domains []TLSHost
Approved []TLSHost
Refused []TLSRefusal
}
TLSSnapshot is a copy of the status.
type Tool ¶
type Tool struct {
Name string
Description string
// Input is a value of the input type; its JSON Schema is derived from
// the Go type. nil means no input.
Input any
// Handler receives the raw JSON input and returns a JSON-encodable
// result or an error the caller sees.
Handler func(ctx context.Context, input json.RawMessage) (any, error)
// ReadOnly says the tool changes nothing (a lookup, a report): an
// agent's client may run it without asking.
ReadOnly bool
// Destructive says the tool can lose data (a delete, an overwrite).
// A tool marked neither counts as one that may.
Destructive bool
}
Tool is an MCP tool the app defines: a name, a description, a JSON input and a handler that runs with the app's services (packs, clock, logger) in its context. `lidza mcp` exposes app tools next to the framework's; with LIDZA_MCP_TOKEN set, the running binary serves them at /mcp (Streamable HTTP) to agents that present the token.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
lidza
command
Command lidza is the Līdza CLI.
|
Command lidza is the Līdza CLI. |
|
packs
|
|
|
admin
Package admin serves the app's admin pages at /admin: an overview with a setup checklist, users, the credentials of the sign-in, mail, language-model and storage providers (saved sealed with the master key and applied without a restart) plus the app's own (Options.Sections), token usage, the mail outbox, jobs and stored files.
|
Package admin serves the app's admin pages at /admin: an overview with a setup checklist, users, the credentials of the sign-in, mail, language-model and storage providers (saved sealed with the master key and applied without a restart) plus the app's own (Options.Sections), token usage, the mail outbox, jobs and stored files. |
|
analytics
Package analytics is the official, opt-in error reporting and product analytics pack.
|
Package analytics is the official, opt-in error reporting and product analytics pack. |
|
audit
Package audit is the official audit log pack: a durable record of who did what to which resource, when, and how it went, for an app's own routes and jobs.
|
Package audit is the official audit log pack: a durable record of who did what to which resource, when, and how it went, for an app's own routes and jobs. |
|
auth
Package auth is the official authentication pack: password hashing (argon2id), signed access tokens (JWT HS256, short-lived), refresh sessions in Postgres (revocable, survive restarts), cookies for browsers and a bearer header for other clients, and the middleware that puts the user in the request context.
|
Package auth is the official authentication pack: password hashing (argon2id), signed access tokens (JWT HS256, short-lived), refresh sessions in Postgres (revocable, survive restarts), cookies for browsers and a bearer header for other clients, and the middleware that puts the user in the request context. |
|
billing
Package billing is the official payments pack, on Stripe: an owner (a workspace, a user) subscribes to one of the app's plans through Stripe Checkout, manages it in Stripe's customer portal, and the app checks what the plan grants with Has.
|
Package billing is the official payments pack, on Stripe: an owner (a workspace, a user) subscribes to one of the app's plans through Stripe Checkout, manages it in Stripe's customer portal, and the app checks what the plan grants with Has. |
|
cache
Package cache is the official cache pack: string keys with TTL on Valkey (or Redis), Remember for the read-through pattern and Incr for counters every node shares (a rate limit, a quota).
|
Package cache is the official cache pack: string keys with TTL on Valkey (or Redis), Remember for the read-through pattern and Incr for counters every node shares (a rate limit, a quota). |
|
db
Package db is the official database pack: a bounded pgx pool from DATABASE_URL, migrations from db/migrations, and the sqlc configuration `lidza pack add db` writes so queries in db/queries become typed Go.
|
Package db is the official database pack: a bounded pgx pool from DATABASE_URL, migrations from db/migrations, and the sqlc configuration `lidza pack add db` writes so queries in db/queries become typed Go. |
|
hooks
Package hooks is the official outbound webhooks pack: an app sends events to the URLs its users (or the app itself) subscribe, signed with the Standard Webhooks scheme (webhook-id, webhook-timestamp, webhook-signature; pkg/webhook.Standard verifies it), delivered in the background through the jobs pack with retries over about eleven hours, each attempt logged.
|
Package hooks is the official outbound webhooks pack: an app sends events to the URLs its users (or the app itself) subscribe, signed with the Standard Webhooks scheme (webhook-id, webhook-timestamp, webhook-signature; pkg/webhook.Standard verifies it), delivered in the background through the jobs pack with retries over about eleven hours, each attempt logged. |
|
i18n
Package i18n is the official localization pack: message catalogs from locales/<lang>.json embedded in the binary, locale negotiation per request (query, cookie, Accept-Language), and formatting of numbers, currency and dates for the locale.
|
Package i18n is the official localization pack: message catalogs from locales/<lang>.json embedded in the binary, locale negotiation per request (query, cookie, Accept-Language), and formatting of numbers, currency and dates for the locale. |
|
jobs
Package jobs is the official background work pack: a Postgres-backed queue (the job table from schema.lidza) with a bounded set of workers per node, retries with backoff, recurring schedules (Schedule), recovery of jobs whose worker died, and release of unfinished jobs at shutdown.
|
Package jobs is the official background work pack: a Postgres-backed queue (the job table from schema.lidza) with a bounded set of workers per node, retries with backoff, recurring schedules (Schedule), recovery of jobs whose worker died, and release of unfinished jobs at shutdown. |
|
llm
Package llm is the language-model pack: one Chat, Stream, Embed, Generate and Run over Anthropic, OpenAI, Google and Ollama, spoken directly over HTTP, plus a fake provider for tests.
|
Package llm is the language-model pack: one Chat, Stream, Embed, Generate and Run over Anthropic, OpenAI, Google and Ollama, spoken directly over HTTP, plus a fake provider for tests. |
|
mail
Package mail is the official transactional email pack: one Send behind which a provider delivers (Mailgun, SendGrid, Postmark, Resend, SMTP), or the message is logged or kept in the outbox for development and tests.
|
Package mail is the official transactional email pack: one Send behind which a provider delivers (Mailgun, SendGrid, Postmark, Resend, SMTP), or the message is logged or kept in the outbox for development and tests. |
|
realtime
Package realtime is the official WebSocket pack: clients subscribe to topics over one connection at GET /api/v1/realtime, handlers publish JSON to topics, and a Valkey bus fans messages out across nodes so the app stays stateless.
|
Package realtime is the official WebSocket pack: clients subscribe to topics over one connection at GET /api/v1/realtime, handlers publish JSON to topics, and a Valkey bus fans messages out across nodes so the app stays stateless. |
|
storage
Package storage is the file storage pack: one Put, Get, Stat, List, Delete and presigned URLs over any S3-compatible service (AWS S3, MinIO, Cloudflare R2, Backblaze B2, Wasabi, DigitalOcean Spaces) spoken directly with Signature V4 over HTTP, and a local provider that keeps files in a directory for development and tests.
|
Package storage is the file storage pack: one Put, Get, Stat, List, Delete and presigned URLs over any S3-compatible service (AWS S3, MinIO, Cloudflare R2, Backblaze B2, Wasabi, DigitalOcean Spaces) spoken directly with Signature V4 over HTTP, and a local provider that keeps files in a directory for development and tests. |
|
pkg
|
|
|
apidoc
Package apidoc renders the framework's public Go API from its sources as the app resolves them (its go.mod, replace directives included), so an agent reads the signatures it can call instead of guessing them.
|
Package apidoc renders the framework's public Go API from its sources as the app resolves them (its go.mod, replace directives included), so an agent reads the signatures it can call instead of guessing them. |
|
brief
Package brief is an app's brief: what it is for, who owns the data, how it looks, which services it uses, where it runs and how agents work on it, answered by the people who own the app.
|
Package brief is an app's brief: what it is for, who owns the data, how it looks, which services it uses, where it runs and how agents work on it, answered by the people who own the app. |
|
civil
Package civil holds dates and times as people write them, with no time zone: Date is a calendar day (a schema.lidza date field, a Postgres date column), DateTime a wall-clock time as a form's date-time input sends it (a schema.lidza localtime field).
|
Package civil holds dates and times as people write them, with no time zone: Date is a calendar day (a schema.lidza date field, a Postgres date column), DateTime a wall-clock time as a form's date-time input sends it (a schema.lidza localtime field). |
|
config
Package config reads lidza.json, the per-project configuration.
|
Package config reads lidza.json, the per-project configuration. |
|
configref
Package configref builds docs/configuration.md, the reference of every setting a Līdza app reads, from the framework's source: the env tags of the packs' Config structs, the Env constants, and the settings read by name, each with its doc comment.
|
Package configref builds docs/configuration.md, the reference of every setting a Līdza app reads, from the framework's source: the env tags of the packs' Config structs, the Env constants, and the settings read by name, each with its doc comment. |
|
configref/gen
command
Command gen writes docs/configuration.md from the framework's source (go generate ./pkg/configref).
|
Command gen writes docs/configuration.md from the framework's source (go generate ./pkg/configref). |
|
credentials
Package credentials keeps an app's secrets encrypted at rest: config/credentials.yml.enc holds KEY: value pairs sealed with AES-256-GCM under the master key in config/master.key (never committed) or LIDZA_MASTER_KEY (production).
|
Package credentials keeps an app's secrets encrypted at rest: config/credentials.yml.enc holds KEY: value pairs sealed with AES-256-GCM under the master key in config/master.key (never committed) or LIDZA_MASTER_KEY (production). |
|
crud
Package crud generates a resource from a schema.lidza model: the sqlc queries, the Create and Update types, a handlers file with the five typed routes, and the registration in routes.go.
|
Package crud generates a resource from a schema.lidza model: the sqlc queries, the Create and Update types, a handlers file with the five typed routes, and the registration in routes.go. |
|
decimal
Package decimal is the Go type of a schema.lidza decimal(p, s) field, a Postgres numeric(p, s) column: an exact decimal number kept as its text, "12.50", never as a float.
|
Package decimal is the Go type of a schema.lidza decimal(p, s) field, a Postgres numeric(p, s) column: an exact decimal number kept as its text, "12.50", never as a float. |
|
decisions
Package decisions keeps an app's decision log, docs/decisions.md: why the app is built the way it is (a pack added, Rust chosen for a module, a dependency taken, a schema tradeoff), one dated entry each, written by people and agents alike and read before working in those areas.
|
Package decisions keeps an app's decision log, docs/decisions.md: why the app is built the way it is (a pack added, Rust chosen for a module, a dependency taken, a schema tradeoff), one dated entry each, written by people and agents alike and read before working in those areas. |
|
devserver
Package devserver is the Līdza dev server: the reverse proxy that puts the Go control plane and the frontend dev server behind one port, the static file server used in production, and the coordinator that keeps the app binary rebuilt while `lidza dev` runs.
|
Package devserver is the Līdza dev server: the reverse proxy that puts the Go control plane and the frontend dev server behind one port, the static file server used in production, and the coordinator that keeps the app binary rebuilt while `lidza dev` runs. |
|
diag
Package diag runs the checkers for every layer of a Līdza project (Go, Rust, frontend) and merges their output into one list of diagnostics with a layer, file, line and message each.
|
Package diag runs the checkers for every layer of a Līdza project (Go, Rust, frontend) and merges their output into one list of diagnostics with a layer, file, line and message each. |
|
engine
Package engine runs pack WASM modules in wazero: a module compiled once, a bounded pool of pre-warmed instances, and calls with a deadline that pass JSON through linear memory (the ABI in core/src/abi.rs).
|
Package engine runs pack WASM modules in wazero: a module compiled once, a bounded pool of pre-warmed instances, and calls with a deadline that pass JSON through linear memory (the ABI in core/src/abi.rs). |
|
env
Package env fills a configuration struct from the environment, so secrets and per-deployment settings never live in lidza.json or code.
|
Package env fills a configuration struct from the environment, so secrets and per-deployment settings never live in lidza.json or code. |
|
gateway
Package gateway verifies original-client TLS evidence from explicitly trusted gateways over mutually authenticated TLS.
|
Package gateway verifies original-client TLS evidence from explicitly trusted gateways over mutually authenticated TLS. |
|
inspect
Package inspect reads a Līdza project's source and produces the context an agent needs: the API routes with their handler signatures, the Rust exports, and the configuration.
|
Package inspect reads a Līdza project's source and produces the context an agent needs: the API routes with their handler signatures, the Rust exports, and the configuration. |
|
jsonschema
Package jsonschema derives a JSON Schema from a Go type at runtime, for app-defined MCP tools whose input is a Go struct.
|
Package jsonschema derives a JSON Schema from a Go type at runtime, for app-defined MCP tools whose input is a Go struct. |
|
lidzatest
Package lidzatest starts an app for a Go test: packs started against .env.test, the handler on an httptest server, and a JSON client.
|
Package lidzatest starts an app for a Go test: packs started against .env.test, the handler on an httptest server, and a JSON client. |
|
list
Package list reads what a list route was asked for: a page (limit and offset, capped), a search, a time range, a sort among the allowed keys and equality filters, from the query string, validated, so a handler passes them to its query and nothing it did not allow reaches SQL.
|
Package list reads what a list route was asked for: a page (limit and offset, capped), a search, a time range, a sort among the allowed keys and equality filters, from the query string, validated, so a handler passes them to its query and nothing it did not allow reaches SQL. |
|
mcpserver
Package mcpserver is `lidza mcp`: a Model Context Protocol server over stdio that gives an agent the project's route map, context, diagnostics, configuration and the runtime log of `lidza dev`, so it asks instead of grepping.
|
Package mcpserver is `lidza mcp`: a Model Context Protocol server over stdio that gives an agent the project's route map, context, diagnostics, configuration and the runtime log of `lidza dev`, so it asks instead of grepping. |
|
middleware
Package middleware holds the request pipeline every Līdza app runs: panic recovery, request ids, request logging, per-request deadlines, body limits, CORS and secure headers.
|
Package middleware holds the request pipeline every Līdza app runs: panic recovery, request ids, request logging, per-request deadlines, body limits, CORS and secure headers. |
|
pack
Package pack implements Līdza packs: a directory under packs/ with a manifest, a Rust crate compiled to WASM, and a generated Go wrapper that exposes each capability as a typed method backed by the engine.
|
Package pack implements Līdza packs: a directory under packs/ with a manifest, a Rust crate compiled to WASM, and a generated Go wrapper that exposes each capability as a typed method backed by the engine. |
|
recipes
Package recipes turns the "Recipes" section of an app's guide (docs/lidza-guide.md) into task recipes: prompts served by `lidza mcp`, and skills for Claude Code (.claude/skills) and for Codex and Gemini CLI (.agents/skills, the Agent Skills layout both read; Gemini offers each as a /<name> command).
|
Package recipes turns the "Recipes" section of an app's guide (docs/lidza-guide.md) into task recipes: prompts served by `lidza mcp`, and skills for Claude Code (.claude/skills) and for Codex and Gemini CLI (.agents/skills, the Agent Skills layout both read; Gemini offers each as a /<name> command). |
|
report
Package report is the seam between the places errors surface (panic recovery, typed handlers, the frontend) and whatever collects them (the analytics pack).
|
Package report is the seam between the places errors surface (panic recovery, typed handlers, the frontend) and whatever collects them (the analytics pack). |
|
resilience
Package resilience holds the circuit breaker outbound calls run through, so a failing dependency sheds load fast instead of tying up every request until its timeout.
|
Package resilience holds the circuit breaker outbound calls run through, so a failing dependency sheds load fast instead of tying up every request until its timeout. |
|
router
Package router is the Līdza control plane's HTTP router: the API routes an application registers, plus the built-in ones every app serves.
|
Package router is the Līdza control plane's HTTP router: the API routes an application registers, plus the built-in ones every app serves. |
|
scaffold
Package scaffold implements `lidza new`: it copies a template and writes the Go entrypoint, lidza.json and the agent instruction files.
|
Package scaffold implements `lidza new`: it copies a template and writes the Go entrypoint, lidza.json and the agent instruction files. |
|
schema
Package schema parses schema.lidza, the single source of truth for an application's data shapes, and generates Go structs with validation, the Postgres DDL and migrations, Rust serde structs and TypeScript types from it.
|
Package schema parses schema.lidza, the single source of truth for an application's data shapes, and generates Go structs with validation, the Postgres DDL and migrations, Rust serde structs and TypeScript types from it. |
|
sdk
Package sdk generates the client SDKs from a project's operations.
|
Package sdk generates the client SDKs from a project's operations. |
|
secrets
Package secrets recognises the secrets providers issue (API keys, tokens, private keys, database URLs with a password) in a string: what lidza check refuses in code (L010) and what the audit pack redacts.
|
Package secrets recognises the secrets providers issue (API keys, tokens, private keys, database URLs with a password) in a string: what lidza check refuses in code (L010) and what the audit pack redacts. |
|
snippets
Package snippets embeds the files of the reference app (examples/notes) that show how the common tasks are done: an owned resource, auth routes, a page on the generated client, a handler test, a browser test, an MCP tool.
|
Package snippets embeds the files of the reference app (examples/notes) that show how the common tasks are done: an owned resource, auth routes, a page on the generated client, a handler test, a browser test, an MCP tool. |
|
snippets/_files/handlers
One attachment per note through the storage pack.
|
One attachment per note through the storage pack. |
|
snippets/internal/sync
command
Command sync copies the reference app's files listed in the snippet index into pkg/snippets/_files, for embedding.
|
Command sync copies the reference app's files listed in the snippet index into pkg/snippets/_files, for embedding. |
|
telemetry
Package telemetry gives every app /metrics (Prometheus exposition, OpenTelemetry-compatible), /healthz (liveness) and /readyz (readiness: every service that can check itself is asked).
|
Package telemetry gives every app /metrics (Prometheus exposition, OpenTelemetry-compatible), /healthz (liveness) and /readyz (readiness: every service that can check itself is asked). |
|
tracing
Package tracing is Līdza's OpenTelemetry tracing: opt-in, configured by the standard OTEL_* environment variables, exported over OTLP/HTTP.
|
Package tracing is Līdza's OpenTelemetry tracing: opt-in, configured by the standard OTEL_* environment variables, exported over OTLP/HTTP. |
|
validate
Package validate holds the rules generated Validate methods call and the error type they return.
|
Package validate holds the rules generated Validate methods call and the error type they return. |
|
version
Package version reports the Līdza build version.
|
Package version reports the Līdza build version. |
|
webhook
Package webhook receives a provider's webhooks safely: the signature is verified on the raw body before anything decodes it, deliveries outside the replay window are refused, and each delivery id is handled once.
|
Package webhook receives a provider's webhooks safely: the signature is verified on the raw body before anything decodes it, deliveries outside the replay window are refused, and each delivery id is handled once. |
|
Package templates embeds the app templates that `lidza new` copies.
|
Package templates embeds the app templates that `lidza new` copies. |