id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id
title
category
status
canonical_id
aliases
duplicate_of
source_trust_level
confidence_score
verification_status
tags
raw_sources
last_reinforced
github_commit
tech_stack
wiki-2026-0508-api-first-architecture
API-First Architecture
10_Wiki/Topics
verified
self
API-first design
Contract-first
Schema-first
none
A
0.9
applied
architecture
api
openapi
contract-first
design
2026-05-10
pending
language
framework
yaml
OpenAPI 3.1, Stoplight, Spectral, buf
API-First Architecture
매 한 줄
"매 API spec 의 first artifact — code follows contract" . 매 design-first → spec → mock → impl 매 separate workflow. 매 Swagger (2010) → OpenAPI 3.0 (2017) → 3.1 (2021, JSON Schema 2020-12 align) → AsyncAPI 2.6/3.0 (events) → buf (gRPC). 매 2026 modern stack 은 spec-driven codegen + lint (Spectral) + breaking change detection (buf, oasdiff) + AI-assisted spec (Claude Opus 4.7).
매 핵심
매 workflow
Design : write OpenAPI/proto spec 매 먼저.
Review : stakeholders (FE/BE/partner) review spec, not code.
Mock : Prism/Stoplight serve mock from spec.
Generate : SDK (oapi-codegen, openapi-typescript), server stubs.
Implement : fill stubs, validate at runtime.
Test : contract tests against spec.
Govern : lint (Spectral), diff (oasdiff), versioning.
매 vs code-first
Code-first : write handler → annotate → generate spec. Drift risk, late stakeholder feedback.
API-first : write spec → generate handler → fill. Single source of truth.
매 응용
Public SaaS API — Stripe-style spec-driven.
Multi-platform SDK distribution — auto-generated TS/Python/Go/Java clients.
Frontend/backend parallel dev — FE works against mock from day 1.
B2B integration contracts — partners review spec before impl.
💻 패턴
OpenAPI 3.1 spec
Mock server (Prism)
Spectral lint config
Type-safe client (openapi-typescript)
Server stub (oapi-codegen, Go)
Breaking change detection (oasdiff)
AsyncAPI for events
buf for gRPC governance
매 결정 기준
상황
Spec
HTTP REST, public
OpenAPI 3.1
Async events
AsyncAPI 3.0
gRPC
proto + buf
GraphQL
SDL + Apollo Federation
Internal-only, single team
Code-first (faster iteration)
기본값 : 매 OpenAPI 3.1 + Spectral lint + Prism mock + openapi-typescript codegen + oasdiff CI.
🔗 Graph
🤖 LLM 활용
언제 : 매 multi-team API, 매 public SDK distribution, 매 partner integration, 매 FE/BE parallel dev.
언제 X : 매 prototype, 매 throwaway script, 매 single-developer monolith.
❌ 안티패턴
Spec-as-documentation only : 매 not source of truth, 매 drift. 매 codegen-driven 의 enforce.
No CI lint : 매 spec rot. 매 Spectral / vacuum 의 사용.
Big-bang spec : 매 review fatigue. 매 incremental + path-scoped reviews.
No mock : 매 FE blocked on BE. 매 Prism mock 의 day-1 deploy.
🧪 검증 / 중복
Verified (OpenAPI 3.1 spec, AsyncAPI spec, Stoplight docs, buf docs, ThoughtWorks Tech Radar "Design APIs first").
신뢰도 A.
🕓 Changelog
날짜
변경
2026-05-08
Phase 1
2026-05-10
Manual cleanup — full content (API-first workflow + tooling)