How splitwise/api-docs works
Summary / project type and purpose
• This repository is an API documentation site: a static site generated from OpenAPI v3 source files (splitwise.yaml + paths/, schemas/, responses/). It uses Redoc/Redocly (via npm scripts) to render OpenAPI into a browsable HTML doc (docs/index.html). The site is intended to publish the official Splitwise API docs (dev.splitwise.com) and is built/served locally for development and compiled to a zero-dependency HTML file for deployment (docs/index.html). CI and hosting hooks (e.g., .travis.yml and docs/CNAME) indicate automated build/deploy to GitHub Pages / custom domain.
How I inspected the repo to reach that conclusion
• README explicitly: "powered by OpenAPI + redocly" and commands npm run serve / npm run build.
• File tree shows standard OpenAPI layout:
• splitwise.yaml: root OpenAPI bundle/entrypoint
• paths/: per-endpoint YAML files (paths/create_expense.yaml, get_expenses.yaml, ...)
• schemas/: component schemas (users, expense, comment, etc.)
• responses/: shared response objects (forbidden, not_found, unauthorized)
• docs/index.html and docs/CNAME indicate build output and a custom domain for hosting.
• package.json & .travis.yml imply build tooling and CI integration.
• The documentation pipeline (source → build → artifact → host → consumer).
• The logical separation between:
• Source OpenAPI artifacts (authoring content)
• Build toolchain (npm scripts, redocly/redoc)
• CI/CD (Travis or other automation)
• Hosting / Delivery (GitHub Pages + custom domain, possible CDN)
• End users (developers, API consumers) and external services (npm registry, GitHub)
• Important internal components: paths, schemas, responses, splitwise.yaml, docs/ (artifact).
Authoring/Source (blue)
• splitwise.yaml (entrypoint)
• paths/ (all endpoint definitions)
• schemas/ (model definitions and sub-schemas)
• responses/ (shared responses/errors)
• docs/ (static assets, CNAME)
• package.json / package-lock.json (build scripts & dependencies)
Build Toolchain (green)
• npm (scripts: serve, build)
• redoc / redocly (OpenAPI renderer)
• optional linters/validators (OpenAPI linter / redocly config if used)
Development Server (light green)
• local dev server (npm run serve) — live reloading
CI/CD (cyan)
• .travis.yml (or alternate CI) triggers build
• CI job: run npm install → validate → npm run build → publish
Artifact / Hosting (purple)
• docs/index.html (single-file HTML artifact)
• docs/CNAME (custom domain config)
• GitHub Pages (or other static host), optionally a CDN in front (e.g., Cloudflare)
External Services / Dependencies (orange)
• npm registry (fetch redoc/redocly and other deps)
• GitHub (repo + issues, PRs)
Consumers (grey)
• Developers viewing dev.splitwise.com
• API integrators using the docs
• Versioning/branches (how multiple versions of API could be handled)
• Automated validation steps (OpenAPI validation/linting)
• Publishing step to a package registry or different hosting
• Developer (author) → modifies source files (paths/, schemas/, splitwise.yaml).
• Local workflow:
• Developer → npm run serve → local dev server (redoc) → renders docs from source → developer views in browser.
• Live-reload feedback loop: change source → build toolchain regenerates → dev server serves updated docs.
• Build/CI workflow:
• Git push → CI (.travis.yml) triggers → runs npm install (→ npm registry) → runs linters/validators (optional) → npm run build → produces docs/index.html.
• CI → pushes artifact to GitHub Pages (docs folder) or deploys to host.
• Hosting/delivery:
• GitHub Pages / hosting serves docs/index.html via docs/CNAME (custom domain).
• Browser/Developer (end-user) requests docs → served from GitHub Pages/CDN → consumes content.
• External dependencies:
• Build step pulls packages from npm registry.
• Redocly used to render OpenAPI; might call its tooling locally (or API if using hosted services).
Architectural patterns & design principles to call out
• Content-as-code: the API docs are authored in YAML files in source control (single source of truth).
• Static site generation: source -> build -> static artifact (zero-dependency HTML).
• Schema-driven documentation: API surface and models are generated from OpenAPI schemas and paths.
• Single artifact deployment: a compiled self-contained HTML file (docs/index.html) can be deployed anywhere static HTML is served.
• Separation of concerns: authoring (source files) is distinct from rendering/build (toolchain) and delivery (hosting).
• Extensibility points: adding new paths/schemas; adding lint rules or CI checks; versioning or multi-version docs can be introduced.
• OpenAPI v3 (splitwise.yaml, paths/, schemas/)
• Redoc / Redocly (rendering tool)
• Node / npm (package.json scripts)
• GitHub (repo, issues, PRs)
• GitHub Pages (docs/ hosting) or alternative static host
• CI system (.travis.yml shown)
• npm registry (external dependency source)
Logical/Conceptual view (keep simple)
• Source → Build → Host → Consumer
Development workflow view
• Developer editing local files → local dev server → browser.
• Live reload loop.
CI/CD & Deployment view
• Git push → CI job → build artifacts → GitHub Pages (docs/) → CDN → browser.
File-to-component mapping (detailed)
• Directories to components: paths/ → Endpoint definitions, schemas/ → Models, responses/ → Common responses.
• Blue for source/content (paths/, schemas/, splitwise.yaml)
• Green for build/tooling (npm, redoc)
• Cyan for CI/CD
• Purple for hosting/delivery
• Orange for external dependencies (npm)
• Grey for consumers/users
• From developer → source (edit)
• From source → build tools (serve/build)
• From build → artifact (docs/index.html)
• From CI → build & publish → hosting
• From browser → hosting (request)
• From build → npm registry (dependency fetch)
What to label in each component (recommended)
• For Source: list splitwise.yaml, paths/, schemas/, responses/, package.json
• For Build: "npm run serve" (local), "npm run build" (compile to docs/index.html), redoc/redocly rendering
• For CI: .travis.yml — steps (install, validate, build, deploy)
• For Hosting: docs/index.html (artifact), docs/CNAME (custom domain), GitHub Pages/CDN
• For External: npm registry, GitHub (repo)
• Linter/validator stage: OpenAPI lint → prevents bad merges
• Versioning: separate branch → different docs versions
• Analytics/tracking on docs site (if used)
• Clear component names and file/directory mappings
• Annotations for key files (.travis.yml, docs/CNAME, splitwise.yaml)
• External dependencies (npm registry) and services (GitHub, GitHub Pages)
• Single-source-of-truth nature of splitwise.yaml + paths + schemas
• Be explicit about the source files that drive the site — the most valuable clarity for maintainers is exactly which files are authoritative (splitwise.yaml, paths/, schemas/).
• Validation & CI safeguards as first-class components (OpenAPI linting) — they’re important for doc correctness.