---
title: Core concepts
description: Understand the application graph, validated functions, runtime contracts, invocation context, and environment before adding capabilities.
sidebar:
  icon: lightbulb
---

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](/docs/learn/concepts/application)**

Use defineApp to connect the server, environment, and integrations in relkit.config.ts.

**[Environment contracts](/docs/learn/concepts/environment)**

Use defineEnv to declare typed values, defaults, and secrets.

**[Functions](/docs/learn/concepts/functions)**

Define reusable behavior with validated input, output, errors, and dependencies.

**[Schemas and errors](/docs/learn/concepts/schemas)**

Keep runtime boundaries explicit and failures safe for callers.

**[Context and environment](/docs/learn/concepts/context)**

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:

```ts title="templates/default/v1/minimal/relkit.config.ts"
/** 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.

```text title="Application flow"
TypeScript descriptors → relkit check → application graph
                                      ↘ dev · tests · build · inspector · deployment
```

## Check your understanding

From a generated application, run:

```sh title="Terminal — relkit-orders"
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](/docs/modules/service) after these concepts to organize behavior by domain and choose the
public operations other domains and transports may call.

{/* Generated by apps/docs/scripts/generate.ts. Do not edit. */}

**Reference and source**

- [`@relkit/app` API](/docs/api/app)
- [`@relkit/functions` API](/docs/api/functions)
- [`@relkit/schema` API](/docs/api/schema)

- [`templates/default/v1/api/relkit.config.ts`](https://github.com/rel-kit/relkit/blob/main/templates/default/v1/api/relkit.config.ts)
