Core concepts
Understand the application graph, validated functions, runtime contracts, invocation context, and environment before adding capabilities.
Use these pages to understand the code you’ve written in the Orders tutorial. Start with functions and schemas, then explore how RELKIT connects the application. Development, tests, HTTP, events, jobs, the Inspector, generated clients, and deployment all consume that graph instead of maintaining separate descriptions of the application.
Learn the model in order
Application configuration
Use defineApp to connect the server, environment, and integrations in relkit.config.ts.
Environment contracts
Use defineEnv to declare typed values, defaults, and secrets.
Functions
Define reusable behavior with validated input, output, errors, and dependencies.
Schemas and errors
Keep runtime boundaries explicit and failures safe for callers.
Context and environment
Use invocation-scoped capabilities and typed runtime configuration.
Start with the application model and functions. Schemas define values crossing a boundary; declared errors define expected failures. Context grants one invocation access to its approved capabilities, while the environment contract resolves process configuration before handlers run.
One source, many consumers
The certified minimal starter keeps the root configuration intentionally small:
/** Declares backend defaults; inspection remains disabled unless explicitly enabled. */
import { defineApp } from "@relkit/app/config";
import env from "@app/platform/env.js";
// relkit:create:deployment-imports
export default defineApp({
env,
telemetry: { redaction: { mode: "development-redacted", maxBytes: 65_536 } },
server: { port: 3000, maxBodyBytes: 1_048_576, apiDocs: { ui: "scalar" } },
// relkit:create:deployment
});
Source files are the application. .relkit/generated and .relkit/build are derived artifacts; inspect them
when diagnosing a problem, but repair the descriptor, configuration, or environment that produced them.
TypeScript descriptors → relkit check → application graph
↘ dev · tests · build · inspector · deployment
Check your understanding
From a generated application, run:
bun run check
bun run relkit graph print
check evaluates configuration, discovers descriptors, validates graph relationships, and refreshes generated
contracts. graph print lets you inspect the resulting IDs and edges without starting the server or creating
external resources.
Continue with Service after these concepts to organize behavior by domain and choose the public operations other domains and transports may call.