HTTP and OpenAPI helpers
pkg/api constructs the shared Huma/Chi API, configures title/contact/server/tag metadata, serializes OpenAPI to YAML, and supplies request logging, CORS, and validation helpers. Huma's built-in CDN docs route is disabled; API viewers are served by the docs container.
The configured OpenAPI servers point to production and development API domains. Hosting Swagger/Scalar locally does not change them. Service handlers register their own operations; legacy routes are not automatically included. Request logging and CORS are installed by the composition root. CORS reads CORS_ORIGINS separately and defaults to *.
Use api.New(router, api.Deps{}) in runtime or offline composition, register modules, then api.SpecToYAML when exporting. Do not move provider-specific business rules into this shared package. Middleware tests cover logging and CORS behavior; specification coverage is also checked by service/composition tests.
Code reference
See the generated api package.