Configuration
A Kyln project is configured by a single kyln.config.ts at its root. Export a config object with defineConfig, which gives you type checking and editor completion over every option.
The config file
The starter app ships a minimal config:
// kyln.config.ts
import { defineConfig } from "@kyln/core";
export default defineConfig({
server: {
port: 2500,
},
router: {
routesDir: "src/routes",
apiDir: "src/api",
},
});Every option is optional and has a sensible default. A config with no fields at all is valid.
Server
Controls the HTTP server.
server: {
port: 2500, // default 2500; applies in every run mode
host: "0.0.0.0", // interface to bind
}server.port is honored across dev, serve, and the baked standalone server (bake writes it into the bundle as its default). In dev and serve, a --port= flag and the PORT environment variable take precedence over it, in that order; the standalone server honors PORT. See the CLI reference for the full resolution.
Router
Tells Kyln where your routes and API endpoints live. Change these if your project doesn't use the default layout.
router: {
routesDir: "src/routes",
apiDir: "src/api",
}Build
Controls the production build (kyln bake).
build: {
outDir: "dist", // build output directory
sourcemap: false, // emit source maps
minify: true, // minify the client bundle
}SSR
Server-side rendering options.
ssr: {
enabled: true, // render on the server for first paint
streaming: false, // stream the response
}Security
Kyln exposes configuration for CORS, CSRF, rate limiting, security headers, and TLS under security. These are opt-in and each has its own guide; the shape looks like:
security: {
cors: { origins: ["https://example.com"], credentials: true },
csrf: { enabled: true },
rateLimit: { windowMs: 60_000, max: 100 },
}Refer to the security guide for the full option set before enabling these in production.
Next
With the framework covered end to end, the CLI reference documents each command: preheat, dev, make, test, bake, and serve.