How nillionnetwork/nillion-docs works
Primary Components
• Documentation Content: The core of the system, which lives in the docs directory, organizes all the textual guides, tutorials, community information, and various API documentation sections.
• API Specifications: The apispec folder contains OpenAPI/YAML files for defining several APIs (for “nilai” and “nildb”). These represent the contract layer for external (or internal) API usage.
• Source Code & Components: The src directory houses React components (such as homepage features, navigation elements, interactive components) that render the documentation pages.
• Static Assets: The static folder holds images, fonts, and additional JS files that support the UI.
• Configuration & Build Artifacts: Files like docusaurus.config.js, sidebar.js, babel.config.js, and package.json define the configuration/settings and build instructions.
• CI/CD & Deployment: GitHub workflows (in .github/workflows) and vercel.json provide instructions for automated builds, tests, and deployment to docs.nillion.com.
Interactions and Data Flow
• Content and Layout Flow: Markdown/MDX content from the docs folder is processed via Docusaurus (configured in docusaurus.config.js and sidebars files) to create a static site.
• React Components: The src components get rendered into the static content; they pull in content, apply styling (via CSS modules in src/css), and may incorporate dynamic elements (like API-driven search using Algolia DocSearch).
• API Integration: The API spec files (in apispec) indicate how APIs are defined and possibly referenced in the documentation. They can be linked from the docs, showing their relationship to component explanations.
• Build and Deployment Pipeline: The Yarn commands (yarn install, yarn start, yarn build) trigger a pipeline that compiles the React app, processes documentation content, and outputs static files. These are then deployed via Vercel as indicated by the vercel.json.
• CI/CD Integration: GitHub Actions (workflows in .github) sync branches (like main to release) and manage continuous integration/deployment steps.
Architectural Patterns and Key Technologies
• Static Site Generation (SSG): Docusaurus v3 processes markdown documents and React components to produce a static website.
• Modular Component Architecture: The separation between content (docs), presentation logic (src/components and src/theme), and configuration promotes modular design.
• OpenAPI Specifications: The API documentation defined in YAML in the apispec folder is used to clearly document and potentially test API endpoints.
• CI/CD Pipeline: The project uses GitHub Workflows for automated testing and builds along with deployment via Vercel.
• Integration with External Services: Algolia DocSearch is integrated to provide a search feature across the documentation.