REST v1 API
The rest-v1 starter is the full-breadth default. It composes an ApiStack around the AtfRestApi construct and drives every route from typed config in config/lambdas.ts.
One route, one config
Section titled “One route, one config”A single API route is an ApiLambdaConfig. This is the POST /items route from the framework’s example-rest-full, included from source:
export const createItemConfig: ApiLambdaConfig = { kind: "api", name: "create-item", entry: "lambdas/modules/items/api/create/index.ts", description: "Create an item", method: "POST", path: "/items", authorizer: "cognito", // Phase 3N: also require an API key (orthogonal to the cognito authorizer). apiKey: true,};method + path describe the route; authorizer selects the auth mode (see The Auth Matrix); apiKey: true additionally requires an x-api-key header. The entry is resolved relative to the project root and bundled by the lambda factory.
Adding a route with the CLI
Section titled “Adding a route with the CLI”axs add lambda writes the handler, the config, a test stub, and the registry import in one step:
axs add lambda items/create --kind api --method POST --path /itemsSee the axs add lambda reference for every flag.
Fat lambdas — one function, many routes
Section titled “Fat lambdas — one function, many routes”A single warm Lambda can serve several related routes (one function, one IAM role, one log group) via defineApiLambda + basePath. Each routes[] entry is a relative { method, path, authorizer? }; the per-route authorizer falls back to the config-level authorizer, then the kind default (cognito):
import { defineApiLambda } from "@axis-tech-co/axis-core";
export const authConfig = defineApiLambda({ name: "auth", entry: "lambdas/modules/auth/api/handler/index.ts", description: "Auth on one warm function", basePath: "/auth", routes: [ { method: "POST", path: "login", authorizer: "none" }, { method: "POST", path: "register", authorizer: "none" }, { method: "POST", path: "refresh", authorizer: "cognito" }, ],});Logical IDs are derived from (path, verb), so a fat lambda produces the identical CloudFormation method IDs as declaring the same routes separately — promoting a single-route config to a one-entry routes[] on the same path is zero-drift. You can also author routes non-interactively with the repeatable --route / --base-path flags (see axs add lambda).
Where to go next
Section titled “Where to go next”- The Auth Matrix for the five per-route auth modes.
AtfRestApifor the construct’s props and defaults.- SDK Generation to emit a typed client from these routes.
© 2026 Axis Tech. Powered by axis-tech.co.