Skip to main content

Generated SDKs and fixtures API Documentation

The repository commits five current generated TypeScript SDKs and one private conformance fixture. Generated route and topic names describe their input documents; they are examples of generator output, not stable framework APIs.

Classify the directories first

Directory/packageStatusIntended use
packages/example-altstack-server-sdk / @alt-stack/example-altstack-server-sdkpublic generated OpenAPI snapshotinspect or test TypeScript HTTP SDK output
packages/example-kafka-producer-sdk / @alt-stack/example-kafka-producer-sdkpublic generated AsyncAPI snapshotinspect or test topic SDK output
examples/real-life/packages/backend-auth-sdk / @real-life/backend-auth-sdkprivate generated OpenAPI SDKcall the real-life authentication service
examples/real-life/packages/backend-logic-sdk / @real-life/backend-logic-sdkprivate generated OpenAPI SDKcall the real-life task service
examples/real-life/packages/workers-sdk / @real-life/workers-sdkprivate generated AsyncAPI SDKpublish real-life worker messages
packages/openapi-test-spec / @alt-stack/openapi-test-specprivate test fixtureexercise cross-language generator conformance

Never import the @real-life/* packages outside their private example workspace. Regeneration may add, remove, or rename any route-specific or topic-specific identifier below.

@alt-stack/example-altstack-server-sdk

This generated OpenAPI SDK requires Zod 4 as a peer. It exports runtime validators, their inferred TypeScript types, route-specific aliases, and the Request and Response maps consumed by Altstack HTTP clients.

import { Request, Response } from "@alt-stack/example-altstack-server-sdk";
import { createApiClient } from "@alt-stack/http-client-fetch";

const api = createApiClient({
baseUrl: "http://127.0.0.1:3000",
Request,
Response,
});

Component schema and type pairs

ExportsContract
GetApiTodosResponseSchema / GetApiTodosResponseValidates a strict array of todos. Every todo has string id, title, createdAt, and userId, optional string description, and boolean completed.
PostApiTodosBodySchema / PostApiTodosBodyValidates a create-todo body with a 1–200 character title and an optional description of at most 1,000 characters. The type and route-value namespaces intentionally share PostApiTodosBody.
PostApiTodosResponseSchema / PostApiTodosResponseValidates the strict todo object returned by create, get-by-id, update, and complete routes.
PostApiTodos401ErrorSchema / PostApiTodos401ErrorValidates a strict error envelope whose nested code is exactly UNAUTHORIZED and whose message is a string.
GetApiTodosId404ErrorSchema / GetApiTodosId404ErrorValidates a strict error envelope whose nested code is exactly NOT_FOUND and whose message is a string.
PutApiTodosIdBodySchema / PutApiTodosIdBodyValidates a partial todo update: optional bounded title and description fields plus optional boolean completed. The type and route-value namespaces share PutApiTodosIdBody.
PutApiTodosId400ErrorSchema / PutApiTodosId400ErrorValidates a strict CUSTOM_VALIDATION_ERROR envelope with string message and field values.
PutApiTodosId403ErrorSchema / PutApiTodosId403ErrorValidates a strict FORBIDDEN error envelope with a string message.
DeleteApiTodosIdResponseSchema / DeleteApiTodosIdResponseValidates the strict delete acknowledgement object containing boolean success.
PatchApiTodosIdCompleteBodySchema / PatchApiTodosIdCompleteBodyValidates the completion body containing a required boolean completed. The type and route-value namespaces share PatchApiTodosIdCompleteBody.
GetApiUsersMeResponseSchema / GetApiUsersMeResponseValidates the strict current-user object with string id and email plus role admin or user.
GetApiUsersIdResponseSchema / GetApiUsersIdResponseValidates the strict public-user object with string id and email.
GetApiAdminUsersResponseSchema / GetApiAdminUsersResponseValidates an array of strict admin-visible user objects with id, email, and admin/user role.

Route input validators

ExportContract
GetApiTodosQueryValidates the list filter: optional string enum completed (true or false), optional integer limit, and non-negative optional integer offset.
PostApiTodosBodyReuses the bounded create-todo body for POST /api/todos.
GetApiTodosIdParamsValidates the UUID id path parameter for GET /api/todos/{id}.
PutApiTodosIdParamsValidates the UUID id path parameter for the todo update route.
PutApiTodosIdQueryValidates the optional boolean notify query flag on a todo update.
PutApiTodosIdBodyReuses the partial todo-update validator for PUT /api/todos/{id}.
DeleteApiTodosIdParamsValidates the UUID id path parameter for deleting a todo.
PatchApiTodosIdCompleteParamsValidates the UUID id path parameter for the completion route.
PatchApiTodosIdCompleteBodyReuses the required boolean completion body for the completion route.
GetApiUsersIdParamsValidates the UUID id path parameter for looking up a user.
GetApiAdminUsersQueryValidates the optional admin/user role filter for the admin list route.
DeleteApiAdminUsersIdParamsValidates the UUID id path parameter for the admin delete route.

Route response validators

ExportContract
GetApiTodos200ResponseValidates the 200 todo-array response for GET /api/todos.
PostApiTodos200ResponseValidates the created todo returned with status 200.
PostApiTodos401ErrorResponseValidates the 401 unauthorized envelope for creating a todo.
GetApiTodosId200ResponseValidates the todo returned by a successful get-by-id request.
GetApiTodosId404ErrorResponseValidates the 404 not-found envelope for get-by-id.
PutApiTodosId200ResponseValidates the updated todo returned with status 200.
PutApiTodosId400ErrorResponseValidates the update route's 400 custom field-validation error.
PutApiTodosId401ErrorResponseValidates the update route's 401 unauthorized error.
PutApiTodosId403ErrorResponseValidates the update route's 403 forbidden error.
PutApiTodosId404ErrorResponseValidates the update route's 404 not-found error.
DeleteApiTodosId200ResponseValidates the successful todo-deletion acknowledgement.
DeleteApiTodosId401ErrorResponseValidates the todo delete route's 401 unauthorized error.
DeleteApiTodosId404ErrorResponseValidates the todo delete route's 404 not-found error.
PatchApiTodosIdComplete200ResponseValidates the updated todo returned by a successful completion request.
PatchApiTodosIdComplete401ErrorResponseValidates the completion route's 401 unauthorized error.
PatchApiTodosIdComplete404ErrorResponseValidates the completion route's 404 not-found error.
GetApiUsersMe200ResponseValidates the current user's strict id, email, and role object.
GetApiUsersMe401ErrorResponseValidates the current-user route's 401 unauthorized error.
GetApiUsersId200ResponseValidates the public id and email object returned for a user.
GetApiUsersId404ErrorResponseValidates the user lookup route's 404 not-found error.
GetApiAdminUsers200ResponseValidates the admin route's array of user records.
GetApiAdminUsers401ErrorResponseValidates the admin list route's 401 unauthorized error.
GetApiAdminUsers403ErrorResponseValidates the admin list route's 403 forbidden error.
DeleteApiAdminUsersId200ResponseValidates the successful admin-user deletion acknowledgement.
DeleteApiAdminUsersId401ErrorResponseValidates the admin delete route's 401 unauthorized error.
DeleteApiAdminUsersId403ErrorResponseValidates the admin delete route's 403 forbidden error.
DeleteApiAdminUsersId404ErrorResponseValidates the admin delete route's 404 not-found error.

Request and response maps

ExportContract
RequestGroups input validators under their exact OpenAPI path and uppercase method. It covers todo list/create/get/update/delete/complete, user get-by-id, admin user list, and admin user delete; routes without input validators are absent from this map.
ResponseGroups every declared status validator under its exact path and method. It additionally contains GET /api/users/me, which has no corresponding Request entry because it accepts no params, query, or body.

Both maps are emitted as const, allowing clients to derive path, method, input, and status unions. Route aliases may point at a shared component schema; their route-specific names remain generated details.

@alt-stack/example-kafka-producer-sdk

This generated AsyncAPI SDK also requires Zod 4 as a peer. Payload component pairs describe reusable schemas, while message pairs represent the schema attached to each concrete topic.

ExportsContract
UserEventsPayloadSchema / UserEventsPayloadValidates a user event with string userId, event type created, updated, or deleted, numeric timestamp, and optional string-keyed unknown metadata.
OrdersCreatedPayloadSchema / OrdersCreatedPayloadValidates an order with string orderId and userId, item records containing string productId, integer quantity, and non-negative price, plus a non-negative total.
NotificationsPayloadSchema / NotificationsPayloadValidates a notification containing string type, recipient, and message fields.
UserEventsMessageSchema / UserEventsMessageValidates the complete message published on user-events; its current shape matches the user-events payload component.
OrdersCreatedMessageSchema / OrdersCreatedMessageValidates the complete message published on orders/created; its current shape matches the order-created payload component.
NotificationsMessageSchema / NotificationsMessageValidates the complete message published on notifications; its current shape matches the notification payload component.
TopicsMaps user-events, orders/created, and notifications to their generated message schemas for runtime parsing and producer configuration.
TopicNameRepresents the exact key union of Topics, preventing arbitrary topic strings in typed callers.
MessageType<T extends TopicName>Infers the parsed message type for the selected topic key from its Zod schema.
import { Topics, type MessageType } from "@alt-stack/example-kafka-producer-sdk";

const event: MessageType<"user-events"> = Topics["user-events"].parse({
userId: "u_1",
eventType: "created",
timestamp: Date.now(),
});

Private real-life generated SDKs

The real-life workspace now commits actual output from its current OpenAPI and AsyncAPI documents. Each package is private, and each generated src/index.ts remains replaceable in full.

@real-life/backend-auth-sdk

The authentication SDK exposes these generated interface/schema pairs:

ExportsContract
PostApiSignupBody / PostApiSignupBodySchemaRequires a valid email, password of at least eight characters, and non-empty name.
PostApiSignupResponse / PostApiSignupResponseSchemaRepresents a strict user plus session object; the session contains token, user ID, and an ISO date-time expiry.
PostApiSignup409Error / PostApiSignup409ErrorSchemaRepresents a tagged EmailExistsError conflict.
PostApiLoginBody / PostApiLoginBodySchemaRequires a valid email and string password for login.
PostApiLogin401Error / PostApiLogin401ErrorSchemaRepresents a tagged InvalidCredentialsError.
PostApiLogoutResponse / PostApiLogoutResponseSchemaRepresents the boolean success logout acknowledgement.
GetApiMeResponse / GetApiMeResponseSchemaRepresents the authenticated user's ID, valid email, and name.
GetApiMe401Error / GetApiMe401ErrorSchemaRepresents a tagged UnauthorizedError.
GetApiValidateResponse / GetApiValidateResponseSchemaRepresents session validity and an optional user ID.

PostApiSignupBody, PostApiSignup200Response, and PostApiSignup409ErrorResponse form signup's generated body, success, and conflict aliases. PostApiLoginBody, PostApiLogin200Response, and PostApiLogin401ErrorResponse form login's body, shared signup-shaped success, and invalid-credentials response. PostApiLogout200Response, GetApiMe200Response, GetApiMe401ErrorResponse, and GetApiValidate200Response cover the remaining route responses.

Request maps POST /api/signup and POST /api/login bodies plus empty input objects for logout, current-user, and validation routes. Response maps all five routes to their declared 200, 401, or 409 status validators.

pnpm --dir examples/real-life --filter @real-life/backend-auth generate

@real-life/backend-logic-sdk

The task SDK exposes these generated interface/type and schema pairs:

ExportsContract
GetApiResponse / GetApiResponseSchemaRepresents an array of tasks with IDs, task data, status, owner ID, and ISO date-time creation/update timestamps.
PostApiBody / PostApiBodySchemaValidates a non-empty 1–200 character title and optional description of at most 1,000 characters.
PostApiResponse / PostApiResponseSchemaRepresents one strict task with pending, in_progress, or completed status and ISO timestamps.
PostApi401Error / PostApi401ErrorSchemaRepresents a tagged UnauthorizedError.
GetApiId404Error / GetApiId404ErrorSchemaRepresents a tagged NotFoundError.
PutApiIdBody / PutApiIdBodySchemaValidates a partial update of bounded title/description and the three-state status enum.
PutApiId403Error / PutApiId403ErrorSchemaRepresents a tagged ForbiddenError.
DeleteApiIdResponse / DeleteApiIdResponseSchemaRepresents the boolean success deletion acknowledgement.

The shared response aliases are PostApi200Response, PostApi401ErrorResponse, GetApiId404ErrorResponse, and PutApiId403ErrorResponse. Route input aliases are PostApiBody, GetApiIdParams, PutApiIdParams, PutApiIdBody, and DeleteApiIdParams; every path parameter validates a UUID. Route response aliases are GetApi200Response, GetApiId200Response, PutApiId200Response, PutApiId401ErrorResponse, PutApiId404ErrorResponse, DeleteApiId200Response, DeleteApiId401ErrorResponse, DeleteApiId403ErrorResponse, and DeleteApiId404ErrorResponse.

Request maps list/create at /api and get/update/delete at /api/{id}. Response assigns the generated 200, 401, 403, and 404 validators to those same method/path pairs.

pnpm --dir examples/real-life --filter @real-life/backend-logic generate

@real-life/workers-sdk

ExportsContract
SendNotificationPayloadSchema / SendNotificationPayloadValidates a notification job with event type task_created, task_completed, or task_assigned plus string user, task, and title fields.
GenerateReportPayloadSchema / GenerateReportPayloadValidates a report job with string task and user IDs plus an ISO-like completion date-time string.
SendNotificationMessageSchema / SendNotificationMessageRepresents the complete message for send-notification and currently aliases its payload validator.
GenerateReportMessageSchema / GenerateReportMessageRepresents the complete message for generate-report and currently aliases its payload validator.
TopicsMaps send-notification and generate-report to their current runtime validators.
TopicNameRepresents exactly the two topic keys in Topics.
MessageType<T extends TopicName>Infers the validated message type for a selected worker topic.
pnpm --dir examples/real-life --filter @real-life/workers generate

@alt-stack/openapi-test-spec

This package is marked private: true and exports only the subpath @alt-stack/openapi-test-spec/openapi.json. It is not an application dependency or a general sample API.

The OpenAPI 3.0 fixture deliberately covers:

  • string formats, enums, patterns, lengths, numeric bounds, booleans, and arrays;
  • strict, free-form, optional, nullable, and additional-property objects;
  • local references, nested objects, oneOf discriminators, and allOf intersections;
  • path/query/header parameters, JSON request bodies, success/error statuses, and repeated error shapes;
  • x-altstack-examples.valid and .invalid samples used by conformance tests.

TypeScript, Python, and Rust generator tests read this same document. The x-altstack-examples extension is fixture metadata, not a generator configuration field and not emitted into route validation logic.

Safe update workflow

  1. Change the owning server/event schemas or the explicit test fixture.
  2. Regenerate the relevant SDK with the pinned workspace generator.
  3. Run its package type check or language test.
  4. Review the entire generated diff; do not hand-correct it.

Keep the generated banner in every snapshot so consumers do not mistake route-specific output for a stable hand-authored API.