How solana-foundation/developer-content works
Project type and purpose
• This is a content‐service repo (“Solana Developer Content”) serving Markdown documentation, guides, courses, etc.
• It uses a Next.js (App Router) application to parse, index, and serve content via REST‐style API endpoints.
• The UI lives in a separate repo (solana-com) and calls these APIs.
File structure
• Top level: configuration (ESLint, Prettier, Husky), GitHub Actions, .gitignore, package manager files.
• content/… and docs/…: the raw Markdown content to be published.
• code/… and contentlayer.config.ts: code and config for Contentlayer (parsing Markdown into typed data).
• src/app/api/...: Next.js API routes (/api/content, /api/nav, /api/paths, /api/overview, /api/records) that expose structured content.
• src/utils and src/types: helper functions and shared type definitions.
• src/components, src/app/page.tsx: minimal preview UI for local development.
• vercel.json and .github/workflows: deployment to Vercel via GitHub Actions.
README for additional insights
• Confirms the repo is CONTENT ONLY, rendered by a separate UI repo.
• Setup: clone both repos, set NEXT_PUBLIC_DEVELOPER_CONTENT_API_URL to point at this app’s local server.
• Lists content categories (courses, docs, guides, resources).
Main components
A. Markdown Repositories
• “content/” directory (cookbook, guides, courses)
• “docs/” directory (core docs, RPC reference)
B. Content Parsing Layer
• Contentlayer (configured via contentlayer.config.ts)
• code/ scripts (e.g., cookbook utilities, coder.ts)
• Custom parsers and helpers (src/utils/parsers.ts, src/utils/records.ts)
C. Next.js Application
• App Router
• API Routes under src/app/api/* that provide JSON endpoints
• Minimal preview pages/components (HomeComponent.tsx, page.tsx)
D. Deployment Pipeline
• GitHub Actions workflows (.github/workflows/*.yml) for formatting, building, deploying
• Vercel (configured via vercel.json)
E. External UI Consumer
• solana-com Frontend (separate repo) calling these APIs
F. Developer Workflow
• Local development: pnpm install → run Next.js dev server on port 3001
• UI dev: set NEXT_PUBLIC_DEVELOPER_CONTENT_API_URL=http://localhost:3001
Relationships and data flow
1. Authors commit Markdown to content/ or docs/.
2. On build/dev server start, Contentlayer reads Markdown and generates in‐memory content nodes.
3. Next.js API routes import these nodes (using Contentlayer’s generated types) and respond to client requests.
4. External UI (solana-com) issues HTTP GET to endpoints like /api/content/[slug], /api/nav/[slug], etc.
5. Vercel hosts the Next.js app; GitHub Actions automate formatting, testing, and deployment.
Architectural patterns and design principles
• Headless CMS / Content API pattern
• File‐system routing (Next.js App Router)
• Separation of concerns: Markdown storage vs. parsing vs. serving vs. UI
• CI/CD via GitHub Actions + Vercel
• Type safety via Contentlayer and TypeScript
Essential details to capture
• Content directories vs. API routes
• Build vs. runtime phases
• How the external UI uses the API
• GitHub → Actions → Vercel path