원클릭으로
boilerplate-api-patterns
Common patterns for the Boilerplate HTTP API (Express)
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Common patterns for the Boilerplate HTTP API (Express)
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | boilerplate-api-patterns |
| description | Common patterns for the Boilerplate HTTP API (Express) |
| version | 1.0.0 |
apps/api/When you add or change an API route, update these together:
import { Router, type Request, type Response } from 'express';
const router = Router();
router.get('/health', (_req: Request, res: Response): void => {
res.json({ status: 'ok', message: 'The server is running.' });
});
export default router;
lib/startup/validation.ts runs after loadEnv() and before importing config. It validates required env vars (e.g. API_PORT), logs results by category, and throws if any required are missing or invalid. WEB_BRAND_NAME is required only when AUTH_MODE uses email flows (with mailer vars), for transactional email copy. Pattern aligned with Podverse’s API startup validation.config/index.ts only after validation has passed..env.example for documented variables; non-empty values in .env use double quotes; empty/unset use no value after =..env files (including infra/config/local/*.env) must match the organization, section comments, and variable order of their authoritative .env.example; only values may differ. Generated files are filled by make local_env_setup (auto-generated secrets plus overrides from info.env and db-management-superuser.env when present). WEB_BRAND_NAME is set from dev/env-overrides/local/info.env (classification workload info). See docs/development/LOCAL-ENV-OVERRIDES.md.Wrap async route handlers to avoid unhandled rejections (e.g. try/catch and pass errors to Express error middleware, or use a small asyncHandler wrapper).
validateBody(schema) middleware (Joi) on any route that accepts a JSON body. Validation runs before the controller; invalid requests get 400 with details and never reach the controller.CreateAdminBody for createAdminSchema). Use .default() in Joi so optional fields have a known shape after validation.apps/management-api: schemas in schemas/*.ts with exported body types, routes using validateBody(schema), controllers using the types and no redundant presence/type checks for validated fields.npm run dev – Build and run (from apps/api)npm run dev:api – From repo rootconfig.apiVersionPath), and clean-slate/requirements.When changing API routes, auth, or env-dependent behavior, add or update the corresponding integration tests and keep the test file layout consistent.
When adding or changing files under infra/k8s/ or sync targets for k8s, know what Argo CD syncs and remind the user to push to Git so the cluster can sync.
Keeps tools/generate-data seeders and docs in sync when main or management DB schema or ORM entities change. Use when adding or changing tables/entities in packages/orm, packages/management-orm, or infra database migrations.
When changing DB schema or permission dimensions, consider predefined roles and bucket_role / role-related code.
Use when adding or changing environment variables, infra/env/classification YAML, scripts/env-classification, K8s env render, or local env generation.
When adding or changing preconditions, cleanup steps, or env usage for local Docker Compose or local k3d, keep both in sync where they share resources (e.g. infra/config/local/*.env).