← API Framework
Core Framework · Node.js

CC API Framework

Production-ready Node.js API build framework — opinionated, layered, and ready to ship. A pnpm monorepo of eight composable packages covering everything from structured logging and typed HTTP clients to JWT auth, Fastify plugins, and feature flags.

What It Does

CC API Framework gives Node.js teams a consistent, production-hardened baseline for every API they ship. Instead of wiring up logging, auth, HTTP clients, and config from scratch on each service, you pull in the packages you need and start with best practices already in place.

The framework ships as eight independently versioned pnpm packages. Two example services — a public-facing user API and an internal order service — demonstrate the full stack end-to-end, including JWT verification, service-to-service auth, rate limiting, OpenAPI docs, feature flags, and graceful shutdown.

Key Features

📋

Structured Logging

Pino-based JSON logging with AsyncLocalStorage correlation ID propagation. Every log line across the entire async call chain carries the same request ID.

Resilient HTTP Client

Built on undici with full-jitter retry, circuit breaker, OAuth bearer injection, and a typed ApiResponse discriminated union so errors are always handled.

🔑

Auth Suite

JWT verification supporting HS256, RS256, and JWKS auto-fetch with caching. API key plugin. OAuth 2.0 client credentials and refresh token store out of the box.

Fastify Plugin Suite

Correlation ID, request logger, error handler, CORS, rate limiter, graceful shutdown, OpenAPI 3.1 + Swagger UI, internal service auth, and named external API clients.

Fail-Fast Config

Zod-validated defineConfig() validates process.env at startup and throws a human-readable error — never fails silently at request time.

Typed Error Hierarchy

NotFoundError, UnauthorizedError, ValidationError, and more. All map cleanly to HTTP status codes and are handled uniformly by the error handler plugin.

Quick Start

# 1. Clone and install $ git clone https://github.com/mindobix/cc-api-framework.git $ cd cc-api-framework $ pnpm install # 2. Build all packages in dependency order $ pnpm build Built 8 packages # 3. Copy env files and fill in secrets $ cp examples/front-end-services/user-api/.env.example \ examples/front-end-services/user-api/.env $ cp examples/core-services/order-service/.env.example \ examples/core-services/order-service/.env # 4. Start both services with file-watch reload $ pnpm dev user-api → http://localhost:3000 (JWT, CORS, OpenAPI) order-service → http://localhost:3001 (service-token auth)

Framework Packages

Package Description
@cc-api-framework/errorsTyped HTTP error hierarchy that maps cleanly to status codes
@cc-api-framework/loggerStructured JSON logging via Pino with correlation ID propagation
@cc-api-framework/networkingundici HTTP client — retry, circuit breaker, OAuth injection
@cc-api-framework/configZod-validated defineConfig() — fail-fast env validation at startup
@cc-api-framework/authJWT (HS256, RS256, JWKS), API key, OAuth 2.0 token store
@cc-api-framework/fastify-pluginsFull production Fastify plugin suite (CORS, rate limit, OpenAPI, …)
@cc-api-framework/feature-configRemote feature flags from JSON endpoint with local fallback
@cc-api-framework/testingMockNetworkingClient, withCorrelationContext(), buildTestApp()

Two-Tier Service Architecture

  Browser / External Client
          │  JWT Bearer token
          ▼
  user-api :3000          ← front-end-services tier
  (JWT auth, CORS, rate-limit, OpenAPI docs)
          │  Service token (x-service-auth)
          ▼
  order-service :3001     ← core-services tier
  (internal only — no CORS, no public JWT)

Front-end services handle all public-facing concerns: JWT verification, CORS, rate limiting, and OpenAPI documentation. Core services are internal-only — security is enforced at the front-end tier, keeping core services simple and fast.

Strict TypeScript by Default

All packages extend a shared tsconfig.base.json that enforces a strict compiler configuration — exactOptionalPropertyTypes, noUncheckedIndexedAccess, noImplicitOverride, and the full strict suite. Target: ES2022, module system: NodeNext (native ESM).

🏗️

Built 100% with Claude Code AI Agents

This framework was designed, directed, and shipped using Vibe Coding — organized thinking and 32 years of experience translated into production software by AI.

Learn About Our Process

See It In Action

View API Framework →