Gallery ยท Architecture explained ยท Score ยท JavaScript
Fastify architecture: modules, API surface, dependency graph
Fast and low-overhead web framework for Node.js. Generated from fastify/fastify at 5d4c233, MIT.
- Files
- 32
- Modules
- 32
- API routes
- 0
- Documents
- 17
TypeScriptJavaScript
Executive Summary
At a Glance
| Aspect | Summary |
|---|---|
| What | Fastify is a early-stage command-line tool |
| Built With | general-purpose + TypeScript, JavaScript |
| Scale | 32 modules across 32 files |
| Maturity | Early-stage (1/3 indicators) |
What This System Does
Fastify is a general-purpose command-line tool built with TypeScript, JavaScript. It operates as a command-line interface, enabling users to interact with the system through terminal commands. This architecture is optimized for automation, scripting, and integration into CI/CD pipelines.
Business Capabilities
The system is organized around 5 functional domains, each representing a distinct business capability:
| Domain | Capability | Scale |
|---|---|---|
| Shared Utilities | path lib/config-validator.js matches lib | 25 modules, 25 files |
| API Layer | path lib/error-handler.js matches handler | 3 modules, 3 files |
| Content Management | path lib/content-type-parser.js matches content | 2 modules, 2 files |
| Other | Uncategorized module | 1 modules, 1 files |
| State Management | path lib/context.js matches context | 1 modules, 1 files |
Technical Foundation
| Layer | Technologies | Purpose |
|---|---|---|
| Language | TypeScript, JavaScript | Primary development language |
Module Composition
The codebase follows a layered architecture with clear separation of concerns:
| Layer | Count | Key Modules | Responsibility |
|---|---|---|---|
| Other Modules | 1 | root | General purpose functionality |
| Shared Libraries | 14 | config-validator.js, content-type-parser.js | Provides shared utilities and abstractions used across modules |
Codebase Health
Overall Health: ๐ข 95/100
| Metric | Value | Status |
|---|---|---|
| Internal imports | 108 edges | โ Connected |
| External Packages | 15 | โ Manageable |
| Circular Dependencies | cycle-free | โ None |
| Orphan Files | 0 | โ All connected |
Key Insights
- โ Clean module boundaries โ No circular dependencies detected, enabling safe refactoring and testing.
- โ ๏ธ Coupling hotspot โ
lib/symbolsis imported by 20 files (63% of codebase). Consider splitting.
Key Data Flows
The system processes information through 2 identified flows:
- fastify Request Flow (critical) โ Import chain starting from
fastifyโ traces how this entry point depends on 1 downstream module - Content Delivery Flow โ Research articles and content are fetched and displayed to users
Strategic Observations
- The codebase follows Plugin system โ `lib/plugin-override.js`, `lib/plugin-utils.js`, Shared utility layer โ `lib/plugin-utils.js`, `lib/config-validator.js`, `lib/content-type-parser.js` (+28 more), Acyclic dependency graph โ clean layering architectural patterns, providing a familiar structure for developers.
- With 5 distinct domains, the system has clear separation of concerns suitable for team-based development.
- As a CLI tool, this system is automation-friendly and can integrate into existing workflows and pipelines.
This executive summary was generated from comprehensive repository analysis including dependency graphs, data flow detection, and architectural pattern recognition. Enable AI enhancement with `GITHUB_TOKEN` for strategic recommendations, risk assessments, and plain-language explanations tailored for non-technical stakeholders.
<!-- repolens:docs-badge -->  ยท Examples
System Overview
The Big Picture
Fastify is a medium-sized codebase with clear structure, containing 32 modules spread across 32 files.
| Dimension | Details |
|---|---|
| Total Files | 32 |
| Module Count | 32 |
| Functional Domains | 5 |
| Interface Type | Command-Line Tool |
Technology Stack
The system is built on a modern technology foundation:
| Layer | Technologies | Purpose |
|---|---|---|
| Language | TypeScript, JavaScript | Primary development language |
Architecture Patterns
The codebase follows 3 identified architectural patterns:
- Plugin system โ `lib/plugin-override.js`, `lib/plugin-utils.js` โ The system supports extensibility through a plugin architecture allowing third-party additions.
- Shared utility layer โ `lib/plugin-utils.js`, `lib/config-validator.js`, `lib/content-type-parser.js` (+28 more) โ The system supports extensibility through a plugin architecture allowing third-party additions.
- Acyclic dependency graph โ clean layering โ The system operates as a command-line interface, accepting user input through terminal commands and producing structured output.
Module Architecture
The system is organized into 2 architectural layers:
| Layer | Modules | Key Examples | Responsibility |
|---|---|---|---|
| Other Modules | 1 | root | General purpose functionality |
| Shared Libraries | 14 | config-validator.js, content-type-parser.js | Provides shared utilities and abstractions used across modules |
Layer Details
Other Modules โ 1 module
rootโ 1 files โ Core application module
Shared Libraries โ 14 modules
lib/config-validator.jsโ 1 files โ Utility and helper functionslib/content-type-parser.jsโ 1 files โ Utility and helper functionslib/content-type.jsโ 1 files โ Utility and helper functionslib/context.jsโ 1 files โ Utility and helper functions- +10 more modules
Functional Domains
The following domains represent the largest functional areas by file count:
| Rank | Domain | Scale | Business Capability |
|---|---|---|---|
| 1 | Shared Utilities | 25 files | path lib/config-validator.js matches lib |
| 2 | API Layer | 3 files | path lib/error-handler.js matches handler |
| 3 | Content Management | 2 files | path lib/content-type-parser.js matches content |
| 4 | Other | 1 files | Uncategorized module |
| 5 | State Management | 1 files | path lib/context.js matches context |
Dependency Graph
Codebase Health: ๐ข 95/100
| Metric | Value | Assessment |
|---|---|---|
| Internal Imports | 108 | Modules are connected |
| External Packages | 15 | Lean dependencies |
| Circular Dependencies | 0 | โ Clean |
| Orphan Files | 0 | โ All connected |
Hub modules (most imported):
lib/symbolsโ imported by 20 fileslib/errorsโ imported by 18 fileslib/hooksโ imported by 7 fileslib/content-typeโ imported by 5 files
This system overview was generated from comprehensive repository analysis. Enable AI enhancement with `GITHUB_TOKEN` for narrative context, architectural rationale, technology trade-off analysis, and scalability recommendations.
<!-- repolens:docs-badge -->  ยท Examples
Business Domains
Overview
Fastify is organized into 5 functional domains, each representing a distinct area of business capability. This document maps the technical structure to business-oriented functional areas.
Quick Reference:
| Domain | Modules | Files | Primary Capability |
|---|---|---|---|
| Shared Utilities | 25 | 25 | Cross-cutting utility functions |
| API Layer | 3 | 3 | External API interface layer |
| Content Management | 2 | 2 | Content creation and editorial workflow |
| Other | 1 | 1 | Supporting business operations |
| State Management | 1 | 1 | Application state and data flow management |
1. Shared Utilities
Business Capability
path lib/config-validator.js matches lib
This is a significant domain with 25 modules and 25 source files.
Key Modules
| Module | Purpose |
|---|---|
lib/config-validator.js | Utility and helper functions |
lib/decorate.js | Utility and helper functions |
lib/error-serializer.js | Utility and helper functions |
lib/error-status.js | Utility and helper functions |
lib/errors.js | Utility and helper functions |
Business Impact
- Change Frequency Impact: Medium โ Changes here affect 25 files
- Domain Complexity: Complex (multiple modules)
2. API Layer
Business Capability
path lib/error-handler.js matches handler
This is a focused domain with 3 modules and 3 source files.
Key Modules
| Module | Purpose |
|---|---|
lib/error-handler.js | Utility and helper functions |
lib/log-controller.js | Utility and helper functions |
lib/schema-controller.js | Utility and helper functions |
Business Impact
- Change Frequency Impact: Low โ Changes here affect 3 files
- Domain Complexity: Moderate
3. Content Management
Business Capability
path lib/content-type-parser.js matches content
This is a focused domain with 2 modules and 2 source files.
Key Modules
| Module | Purpose |
|---|---|
lib/content-type-parser.js | Utility and helper functions |
lib/content-type.js | Utility and helper functions |
Business Impact
- Change Frequency Impact: Low โ Changes here affect 2 files
- Domain Complexity: Simple
4. Other
Business Capability
Uncategorized module
This is a focused domain with 1 module and 1 source file.
Key Modules
| Module | Purpose |
|---|---|
root | Core application module |
Business Impact
- Change Frequency Impact: Low โ Changes here affect 1 file
- Domain Complexity: Simple
5. State Management
Business Capability
path lib/context.js matches context
This is a focused domain with 1 module and 1 source file.
Key Modules
| Module | Purpose |
|---|---|
lib/context.js | Utility and helper functions |
Business Impact
- Change Frequency Impact: Low โ Changes here affect 1 file
- Domain Complexity: Simple
Cross-Domain Dependencies
The following modules serve as shared infrastructure across multiple domains:
| Module | Consumers | Role |
|---|---|---|
lib/symbols | 20 modules | Utility and helper functions |
lib/errors | 18 modules | Utility and helper functions |
lib/hooks | 7 modules | Custom hooks and shared state logic |
lib/content-type | 5 modules | Utility and helper functions |
Cross-Domain Integration Points
These modules facilitate communication and data sharing between domains:
- `lib/symbols` serves as a central integration point, imported by 20 different modules. Changes to this module have wide-ranging impact and should be carefully coordinated.
- `lib/errors` serves as a central integration point, imported by 18 different modules. Changes to this module have wide-ranging impact and should be carefully coordinated.
- `lib/hooks` serves as a central integration point, imported by 7 different modules. Changes to this module have wide-ranging impact and should be carefully coordinated.
Domain Health Summary
| Metric | Value | Assessment |
|---|---|---|
| Total Domains | 5 | Well-balanced |
| Avg Files/Domain | 6 | Appropriate size |
| Largest Domain | Shared Utilities (25 files) | Consider breaking down |
| Domain Concentration | 78% in largest | โ ๏ธ High concentration |
Domain mapping is based on directory naming conventions and code organization patterns. Enable AI enhancement with `GITHUB_TOKEN` for business-language descriptions, stakeholder impact analysis, strategic recommendations, and cross-domain relationship narratives.
<!-- repolens:docs-badge -->  ยท Examples
Architecture Overview
Architectural Philosophy
Fastify follows a Plugin system โ `lib/plugin-override.js`, `lib/plugin-utils.js` architecture with elements of Shared utility layer โ `lib/plugin-utils.js`, `lib/config-validator.js`, `lib/content-type-parser.js` (+28 more), Acyclic dependency graph โ clean layering.
Pattern Analysis
Plugin system โ `lib/plugin-override.js`, `lib/plugin-utils.js`
The system supports extensibility through a plugin architecture allowing third-party additions.
Benefits: Extensibility, community contributions, core stability
Shared utility layer โ `lib/plugin-utils.js`, `lib/config-validator.js`, `lib/content-type-parser.js` (+28 more)
The system supports extensibility through a plugin architecture allowing third-party additions.
Benefits: Extensibility, community contributions, core stability
Acyclic dependency graph โ clean layering
The system operates as a command-line interface, accepting user input through terminal commands and producing structured output.
Benefits: Automation-friendly, scriptable, integrates with CI/CD pipelines
System Layers
The system is organized into 5 functional layers, each encapsulating a distinct area of responsibility:
| Layer | Responsibility | Scale | Key Insight |
|---|---|---|---|
| Shared Utilities | path `lib/config-validator | 25 files | Shared infrastructure โ high reuse |
| API Layer | path `lib/error-handler | 3 files | External interface โ versioning important |
| Content Management | path `lib/content-type-parser | 2 files | Standard domain |
| Other | Uncategorized module | 1 files | Standard domain |
| State Management | path `lib/context | 1 files | Standard domain |
Module Layers
Modules are classified into 2 architectural roles:
Other Modules
Role: General purpose functionality
| Module | Files | Description |
|---|---|---|
root | 1 | Core application module |
Shared Libraries
Role: Provides shared utilities and abstractions used across modules
| Module | Files | Description |
|---|---|---|
lib/config-validator.js | 1 | Utility and helper functions |
lib/content-type-parser.js | 1 | Utility and helper functions |
lib/content-type.js | 1 | Utility and helper functions |
lib/context.js | 1 | Utility and helper functions |
lib/decorate.js | 1 | Utility and helper functions |
| +9 more | โ | Additional modules |
Technology Foundation
| Layer | Technologies | Architectural Implication |
|---|---|---|
| Language | TypeScript, JavaScript | Static typing enables tooling and refactoring confidence |
Scale & Complexity Analysis
| Dimension | Value | Assessment |
|---|---|---|
| Total Files | 32 | medium project |
| Module Count | 32 | medium complexity |
| Domain Spread | 5 domains | Focused scope |
| Interface | CLI | Terminal-driven interaction |
Dependency Health
Architecture Health Score: ๐ข 95/100
| Metric | Value | Status | Recommendation |
|---|---|---|---|
| Import Edges | 108 | โ | Healthy module connectivity |
| External Packages | 15 | โ | Lean dependency set |
| Circular Deps | 0 | โ | Clean module boundaries |
| Orphan Files | 0 | โ | All code is connected |
Architectural Strengths
- Clean module boundaries โ No circular dependencies detected. This enables safe refactoring, isolated testing, and clear ownership boundaries.
- Fully connected codebase โ Every file is part of the dependency graph. No dead code or forgotten modules.
Concerns
- Central coupling hotspot โ
lib/symbolsis imported by 20 files (63%). Consider breaking into smaller modules. Priority: Medium.
Hub modules (most imported):
lib/symbolsโ imported by 20 fileslib/errorsโ imported by 18 fileslib/hooksโ imported by 7 fileslib/content-typeโ imported by 5 files
This architecture overview was generated from comprehensive dependency graph analysis and pattern detection. Enable AI enhancement with `GITHUB_TOKEN` for architectural narratives, design rationale explanations, scalability analysis, and refactoring recommendations.
<!-- repolens:docs-badge -->  ยท Examples
Module Catalog
A complete inventory of all code modules in the repository, organized by location and size. Each module represents a distinct area of responsibility within the codebase.
Total modules: 32
Module Inventory
| Module | Files | Role |
|---|---|---|
root | 1 | Application module |
lib/config-validator.js | 1 | Library code and third-party integrations |
lib/content-type-parser.js | 1 | Library code and third-party integrations |
lib/content-type.js | 1 | Library code and third-party integrations |
lib/context.js | 1 | Library code and third-party integrations |
lib/decorate.js | 1 | Library code and third-party integrations |
lib/error-handler.js | 1 | Library code and third-party integrations |
lib/error-serializer.js | 1 | Library code and third-party integrations |
lib/error-status.js | 1 | Library code and third-party integrations |
lib/errors.js | 1 | Library code and third-party integrations |
lib/four-oh-four.js | 1 | Library code and third-party integrations |
lib/handle-request.js | 1 | Library code and third-party integrations |
lib/head-route.js | 1 | Library code and third-party integrations |
lib/hooks.js | 1 | Hook callbacks |
lib/initial-config-validation.js | 1 | Library code and third-party integrations |
lib/log-controller.js | 1 | Library code and third-party integrations |
lib/logger-factory.js | 1 | Library code and third-party integrations |
lib/logger-pino.js | 1 | Library code and third-party integrations |
lib/noop-set.js | 1 | Library code and third-party integrations |
lib/plugin-override.js | 1 | Library code and third-party integrations |
lib/plugin-utils.js | 1 | Shared utilities and helper functions |
lib/reply.js | 1 | Library code and third-party integrations |
lib/req-id-gen-factory.js | 1 | Library code and third-party integrations |
lib/request.js | 1 | Library code and third-party integrations |
lib/route.js | 1 | Library code and third-party integrations |
lib/schema-controller.js | 1 | Library code and third-party integrations |
lib/schemas.js | 1 | Library code and third-party integrations |
lib/server.js | 1 | Library code and third-party integrations |
lib/symbols.js | 1 | Library code and third-party integrations |
lib/validation.js | 1 | Library code and third-party integrations |
lib/warnings.js | 1 | Library code and third-party integrations |
lib/wrap-thenable.js | 1 | Library code and third-party integrations |
Module detection is based on the `module_roots` setting in your RepoLens configuration. Adjust this setting to change how modules are grouped.
<!-- repolens:docs-badge -->  ยท Examples
Route Map
A complete listing of user-facing pages and backend API endpoints. This map shows every URL a user or client can interact with, along with the source file that handles each route.
Route Detection
This project is a CLI tool โ it does not expose HTTP routes or serve web pages. This is expected behavior, not a detection failure.
CLI tools interact through terminal commands rather than URLs. See the System Overview or Developer Onboarding documents for command documentation.
<!-- repolens:docs-badge -->  ยท Examples
API Surface
This page documents both the API endpoints the application exposes and the external services it integrates with. Use it as a reference for understanding the system's interfaces.
Internal API Endpoints
These are the backend services the application provides to handle incoming requests.
No API routes were detected in this scan. If your project uses a routing framework (Express, Fastify, NestJS, etc.), ensure the relevant directories are included in your scan.include patterns.
External API Integrations
Third-party services the application connects to, grouped by category.
No external API integrations were detected. This section populates automatically when RepoLens identifies SDK imports or API client usage in your codebase.
HTTP method reference โ GET: retrieve data, POST: create, PUT/PATCH: update, DELETE: remove.
<!-- repolens:docs-badge -->  ยท Examples
Data Flows
Understanding Data Movement
Data flows describe how information moves through Fastify โ from external inputs through processing layers to storage or presentation. Understanding these flows is essential for debugging, performance optimization, and architectural decisions.
Flow Summary
5 data flows identified in the codebase:
| Flow | Type | Complexity | Critical |
|---|---|---|---|
| fastify Request Flow | Integration | Low (2 steps) | ๐ด Yes |
| Content Delivery Flow | Integration | Medium (5 steps) | โ |
| symbols Integration Flow | Integration | Medium (5 steps) | ๐ด Yes |
| errors Integration Flow | Integration | Medium (5 steps) | ๐ด Yes |
| hooks Integration Flow | Integration | High (6 steps) | ๐ด Yes |
1. fastify Request Flow ๐ด CRITICAL FLOW
Description
Import chain starting from fastify โ traces how this entry point depends on 1 downstream module
Characteristics
| Property | Value |
|---|---|
| Steps | 2 |
| Modules Involved | 2 |
| Criticality | Critical |
Processing Steps
| Step | Action | Purpose |
|---|---|---|
| 1 | fastify (entry point, imports 18 modules) | Data acquisition |
| 2 | symbols (shared infrastructure, used by 20 files) | Processing step |
Flow Diagram
โโ START โโ
โ `fastify` (entry point, imports 18 modules) โ
โ โ
โ `symbols` (shared infrastructure, used by 20 fi... โ
โโ END โโโโ
Involved Modules
| Module | Role |
|---|---|
fastify | Core application module |
symbols | Utility and helper functions |
Dependencies
Shared libraries used: lib/config-validator.js, lib/content-type-parser.js, lib/content-type.js, lib/context.js, lib/decorate.js
Insights
- โ ๏ธ Critical path โ Failures here have significant business impact
- ๐ Consider adding monitoring and alerting
- ๐งช Ensure comprehensive test coverage
2. Content Delivery Flow
Description
Research articles and content are fetched and displayed to users
Characteristics
| Property | Value |
|---|---|
| Steps | 5 |
| Modules Involved | 2 |
| Criticality | Standard |
Processing Steps
| Step | Action | Purpose |
|---|---|---|
| 1 | User browses content sections | Processing step |
| 2 | Content components load articles | Data acquisition |
| 3 | Articles may be fetched from CMS or database | Data acquisition |
| 4 | Content is rendered with formatting | Output generation |
| 5 | User can interact with content features | Processing step |
Flow Diagram
โโ START โโ
โ User browses content sections โ
โ โ
โ Content components load articles โ
โ โ
โ Articles may be fetched from CMS or database โ
โ โ
โ Content is rendered with formatting โ
โ โ
โ User can interact with content features โ
โโ END โโโโ
Involved Modules
| Module | Role |
|---|---|
content-type-parser.js | Utility and helper functions |
content-type.js | Utility and helper functions |
Dependencies
Shared libraries used: lib/config-validator.js, lib/content-type-parser.js, lib/content-type.js, lib/context.js, lib/decorate.js
External services: Content management system
Insights
- Standard integration flow with 5 processing steps
3. symbols Integration Flow ๐ด CRITICAL FLOW
Description
lib/symbols is a central module imported by 20 files, acting as an integration point for data and logic
Characteristics
| Property | Value |
|---|---|
| Steps | 5 |
| Modules Involved | 4 |
| Criticality | Critical |
Processing Steps
| Step | Action | Purpose |
|---|---|---|
| 1 | fastify imports symbols | Data acquisition |
| 2 | content-type-parser imports symbols | Data acquisition |
| 3 | context imports symbols | Data acquisition |
| 4 | decorate imports symbols | Data acquisition |
| 5 | error-handler imports symbols | Data acquisition |
Flow Diagram
โโ START โโ
โ `fastify` imports `symbols` โ
โ โ
โ `content-type-parser` imports `symbols` โ
โ โ
โ `context` imports `symbols` โ
โ โ
โ `decorate` imports `symbols` โ
โ โ
โ `error-handler` imports `symbols` โ
โโ END โโโโ
Involved Modules
| Module | Role |
|---|---|
symbols | Utility and helper functions |
fastify | Core application module |
content-type-parser | Utility and helper functions |
context | Utility and helper functions |
Dependencies
Shared libraries used: lib/config-validator.js, lib/content-type-parser.js, lib/content-type.js, lib/context.js, lib/decorate.js
Insights
- โ ๏ธ Critical path โ Failures here have significant business impact
- ๐ Consider adding monitoring and alerting
- ๐งช Ensure comprehensive test coverage
4. errors Integration Flow ๐ด CRITICAL FLOW
Description
lib/errors is a central module imported by 18 files, acting as an integration point for data and logic
Characteristics
| Property | Value |
|---|---|
| Steps | 5 |
| Modules Involved | 4 |
| Criticality | Critical |
Processing Steps
| Step | Action | Purpose |
|---|---|---|
| 1 | fastify imports errors | Data acquisition |
| 2 | content-type-parser imports errors | Data acquisition |
| 3 | context imports errors | Data acquisition |
| 4 | decorate imports errors | Data acquisition |
| 5 | error-handler imports errors | Data acquisition |
Flow Diagram
โโ START โโ
โ `fastify` imports `errors` โ
โ โ
โ `content-type-parser` imports `errors` โ
โ โ
โ `context` imports `errors` โ
โ โ
โ `decorate` imports `errors` โ
โ โ
โ `error-handler` imports `errors` โ
โโ END โโโโ
Involved Modules
| Module | Role |
|---|---|
errors | Utility and helper functions |
fastify | Core application module |
content-type-parser | Utility and helper functions |
context | Utility and helper functions |
Dependencies
Shared libraries used: lib/config-validator.js, lib/content-type-parser.js, lib/content-type.js, lib/context.js, lib/decorate.js
Insights
- โ ๏ธ Critical path โ Failures here have significant business impact
- ๐ Consider adding monitoring and alerting
- ๐งช Ensure comprehensive test coverage
5. hooks Integration Flow ๐ด CRITICAL FLOW
Description
lib/hooks is a central module imported by 7 files, acting as an integration point for data and logic
Characteristics
| Property | Value |
|---|---|
| Steps | 6 |
| Modules Involved | 4 |
| Criticality | Critical |
Processing Steps
| Step | Action | Purpose |
|---|---|---|
| 1 | fastify imports hooks | Data acquisition |
| 2 | four-oh-four imports hooks | Data acquisition |
| 3 | handle-request imports hooks | Data acquisition |
| 4 | plugin-override imports hooks | Data acquisition |
| 5 | reply imports hooks | Data acquisition |
| 6 | hooks depends on errors, symbols | Processing step |
Flow Diagram
โโ START โโ
โ `fastify` imports `hooks` โ
โ โ
โ `four-oh-four` imports `hooks` โ
โ โ
โ `handle-request` imports `hooks` โ
โ โ
โ `plugin-override` imports `hooks` โ
โ โ
โ `reply` imports `hooks` โ
โ โ
โ `hooks` depends on `errors`, `symbols` โ
โโ END โโโโ
Involved Modules
| Module | Role |
|---|---|
hooks | Custom hooks and shared state logic |
fastify | Core application module |
four-oh-four | Utility and helper functions |
handle-request | Utility and helper functions |
Dependencies
Shared libraries used: lib/config-validator.js, lib/content-type-parser.js, lib/content-type.js, lib/context.js, lib/decorate.js
Insights
- โ ๏ธ Critical path โ Failures here have significant business impact
- ๐ Consider adding monitoring and alerting
- ๐งช Ensure comprehensive test coverage
Import Network
The system has 108 internal import edges connecting 32 source files.
Network Topology
| Metric | Value | Meaning |
|---|---|---|
| Total Edges | 108 | Direct import relationships |
| Hub Count | 4 | Central integration points |
| Avg Connections | ~3.4 per file | Coupling density |
Key Integration Points
These modules aggregate data from multiple sources:
| Hub | Inbound | Role |
|---|---|---|
symbols | 20 files | Utility and helper functions |
errors | 18 files | Utility and helper functions |
hooks | 7 files | Custom hooks and shared state logic |
content-type | 5 files | Utility and helper functions |
Flow detection uses naming conventions, import patterns, and dependency graph analysis. Enable AI enhancement with `GITHUB_TOKEN` for end-to-end flow narratives, failure mode analysis, data transformation descriptions, and performance bottleneck identification.
<!-- repolens:docs-badge -->  ยท Examples
Architecture Diff
No changes detected.
<!-- repolens:docs-badge -->  ยท Examples
System Map
What is this? This visual diagram shows how different parts of your codebase connect to each other. Arrows indicate dependencies (which modules use which).
Showing: 30 modules and 83 relationships
Source: Real import analysis
Architecture Diagram
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐๏ธ SYSTEM ARCHITECTURE MAP โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ ๏ธ UTILITIES
โ
โโโ config-validator.js (1 file)
โโโ content-type-parser.js (1 file)
โ โ content-type.js
โ โ symbols.js
โ โ errors.js
โโโ content-type.js (1 file)
โโโ context.js (1 file)
โ โ symbols.js
โ โ errors.js
โโโ decorate.js (1 file)
โ โ symbols.js
โ โ errors.js
โโโ error-handler.js (1 file)
โ โ error-status.js
โ โ symbols.js
โ โ errors.js
โ ... +2 more
โโโ error-serializer.js (1 file)
โโโ error-status.js (1 file)
โ โ symbols.js
โโโ errors.js (1 file)
โโโ four-oh-four.js (1 file)
โ โ reply.js
โ โ request.js
โ โ context.js
โ ... +6 more
โโโ handle-request.js (1 file)
โ โ validation.js
โ โ hooks.js
โ โ errors.js
โ ... +3 more
โโโ head-route.js (1 file)
โโโ hooks.js (1 file)
โ โ errors.js
โ โ symbols.js
โโโ initial-config-validation.js (1 file)
โ โ config-validator.js
โ โ errors.js
โโโ log-controller.js (1 file)
โโโ logger-factory.js (1 file)
โ โ errors.js
โ โ symbols.js
โ โ log-controller.js
โ ... +1 more
โโโ logger-pino.js (1 file)
โ โ errors.js
โโโ noop-set.js (1 file)
โโโ plugin-override.js (1 file)
โ โ symbols.js
โ โ reply.js
โ โ request.js
โ ... +4 more
โโโ plugin-utils.js (1 file)
โ โ symbols.js
โ โ decorate.js
โ โ errors.js
โโโ reply.js (1 file)
โ โ symbols.js
โ โ hooks.js
โ โ handle-request.js
โ ... +6 more
โโโ req-id-gen-factory.js (1 file)
โ โ symbols.js
โโโ request.js (1 file)
โ โ symbols.js
โ โ errors.js
โ โ decorate.js
โ ... +1 more
โโโ route.js (1 file)
โ โ context.js
โ โ handle-request.js
โ โ hooks.js
โ ... +9 more
โโโ schema-controller.js (1 file)
โ โ schemas.js
โโโ schemas.js (1 file)
โ โ symbols.js
โ โ errors.js
โ โ content-type.js
โโโ server.js (1 file)
โ โ symbols.js
โ โ hooks.js
โ โ errors.js
โ ... +1 more
โโโ symbols.js (1 file)
โโโ validation.js (1 file)
โ symbols.js
โ errors.js
โ
๐ฆ OTHER
โ
โโโ root (1 file)
โ
Legend:
โ imports / depends on
โโ tests
Key Connections
Most depended-on modules (highest import count):
| Module | Imported by |
|---|---|
lib/symbols.js | 18 modules |
lib/errors.js | 17 modules |
lib/hooks.js | 6 modules |
lib/content-type.js | 5 modules |
lib/schemas.js | 4 modules |
Most dependent modules (highest dependency count):
| Module | Depends on |
|---|---|
lib/route.js | 12 modules |
lib/four-oh-four.js | 9 modules |
lib/reply.js | 9 modules |
lib/plugin-override.js | 7 modules |
lib/handle-request.js | 6 modules |
<!-- repolens:docs-badge -->  ยท Examples
Developer Onboarding
Welcome to Fastify! ๐
This guide will help you get up to speed quickly. Fastify is a general-purpose tools project built with TypeScript, JavaScript, containing 32 modules across 32 files.
What You'll Learn
- โ Repository structure and organization
- โ Technology stack and tools
- โ Key modules to understand first
- โ How data flows through the system
- โ How to start contributing
Quick Reference Card
| Aspect | Details |
|---|---|
| Languages | TypeScript, JavaScript |
| Frameworks | general-purpose tools |
| Build Tools | Standard toolchain |
| Size | 32 modules, 32 files |
| Domains | 5 functional areas |
| Type | Command-line interface |
Repository Structure
Understanding the directory layout is your first step to navigating the codebase:
| Directory | Purpose | Start Here? |
|---|---|---|
lib | Application source code | โญ Yes |
Where to Begin
Focus on these directories first:
- `lib` โ Application source code
Technology Stack
| Layer | Technologies | What to Learn |
|---|---|---|
| Language | TypeScript, JavaScript | Strong typing โ check types when debugging |
Core Modules to Understand
These are the most important modules by size and centrality. Understanding them will unlock the rest of the codebase:
| Priority | Module | Files | Type | Why It Matters |
|---|---|---|---|---|
| โญ High | root | 1 | Other Modules | Key system component |
| โญ High | lib/config-validator.js | 1 | Shared Libraries | Shared code โ reused throughout |
| โญ High | lib/content-type-parser.js | 1 | Shared Libraries | Shared code โ reused throughout |
| Medium | lib/content-type.js | 1 | Shared Libraries | Shared code โ reused throughout |
| Medium | lib/context.js | 1 | Shared Libraries | Shared code โ reused throughout |
| Medium | lib/decorate.js | 1 | Shared Libraries | Shared code โ reused throughout |
| Low | lib/error-handler.js | 1 | Shared Libraries | Shared code โ reused throughout |
| Low | lib/error-serializer.js | 1 | Shared Libraries | Shared code โ reused throughout |
| Low | lib/error-status.js | 1 | Shared Libraries | Shared code โ reused throughout |
| Low | lib/errors.js | 1 | Shared Libraries | Shared code โ reused throughout |
Key Integration Points
These modules are imported by many other files. Changes here have wide impact:
- `lib/symbols` โ Used by 20 files โ Utility and helper functions
- `lib/errors` โ Used by 18 files โ Utility and helper functions
- `lib/hooks` โ Used by 7 files โ Custom hooks and shared state logic
- `lib/content-type` โ Used by 5 files โ Utility and helper functions
โ ๏ธ Caution: Be extra careful when modifying these files. Consider the ripple effects.
How Data Flows
Understanding these flows helps you see how the system processes information end-to-end:
| Flow | Description | Key Modules |
|---|---|---|
| fastify Request Flow | Import chain starting from fastify โ traces how this entry... | fastify, symbols |
| Content Delivery Flow | Research articles and content are fetched and displayed to u... | content-type-parser.js, content-type.js |
Debugging tip: When investigating issues, trace the data flow from input to output to identify where problems occur.
Getting Started Checklist
Follow these steps to set up your development environment:
1. Clone and Install
git clone <repository-url>
cd fastify
npm install # or yarn, pnpm
2. Explore the Structure
- Review the directory structure above
- Open the
README.mdfor project-specific instructions - Look for
CONTRIBUTING.mdfor contribution guidelines
3. Understand Core Modules
Start with the high-priority modules listed above. Read the code and comments to understand:
- What problem each module solves
- How modules interact with each other
- What data structures are used
4. Make Your First Change
Start small:
- Find a small bug or typo to fix
- Make the change in a feature branch
- Run tests to ensure nothing breaks
- Submit a pull request for review
Common Pitfalls
New contributors often run into these issues:
- High-impact modules โ
symbolsis used by 63% of the codebase. Changes here need thorough testing. - Environment setup โ Check for
.env.examplefiles and ensure you have all required environment variables. - Branch naming โ Follow the team's branch naming conventions (usually
feature/,fix/,docs/).
Additional Resources
| Resource | Purpose |
|---|---|
README.md | Project overview and quick start |
CONTRIBUTING.md | Contribution guidelines (if exists) |
CHANGELOG.md | Recent changes and release history |
package.json | Available scripts and dependencies |
This onboarding guide was generated from comprehensive repository analysis. Enable AI enhancement with `GITHUB_TOKEN` for narrative walkthroughs, common pitfall documentation, debugging tips, architecture deep-dives, and personalized contribution recommendations.
Welcome to the team! Happy coding! ๐
<!-- repolens:docs-badge -->  ยท Examples
GraphQL Schema
No GraphQL schema was detected in this repository.
RepoLens scans for .graphql and .gql schema files, inline SDL via tagged template literals (e.g. gql\...\``), resolver patterns, and popular GraphQL libraries including Apollo, Yoga, Nexus, Pothos, Mercurius, type-graphql, Relay, and urql.
If your project uses GraphQL, ensure the relevant source directories are included in your scan.include configuration.
<!-- repolens:docs-badge -->  ยท Examples
TypeScript Type Graph
No TypeScript type declarations were detected in this repository.
RepoLens analyzes .ts and .tsx files for interface declarations, type aliases, classes, and enums. Ensure your TypeScript source directories are included in the scan.include configuration.
<!-- repolens:docs-badge -->  ยท Examples
Dependency Graph
32 files ยท 108 imports ยท 15 external packages ยท โ no circular dependencies
This document maps every import relationship in the codebase, identifies the most-connected modules, and flags circular dependencies that may complicate refactoring or increase build times.
Overview
| Metric | Value |
|---|---|
| Source files | 32 |
| Import edges | 108 |
| External packages | 15 |
| Circular dependencies | 0 |
| Orphan files (no imports or importers) | 0 |
Hub Modules
These are the most-imported modules in the codebase. Changes to hub modules have the widest blast radius and should be reviewed carefully:
| Module | Imported By |
|---|---|
lib/symbols | 20 files |
lib/errors | 18 files |
lib/hooks | 7 files |
lib/content-type | 5 files |
External Dependencies
The codebase imports 15 external packages. These are third-party modules (not the language standard library):
| Package |
| --------- |
@fastify/ajv-compiler |
@fastify/error |
@fastify/fast-json-stringify-compiler |
@fastify/proxy-addr |
abstract-logging |
avvio |
fast-json-stringify |
find-my-way |
light-my-request |
pino |
process-warning |
rfdc |
secure-json-parse |
semver |
toad-cache |
Generated by RepoLens import analysis. Dependency detection covers JavaScript and TypeScript (ES modules, dynamic import, CommonJS, re-exports; comments, strings, and type-only imports are skipped), Python (`import` / `from ... import`, including relative imports), and Go (`go.mod` module paths). Go `_test.go` files are not part of the graph.*
<!-- repolens:docs-badge -->  ยท Examples
Architecture Drift
No baseline found. Run
repolens publishonce to establish a baseline.
A baseline snapshot of the current architecture has been saved. On subsequent runs, this report will track structural changes across the following dimensions:
| Dimension | What is Tracked |
|---|---|
| Modules | New, removed, or significantly resized modules |
| API Endpoints | Added or removed backend routes |
| Dependencies | Changes to external package imports |
| Frameworks | Technology stack additions or removals |
| Circular Dependencies | Increases in dependency cycles |
| GraphQL Schema | Type additions or removals |
| Codebase Scale | Overall file count changes |
<!-- repolens:docs-badge -->  ยท Examples
Security Hotspots
19 security finding(s) ยท 19 low severity ยท across 11 file(s)
This report identifies code patterns that are commonly associated with security vulnerabilities. Each finding includes the relevant CWE classification and a recommended remediation.
Severity Overview
| Severity | Count |
|---|---|
| ๐ต Low | 19 |
32 source files scanned ยท 11 files with findings
Prototype Pollution
Deep merge utilities may be vulnerable to prototype pollution if they don't check hasOwnProperty. Verify the implementation.
| File | Line | Pattern | Severity | CWE |
|---|---|---|---|---|
fastify.js | 784 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
fastify.js | 894 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
fastify.js | 914 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
fastify.js | 977 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
lib/four-oh-four.js | 150 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
lib/logger-factory.js | 100 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
lib/logger-factory.js | 126 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
lib/logger-pino.js | 34 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
lib/plugin-override.js | 64 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
lib/request.js | 284 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
lib/route.js | 163 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
lib/route.js | 288 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
lib/route.js | 674 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
lib/schema-controller.js | 16 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
lib/schema-controller.js | 89 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
lib/schema-controller.js | 111 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
lib/schemas.js | 41 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
lib/server.js | 172 | Recursive object merge without prototype check | ๐ต Low | CWE-1321 |
ReDoS
Dynamic regex construction from user input can cause ReDoS. Use static regex or input validation.
| File | Line | Pattern | Severity | CWE |
|---|---|---|---|---|
lib/config-validator.js | 8 | Potentially catastrophic regex | ๐ต Low | CWE-1333 |
Affected Files
fastify.jslib/config-validator.jslib/four-oh-four.jslib/logger-factory.jslib/logger-pino.jslib/plugin-override.jslib/request.jslib/route.jslib/schema-controller.jslib/schemas.jslib/server.js
Generated by RepoLens security pattern analysis. Detection is regex-based and may produce false positives. Findings should be triaged by a security-aware engineer.
<!-- repolens:docs-badge -->  ยท Examples
Code Health Report
32 files analyzed ยท Average health: 75/100 ยท 15 A, 7 B, 10 C, 0 D, 0 F
This report synthesizes complexity, coupling, documentation, and security signals into a single health score per module. Lower scores indicate higher risk and maintenance burden.
Overview
| Metric | Value |
|---|---|
| Files analyzed | 32 |
| Average health score | 75/100 |
| Average complexity | 51 |
| Hotspots (score < 60) | 10 |
Grade Distribution
| Grade | Count | Meaning |
|---|---|---|
| ๐ข A (80โ100) | 15 | Healthy โ low complexity, well-documented |
| ๐ต B (60โ79) | 7 | Acceptable โ minor improvements possible |
| ๐ก C (40โ59) | 10 | Needs attention โ elevated complexity or coupling |
| ๐ D (20โ39) | 0 | At risk โ multiple quality signals degraded |
| ๐ด F (0โ19) | 0 | Critical โ immediate refactoring recommended |
Hotspots โ Priority Refactoring Targets
These modules have the lowest health scores and should be prioritized for improvement:
| Module | Score | Grade | Complexity | Coupling | Doc% | Security |
|---|---|---|---|---|---|---|
lib/reply.js | 44 | ๐ก C | 185 | 3โ 9โ | โ | โ |
fastify.js | 45 | ๐ก C | 119 | 0โ 18โ | โ | 4 (0 high) |
lib/config-validator.js | 45 | ๐ก C | 438 | 1โ 0โ | โ | 1 (0 high) |
lib/content-type-parser.js | 45 | ๐ก C | 67 | 2โ 4โ | โ | โ |
lib/request.js | 45 | ๐ก C | 56 | 3โ 4โ | โ | 1 (0 high) |
lib/route.js | 45 | ๐ก C | 146 | 1โ 12โ | โ | 3 (0 high) |
lib/schemas.js | 45 | ๐ก C | 49 | 4โ 3โ | โ | 1 (0 high) |
lib/server.js | 45 | ๐ก C | 62 | 1โ 5โ | โ | 1 (0 high) |
lib/validation.js | 45 | ๐ก C | 145 | 2โ 3โ | โ | โ |
lib/handle-request.js | 55 | ๐ก C | 35 | 2โ 7โ | โ | โ |
Most Complex Functions
These functions have the highest cyclomatic complexity and are the most likely sources of bugs:
| Function | File | Line | Complexity |
|---|---|---|---|
validate10() | lib/config-validator.js | 10 | 438 |
Reply() | lib/reply.js | 66 | 77 |
addNewRoute() | lib/route.js | 277 | 61 |
lowerCaseHeadersSchema() | lib/validation.js | 78 | 52 |
onSendEnd() | lib/reply.js | 599 | 34 |
ContentTypeParser() | lib/content-type-parser.js | 33 | 32 |
onAbort() | lib/request.js | 228 | 32 |
anonymous0() | lib/error-serializer.js | 44 | 28 |
addHook() | fastify.js | 600 | 27 |
validate() | lib/validation.js | 387 | 23 |
_findRoute() | fastify.js | 236 | 22 |
processOptions() | fastify.js | 888 | 22 |
route() | lib/route.js | 206 | 22 |
buildSchemaController() | lib/schema-controller.js | 11 | 22 |
compileSchemasForValidation() | lib/validation.js | 273 | 21 |
All Modules by Health Score
| Module | Score | Grade | Lines | Complexity | Fan-In | Fan-Out |
|---|---|---|---|---|---|---|
lib/reply.js | 44 | ๐ก C | 1099 | 185 | 3 | 9 |
fastify.js | 45 | ๐ก C | 1044 | 119 | 0 | 18 |
lib/config-validator.js | 45 | ๐ก C | 1189 | 438 | 1 | 0 |
lib/content-type-parser.js | 45 | ๐ก C | 447 | 67 | 2 | 4 |
lib/request.js | 45 | ๐ก C | 403 | 56 | 3 | 4 |
lib/route.js | 45 | ๐ก C | 702 | 146 | 1 | 12 |
lib/schemas.js | 45 | ๐ก C | 218 | 49 | 4 | 3 |
lib/server.js | 45 | ๐ก C | 441 | 62 | 1 | 5 |
lib/validation.js | 45 | ๐ก C | 519 | 145 | 2 | 3 |
lib/handle-request.js | 55 | ๐ก C | 218 | 35 | 2 | 7 |
lib/decorate.js | 60 | ๐ต B | 161 | 41 | 4 | 2 |
lib/hooks.js | 60 | ๐ต B | 434 | 58 | 7 | 2 |
lib/schema-controller.js | 73 | ๐ต B | 165 | 22 | 2 | 1 |
lib/content-type.js | 75 | ๐ต B | 215 | 20 | 5 | 0 |
lib/plugin-utils.js | 77 | ๐ต B | 170 | 31 | 2 | 3 |
lib/four-oh-four.js | 79 | ๐ต B | 182 | 21 | 1 | 9 |
lib/wrap-thenable.js | 79 | ๐ต B | 85 | 16 | 2 | 2 |
lib/log-controller.js | 81 | ๐ข A | 168 | 15 | 1 | 0 |
lib/error-handler.js | 82 | ๐ข A | 156 | 24 | 4 | 6 |
lib/error-serializer.js | 85 | ๐ข A | 135 | 4 | 1 | 0 |
lib/logger-factory.js | 87 | ๐ข A | 158 | 19 | 4 | 4 |
lib/context.js | 91 | ๐ข A | 97 | 13 | 3 | 2 |
lib/plugin-override.js | 97 | ๐ข A | 92 | 13 | 1 | 7 |
lib/error-status.js | 100 | ๐ข A | 17 | 7 | 3 | 1 |
lib/errors.js | 100 | ๐ข A | 556 | 1 | 18 | 0 |
lib/head-route.js | 100 | ๐ข A | 46 | 7 | 1 | 0 |
lib/initial-config-validation.js | 100 | ๐ข A | 38 | 7 | 2 | 2 |
lib/logger-pino.js | 100 | ๐ข A | 69 | 8 | 1 | 1 |
lib/noop-set.js | 100 | ๐ข A | 11 | 1 | 1 | 0 |
lib/req-id-gen-factory.js | 100 | ๐ข A | 56 | 4 | 3 | 1 |
lib/symbols.js | 100 | ๐ข A | 74 | 1 | 20 | 0 |
lib/warnings.js | 100 | ๐ข A | 59 | 1 | 3 | 0 |
Scoring Methodology
The health score (0โ100) is computed from four dimensions:
| Factor | Weight | How It's Measured |
|---|---|---|
| Complexity | โ1/pt above 10, โ2/pt above 30 | Cyclomatic complexity for JavaScript/TypeScript, Python, and Go (regex, not AST) |
| Function complexity | โ2/pt above 8 per function | Highest complexity function in the file |
| Coupling | โ1/5 units above 20 | Fan-in ร Fan-out (import connections) |
| Documentation | โ10 if <50%, โ5 if <80% | JSDoc/TSDoc coverage of exports |
| Security | โ10/high, โ5/medium finding | Security anti-pattern findings in file |
Generated by RepoLens code health analysis. Complexity covers JavaScript/TypeScript, Python, and Go. It is regex-based and may differ from AST-based tools. Scores are relative indicators, not absolute quality measures.
<!-- repolens:docs-badge -->  ยท Examples