RepoLens

Gallery · Architecture explained · Score · TypeScript

SvelteKit architecture: modules, API surface, dependency graph

Web development, streamlined. Generated from sveltejs/kit at cb758b6, MIT.

Scanned packages/kit. Adapters and playgrounds are not included.

Files
205
Modules
11
API routes
0
Documents
17

Node.jsJavaScript

Executive Summary

Stakeholders · High-level overview for leadership, product, and stakeholders

At a Glance

AspectSummary
WhatSvelteKit is a well-structured command-line tool
Built Withgeneral-purpose + Node.js, JavaScript
Scale11 modules across 205 files
MaturityWell-structured (2/3 indicators)

What This System Does

SvelteKit is a general-purpose command-line tool built with Node.js, 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 6 functional domains, each representing a distinct business capability:

DomainCapabilityScale
OtherUncategorized module6 modules, 136 files
Core Enginepath packages/kit/src/core matches core1 modules, 31 files
Shared Utilitiespath packages/kit/src/utils matches util1 modules, 25 files
Notificationspath packages/kit/src/messages matches message1 modules, 11 files
CLI & Commandspath packages/kit/src/cli.js matches cli1 modules, 1 files
Configurationpath packages/kit/src/constants.js matches constant1 modules, 1 files

Technical Foundation

LayerTechnologiesPurpose
LanguageNode.js, JavaScriptPrimary development language
BuildViteCompilation and bundling
TestingVitestQuality assurance

Module Composition

The codebase follows a layered architecture with clear separation of concerns:

LayerCountKey ModulesResponsibility
Other Modules7runtime, messagesGeneral purpose functionality
core1coreSupporting application functionality
publisher1exportsSupporting application functionality
Shared Libraries1utilsProvides shared utilities and abstractions used across modules
cli1cli.jsSupporting application functionality

Monorepo Structure

This is a pnpm workspaces monorepo containing 45 packages. This structure enables:

  • Independent versioning and deployment of packages
  • Shared code reuse across internal projects
  • Coordinated development with clear ownership boundaries

Key packages:

  • @sveltejs/kit — packages/kit
  • test-write-types-actions — packages/kit/src/core/sync/write_types/test/actions
  • test-write-types-app-types — packages/kit/src/core/sync/write_types/test/app-types
  • test-write-types-layout — packages/kit/src/core/sync/write_types/test/layout
  • test-write-types-layout-advanced — packages/kit/src/core/sync/write_types/test/layout-advanced
  • test-write-types-param-type-inference — packages/kit/src/core/sync/write_types/test/param-type-inference

Codebase Health

Overall Health: 🟡 70/100

MetricValueStatus
Internal imports607 edges✅ Connected
External Packages14✅ Manageable
Circular Dependencies4🔴 4 detected
Orphan Files13⚠️ 13 unused
Key Insights
  • 🔴 Architectural concern — 4 circular dependencies detected. These create tight coupling and make testing difficult.
  • ✅ Healthy coupling — Most-imported module (packages/kit/src/messages/server-errors) serves 27 files without excessive centralization.

Key Data Flows

The system processes information through 5 identified flows:

  • client Command Flow (critical) — Import chain starting from packages/kit/src/runtime/client/client — traces how this entry point depends on 3 downstream modules
  • vite Request Flow (critical) — Import chain starting from packages/kit/src/exports/vite — traces how this entry point depends on 1 downstream module
  • prerender Request Flow (critical) — Import chain starting from packages/kit/src/core/postbuild/prerender — traces how this entry point depends on 3 downstream modules
  • analyse Request Flow (critical) — Import chain starting from packages/kit/src/core/postbuild/analyse — traces how this entry point depends on 2 downstream modules
  • client Command Flow (critical) — Import chain starting from packages/kit/src/runtime/app/forms/client — traces how this entry point depends on 3 downstream modules

Strategic Observations

  • The codebase follows Core/kernel architecture — `packages/kit/src/core`; high fan-in, CLI tool architecture — `packages/kit/src/cli.js`, Shared utility layer — `packages/kit/src/utils`; high fan-in, ⚠️ 4 circular dependency cycle(s) detected architectural patterns, providing a familiar structure for developers.
  • With 6 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 --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

System Overview

Mixed audience · Concise technical overview readable by all

The Big Picture

SvelteKit is a focused codebase with a clear purpose, containing 11 modules spread across 205 files.

DimensionDetails
Total Files205
Module Count11
Functional Domains6
Interface TypeCommand-Line Tool

Technology Stack

The system is built on a modern technology foundation:

LayerTechnologiesPurpose
LanguageNode.js, JavaScriptPrimary development language
BuildViteCompilation and asset processing
QualityVitestAutomated testing

Architecture Patterns

The codebase follows 4 identified architectural patterns:

  • Core/kernel architecture — `packages/kit/src/core`; high fan-in — A structured approach to organizing code and managing complexity.
  • CLI tool architecture — `packages/kit/src/cli.js` — The system operates as a command-line interface, accepting user input through terminal commands and producing structured output.
  • Shared utility layer — `packages/kit/src/utils`; high fan-in — A structured approach to organizing code and managing complexity.
  • ⚠️ 4 circular dependency cycle(s) detected — A structured approach to organizing code and managing complexity.

Module Architecture

The system is organized into 5 architectural layers:

LayerModulesKey ExamplesResponsibility
Other Modules7runtime, messagesGeneral purpose functionality
core1coreSupporting application functionality
publisher1exportsSupporting application functionality
Shared Libraries1utilsProvides shared utilities and abstractions used across modules
cli1cli.jsSupporting application functionality
Layer Details

Other Modules — 7 modules

  • packages/kit/src/runtime — 105 files — Core application module
  • packages/kit/src/messages — 11 files — Core application module
  • packages/kit/src/constants.js — 1 files — Core application module
  • packages/kit/src/pathname.js — 1 files — Core application module
  • +3 more modules

core — 1 module

  • packages/kit/src/core — 31 files — Core application module

publisher — 1 module

  • packages/kit/src/exports — 27 files — Core application module

Shared Libraries — 1 module

  • packages/kit/src/utils — 25 files — Utility and helper functions

cli — 1 module

  • packages/kit/src/cli.js — 1 files — Core application module

Functional Domains

The following domains represent the largest functional areas by file count:

RankDomainScaleBusiness Capability
1Other136 filesUncategorized module
2Core Engine31 filespath packages/kit/src/core matches core
3Shared Utilities25 filespath packages/kit/src/utils matches util
4Notifications11 filespath packages/kit/src/messages matches message
5CLI & Commands1 filespath packages/kit/src/cli.js matches cli
6Configuration1 filespath packages/kit/src/constants.js matches constant

Dependency Graph

Codebase Health: 🟡 70/100

MetricValueAssessment
Internal Imports607Modules are connected
External Packages14Lean dependencies
Circular Dependencies4⚠️ Needs attention
Orphan Files13⚠️ 13 unused

Hub modules (most imported):

  • packages/kit/src/messages/server-errors — imported by 27 files
  • packages/kit/src/utils/functions — imported by 23 files
  • packages/kit/src/utils/os — imported by 21 files

Monorepo Structure

This is a pnpm workspaces monorepo containing 45 packages:

PackageLocationDescription
@sveltejs/kitpackages/kitPackage functionality
test-write-types-actionspackages/kit/src/core/sync/write_types/test/actionsTesting utilities
test-write-types-app-typespackages/kit/src/core/sync/write_types/test/app-typesFrontend application
test-write-types-layoutpackages/kit/src/core/sync/write_types/test/layoutTesting utilities
test-write-types-layout-advancedpackages/kit/src/core/sync/write_types/test/layout-advancedTesting utilities
test-write-types-param-type-inferencepackages/kit/src/core/sync/write_types/test/param-type-inferenceTesting utilities
test-write-types-simple-page-server-and-sharedpackages/kit/src/core/sync/write_types/test/simple-page-server-and-sharedBackend/API server
test-write-types-simple-page-server-onlypackages/kit/src/core/sync/write_types/test/simple-page-server-onlyBackend/API server
+12 more—Additional packages

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 --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

Business Domains

Mixed audience · Codebase structure translated into business language

Overview

SvelteKit is organized into 6 functional domains, each representing a distinct area of business capability. This document maps the technical structure to business-oriented functional areas.

Quick Reference:

DomainModulesFilesPrimary Capability
Other6136Supporting business operations
Core Engine131Supporting business operations
Shared Utilities125Cross-cutting utility functions
Notifications111User notifications and messaging
CLI & Commands11Supporting business operations
Configuration11Application configuration

1. Other

Business Capability

Uncategorized module

This is a major domain with 6 modules and 136 source files.

Key Modules
ModulePurpose
packages/kit/src/runtimeCore application module
packages/kit/src/exportsCore application module
packages/kit/src/pathname.jsCore application module
packages/kit/src/runner.jsCore application module
packages/kit/src/telemetry.jsCore application module
Business Impact
  • Change Frequency Impact: High — Changes here affect 136 files
  • Domain Complexity: Complex (multiple modules)
  • Recommendation: Ensure comprehensive testing before modifying this domain

2. Core Engine

Business Capability

path packages/kit/src/core matches core

This is a significant domain with 1 module and 31 source files.

Key Modules
ModulePurpose
packages/kit/src/coreCore application module
Business Impact
  • Change Frequency Impact: Medium — Changes here affect 31 files
  • Domain Complexity: Simple

3. Shared Utilities

Business Capability

path packages/kit/src/utils matches util

This is a significant domain with 1 module and 25 source files.

Key Modules
ModulePurpose
packages/kit/src/utilsUtility and helper functions
Business Impact
  • Change Frequency Impact: Medium — Changes here affect 25 files
  • Domain Complexity: Simple

4. Notifications

Business Capability

path packages/kit/src/messages matches message

This is a focused domain with 1 module and 11 source files.

Key Modules
ModulePurpose
packages/kit/src/messagesCore application module
Business Impact
  • Change Frequency Impact: Low — Changes here affect 11 files
  • Domain Complexity: Simple

5. CLI & Commands

Business Capability

path packages/kit/src/cli.js matches cli

This is a focused domain with 1 module and 1 source file.

Key Modules
ModulePurpose
packages/kit/src/cli.jsCore application module
Business Impact
  • Change Frequency Impact: Low — Changes here affect 1 file
  • Domain Complexity: Simple

6. Configuration

Business Capability

path packages/kit/src/constants.js matches constant

This is a focused domain with 1 module and 1 source file.

Key Modules
ModulePurpose
packages/kit/src/constants.jsCore application module
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:

ModuleConsumersRole
packages/kit/src/messages/server-errors27 modulesCore application module
packages/kit/src/utils/functions23 modulesUtility and helper functions
packages/kit/src/utils/os21 modulesUtility and helper functions
Cross-Domain Integration Points

These modules facilitate communication and data sharing between domains:

  • `packages/kit/src/messages/server-errors` serves as a central integration point, imported by 27 different modules. Changes to this module have wide-ranging impact and should be carefully coordinated.
  • `packages/kit/src/utils/functions` serves as a central integration point, imported by 23 different modules. Changes to this module have wide-ranging impact and should be carefully coordinated.
  • `packages/kit/src/utils/os` serves as a central integration point, imported by 21 different modules. Changes to this module have wide-ranging impact and should be carefully coordinated.

Domain Health Summary

MetricValueAssessment
Total Domains6Well-balanced
Avg Files/Domain34Appropriate size
Largest DomainOther (136 files)Consider breaking down
Domain Concentration66% 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 --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

Architecture Overview

Engineers · Layered architecture and design patterns

Architectural Philosophy

SvelteKit follows a Core/kernel architecture — `packages/kit/src/core`; high fan-in architecture with elements of CLI tool architecture — `packages/kit/src/cli.js`, Shared utility layer — `packages/kit/src/utils`; high fan-in, ⚠️ 4 circular dependency cycle(s) detected.

Pattern Analysis

Core/kernel architecture — `packages/kit/src/core`; high fan-in

A structured approach to organizing code and managing complexity.

Benefits: Structured organization, maintainability, clarity

CLI tool architecture — `packages/kit/src/cli.js`

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

Shared utility layer — `packages/kit/src/utils`; high fan-in

A structured approach to organizing code and managing complexity.

Benefits: Structured organization, maintainability, clarity

⚠️ 4 circular dependency cycle(s) detected

A structured approach to organizing code and managing complexity.

Benefits: Structured organization, maintainability, clarity

System Layers

The system is organized into 6 functional layers, each encapsulating a distinct area of responsibility:

LayerResponsibilityScaleKey Insight
OtherUncategorized module136 filesLarge domain — consider breaking down
Core Enginepath packages/kit/src/core matches core31 filesSingle large module — evaluate decomposition
Shared Utilitiespath packages/kit/src/utils matches util25 filesShared infrastructure — high reuse
Notificationspath packages/kit/src/messages matches message11 filesStandard domain
CLI & Commandspath `packages/kit/src/cli1 filesStandard domain
Configurationpath `packages/kit/src/constants1 filesStandard domain

Module Layers

Modules are classified into 5 architectural roles:

Other Modules

Role: General purpose functionality

ModuleFilesDescription
packages/kit/src/runtime105Core application module
packages/kit/src/messages11Core application module
packages/kit/src/constants.js1Core application module
packages/kit/src/pathname.js1Core application module
packages/kit/src/runner.js1Core application module
+2 more—Additional modules
core

Role: Supporting application functionality

ModuleFilesDescription
packages/kit/src/core31Core application module
publisher

Role: Supporting application functionality

ModuleFilesDescription
packages/kit/src/exports27Core application module
Shared Libraries

Role: Provides shared utilities and abstractions used across modules

ModuleFilesDescription
packages/kit/src/utils25Utility and helper functions
cli

Role: Supporting application functionality

ModuleFilesDescription
packages/kit/src/cli.js1Core application module

Technology Foundation

LayerTechnologiesArchitectural Implication
LanguageNode.js, JavaScriptDynamic typing, flexible but requires discipline
BuildViteModern bundling and optimization
QualityVitestEnables confident refactoring

Scale & Complexity Analysis

DimensionValueAssessment
Total Files205large project
Module Count11low complexity
Domain Spread6 domainsGood separation
InterfaceCLITerminal-driven interaction

Dependency Health

Architecture Health Score: 🟡 70/100

MetricValueStatusRecommendation
Import Edges607✅Healthy module connectivity
External Packages14✅Lean dependency set
Circular Deps4🔴Refactor to break cycles
Orphan Files13⚠️Review for dead code
Architectural Strengths
  • Balanced coupling — No single module dominates the import graph. This reduces change risk and enables parallel development.
  • Testing infrastructure — Automated testing with Vitest supports confident evolution.
Concerns
  • Circular dependencies detected — 4 circular dependencies create tight coupling, complicate testing, and hinder refactoring. Priority: High.

Hub modules (most imported):

  • packages/kit/src/messages/server-errors — imported by 27 files
  • packages/kit/src/utils/functions — imported by 23 files
  • packages/kit/src/utils/os — imported by 21 files

Monorepo Architecture

This project uses a pnpm workspaces monorepo with 45 packages.

Package Structure
PackageLocationArchitectural Role
@sveltejs/kitpackages/kitPackage functionality
test-write-types-actionspackages/kit/src/core/sync/write_types/test/actionsTesting utilities
test-write-types-app-typespackages/kit/src/core/sync/write_types/test/app-typesFrontend application
test-write-types-layoutpackages/kit/src/core/sync/write_types/test/layoutTesting utilities
test-write-types-layout-advancedpackages/kit/src/core/sync/write_types/test/layout-advancedTesting utilities
test-write-types-param-type-inferencepackages/kit/src/core/sync/write_types/test/param-type-inferenceTesting utilities
test-write-types-simple-page-server-and-sharedpackages/kit/src/core/sync/write_types/test/simple-page-server-and-sharedBackend/API server
test-write-types-simple-page-server-onlypackages/kit/src/core/sync/write_types/test/simple-page-server-onlyBackend/API server
test-write-types-simple-page-shared-onlypackages/kit/src/core/sync/write_types/test/simple-page-shared-onlyUtility libraries
test-write-types-slugspackages/kit/src/core/sync/write_types/test/slugsTesting utilities
+10 more——
Monorepo Benefits
  • Shared infrastructure — Common tooling and configurations
  • Atomic changes — Cross-package updates in single commits
  • Independent deployment — Each package can be released separately
  • Clear ownership — Package boundaries define team responsibilities

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 --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

Module Catalog

Engineers · Complete inventory of code modules with AI explanations

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: 11


Module Inventory

ModuleFilesRole
packages/kit/src/runtime105Application module · Orchestrator (coordinates 133 modules)
packages/kit/src/core31Core business logic and shared foundations · Critical shared infrastructure (imported by 22 modules)
packages/kit/src/exports27Application module · Shared infrastructure (imported by 5 modules)
packages/kit/src/utils25Shared utilities and helper functions · Critical shared infrastructure (imported by 159 modules)
packages/kit/src/messages11Application module · Critical shared infrastructure (imported by 107 modules)
packages/kit/src/cli.js1CLI entry point and commands
packages/kit/src/constants.js1Application module
packages/kit/src/pathname.js1Application module
packages/kit/src/runner.js1Application module
packages/kit/src/telemetry.js1Application module
packages/kit/src/version.js1Application module

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 --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

Route Map

Mixed audience · Application routes and API endpoints with context

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 --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

API Surface

Engineers · Backend API endpoints with usage examples

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.


Documented Exports

Exported functions with JSDoc/TSDoc documentation. Documentation coverage: 97%

⚠️ Deprecated Functions
  • json in packages/kit/src/exports/index.js: use Response.json
  • text in packages/kit/src/exports/index.js: use new Response
  • invalidateAll in packages/kit/src/runtime/client/client.js: Use `refreshAll` instead. Unlike invalidateAll, refreshAll does not reset page.state.
  • pushState in packages/kit/src/runtime/client/client.js: Use goto(url, { state, shallow: true }) instead.
  • replaceState in packages/kit/src/runtime/client/client.js: Use goto(url, { state, shallow: true, replace: true }) instead.
Function Documentation
packages/kit/src/pathname.js

`has_data_suffix()`

Parameters:

  • pathname (string)

`add_data_suffix()`

Parameters:

  • pathname (string)

`strip_data_suffix()`

Parameters:

  • pathname (string)

`has_resolution_suffix()`

Parameters:

  • pathname (string)

Returns: boolean

`add_resolution_suffix()`

Convert a regular URL to a route to send to SvelteKit's server-side route resolution endpoint

Parameters:

  • pathname (string)

Returns: string

`strip_resolution_suffix()`

Parameters:

  • pathname (string)

Returns: string

packages/kit/src/runner.js

`get_runner()`

Parameters:

  • vite (typeof vite): the vite module that created the server
  • server (ViteDevServer)
packages/kit/src/core/adapt/builder.js

`create_builder()`

Creates the Builder which is passed to adapters for building the application.

Returns: Builder

packages/kit/src/core/adapt/index.js

`adapt()`

Parameters:

  • config (import('types').ValidatedConfig)
  • build_data (import('types').BuildData)
  • server_metadata (import('types').ServerMetadata)
  • prerendered (import('types').Prerendered)
  • prerender_map (import('types').PrerenderMap)
  • app_manifest (typeof import('$app/manifest'))
  • log (import('types').Logger)
  • remotes (import('types').RemoteChunk[])
  • vite_config (import('vite').ResolvedConfig)
  • explicit_env_config (Record<string, import('@sveltejs/kit/env').EnvVarConfig<any>> | null)
packages/kit/src/core/config/index.js

`split_config()`

Splits the config passed to the sveltekit Vite plugin into the options that SvelteKit processes itself and the options that are forwarded to vite-plugin-svelte. SvelteKit makes no assumptions about which options vite-plugin-svelte accepts — it plucks out its own options and passes everything else along (vite-plugin-svelte does its own validation).

Parameters:

  • config (Config)

Returns: { svelte_config: Config, vite_plugin_svelte_config: Record<string, any> — }

`load_template()`

Loads the template (src/app.html by default) and validates that it has the required content.

Parameters:

  • cwd (string)
  • config (ValidatedConfig)

`load_error_page()`

Loads the error page (src/error.html by default) if it exists. Falls back to a generic error page content.

Parameters:

  • config (ValidatedConfig)

`load_vite_config()`

Parameters:

  • config (string) (optional)
  • vite (typeof import('vite')) (optional)

`extract_svelte_config()`

Parameters:

  • vite_config (ResolvedConfig)

Returns: ValidatedConfig

`process_config()`

Parameters:

  • config (ValidatedConfig)
  • cwd (string)

Returns: ValidatedConfig

`validate_config()`

Parameters:

  • config (Config)

Returns: ValidatedConfig

packages/kit/src/core/config/options.js

`object()`

Parameters:

  • children (Record<string, Validator>)
  • allow_unknown (boolean) (optional)

Returns: Validator

`validate()`

Parameters:

  • fallback (any)
  • fn ((value: any, keypath: string) => any)

Returns: Validator

packages/kit/src/core/env.js

`resolve_env_entry()`

Parameters:

  • config (ValidatedConfig)
  • root (string)

Returns: string | null

`load_explicit_env()`

Parameters:

  • kit (ValidatedConfig)
  • file (string | null)
  • root (string)
  • mode (string)

Returns: Promise<{ variables: Record<string, EnvVarConfig<any>> | null, deps: Set<string> — >}

`create_env_modules()`

Creates the <sveltekit:generated>/env/* modules, keyed by path relative to dir. Every module derives from one pass over variables, so an inlined value is validated once per build.

Parameters:

  • config (ValidatedConfig)
  • variables (Record<string, EnvVarConfig<any>> | null)
  • env (Record<string, string>)
  • dir (string)
  • entry (string | null)
  • is_dev (boolean)

Returns: Record<string, string>

`create_explicit_env_types()`

Parameters:

  • variables (Record<string, EnvVarConfig<any>>)
  • relative (string)
  • type (EnvType)

`create_exported_declarations()`

Generates export const declarations (and, for reserved-word names that need aliasing, const + re-export specifiers) for a set of named exports. For regular names, emits a single efficient export const name = expr; statement. For reserved-word names (e.g. delete, class), emits const alias = expr; plus a re-export specifier (alias as name), since reserved words can't be const binding names but CAN appear in export specifiers. You can do evil things like export { c as class }. In order to import/re-export these, you need to alias the binding, then un-alias it when re-exporting: const _0 = ...; // safe binding name export { _0 as class }; // valid — class is allowed in export specifiers Aliases are chosen to avoid collisions with any of the supplied names. The namespace binding (used to hold the imported module) is likewise chosen to avoid collisions.

Parameters:

  • names (Iterable<string>): — the export names
  • build_expression ((name: string, namespace: string) => string): — called for each name to produce the right-hand side of the declaration; receives the chosen namespace binding so it can reference the imported module
  • namespace_prefix (string): — the preferred binding name for the namespace (suffixed with a number if it collides with any export name)

Returns: { namespace: string, declarations: string[], reexports: string[] — }

packages/kit/src/core/features.js

`check_feature()`

Parameters:

  • route_id (string)
  • config (Record<string, any>)
  • feature (string)
  • adapter (import('@sveltejs/kit').Adapter | undefined)
packages/kit/src/core/params.js

`collect_matcher_names()`

Parameters:

  • routes (import('types').RouteData[])

Returns: Set<string>

`validate_param_matchers()`

Parameters:

  • params (Record<string, unknown>)
  • names (Set<string>)
  • file (string) (optional)

`load_and_validate_params()`

Returns: Promise<Record<string, ParamMatcher> | null>

packages/kit/src/core/utils.js

`get_global_name()`

The name of the globalThis.__sveltekit_xxx object the app's payload is attached to

Parameters:

  • version_name (string)
  • dev (boolean)

`get_runtime_base()`

This allows us to import SvelteKit internals that aren't exposed via pkg.exports in a way that works whether @sveltejs/kit is installed inside the project's node_modules or in a workspace root

Parameters:

  • root (string)

Returns: string

`logger()`

Showing 30 of 629 documented exports.


Documentation Summary:

  • Total exports: 650
  • Documented: 629
  • Undocumented: 21
  • Coverage: 97%

HTTP method reference — GET: retrieve data, POST: create, PUT/PATCH: update, DELETE: remove.

<!-- repolens:docs-badge --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

Data Flows

Mixed audience · Major information flows through the system

Understanding Data Movement

Data flows describe how information moves through SvelteKit — 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:

FlowTypeComplexityCritical
client Command FlowIntegrationMedium (4 steps)🔴 Yes
vite Request FlowIntegrationLow (2 steps)🔴 Yes
prerender Request FlowIntegrationMedium (4 steps)🔴 Yes
analyse Request FlowIntegrationMedium (3 steps)🔴 Yes
client Command FlowIntegrationMedium (4 steps)🔴 Yes

1. client Command Flow 🔴 CRITICAL FLOW

Description

Import chain starting from packages/kit/src/runtime/client/client — traces how this entry point depends on 3 downstream modules

Characteristics
PropertyValue
Steps4
Modules Involved4
CriticalityCritical
Processing Steps
StepActionPurpose
1client (entry point, imports 23 modules)Data acquisition
2functions (shared infrastructure, used by 23 files)Processing step
3server-errors (shared infrastructure, used by 27 files)Processing step
4server (shared infrastructure, used by 5 files)Processing step
Flow Diagram
┌─ START ─┐
│ `client` (entry point, imports 23 modules)         │
│         ↓
│ `functions` (shared infrastructure, used by 23 ... │
│         ↓
│ `server-errors` (shared infrastructure, used by... │
│         ↓
│ `server` (shared infrastructure, used by 5 files)  │
└─ END ───┘
Involved Modules
ModuleRole
clientCore application module
functionsUtility and helper functions
server-errorsCore application module
serverCore application module
Dependencies

Shared libraries used: packages/kit/src/utils

Insights
  • ⚠️ Critical path — Failures here have significant business impact
  • 📊 Consider adding monitoring and alerting
  • 🧪 Ensure comprehensive test coverage

2. vite Request Flow 🔴 CRITICAL FLOW

Description

Import chain starting from packages/kit/src/exports/vite — traces how this entry point depends on 1 downstream module

Characteristics
PropertyValue
Steps2
Modules Involved2
CriticalityCritical
Processing Steps
StepActionPurpose
1vite (entry point, imports 20 modules)Data acquisition
2os (shared infrastructure, used by 21 files)Processing step
Flow Diagram
┌─ START ─┐
│ `vite` (entry point, imports 20 modules)           │
│         ↓
│ `os` (shared infrastructure, used by 21 files)     │
└─ END ───┘
Involved Modules
ModuleRole
viteCore application module
osUtility and helper functions
Dependencies

Shared libraries used: packages/kit/src/utils

Insights
  • ⚠️ Critical path — Failures here have significant business impact
  • 📊 Consider adding monitoring and alerting
  • 🧪 Ensure comprehensive test coverage

3. prerender Request Flow 🔴 CRITICAL FLOW

Description

Import chain starting from packages/kit/src/core/postbuild/prerender — traces how this entry point depends on 3 downstream modules

Characteristics
PropertyValue
Steps4
Modules Involved4
CriticalityCritical
Processing Steps
StepActionPurpose
1prerender (entry point, imports 18 modules)Data acquisition
2functions (shared infrastructure, used by 23 files)Processing step
3server-errors (shared infrastructure, used by 27 files)Processing step
4server (shared infrastructure, used by 5 files)Processing step
Flow Diagram
┌─ START ─┐
│ `prerender` (entry point, imports 18 modules)      │
│         ↓
│ `functions` (shared infrastructure, used by 23 ... │
│         ↓
│ `server-errors` (shared infrastructure, used by... │
│         ↓
│ `server` (shared infrastructure, used by 5 files)  │
└─ END ───┘
Involved Modules
ModuleRole
prerenderUser interface components
functionsUtility and helper functions
server-errorsCore application module
serverCore application module
Dependencies

Shared libraries used: packages/kit/src/utils

Insights
  • ⚠️ Critical path — Failures here have significant business impact
  • 📊 Consider adding monitoring and alerting
  • 🧪 Ensure comprehensive test coverage

4. analyse Request Flow 🔴 CRITICAL FLOW

Description

Import chain starting from packages/kit/src/core/postbuild/analyse — traces how this entry point depends on 2 downstream modules

Characteristics
PropertyValue
Steps3
Modules Involved3
CriticalityCritical
Processing Steps
StepActionPurpose
1analyse (entry point, imports 11 modules)Data acquisition
2server-errors (shared infrastructure, used by 27 files)Processing step
3server (shared infrastructure, used by 5 files)Processing step
Flow Diagram
┌─ START ─┐
│ `analyse` (entry point, imports 11 modules)        │
│         ↓
│ `server-errors` (shared infrastructure, used by... │
│         ↓
│ `server` (shared infrastructure, used by 5 files)  │
└─ END ───┘
Involved Modules
ModuleRole
analyseUser interface components
server-errorsCore application module
serverCore application module
Dependencies

Shared libraries used: packages/kit/src/utils

Insights
  • ⚠️ Critical path — Failures here have significant business impact
  • 📊 Consider adding monitoring and alerting
  • 🧪 Ensure comprehensive test coverage

5. client Command Flow 🔴 CRITICAL FLOW

Description

Import chain starting from packages/kit/src/runtime/app/forms/client — traces how this entry point depends on 3 downstream modules

Characteristics
PropertyValue
Steps4
Modules Involved4
CriticalityCritical
Processing Steps
StepActionPurpose
1client (entry point, imports 7 modules)Data acquisition
2functions (shared infrastructure, used by 23 files)Processing step
3server-errors (shared infrastructure, used by 27 files)Processing step
4server (shared infrastructure, used by 5 files)Processing step
Flow Diagram
┌─ START ─┐
│ `client` (entry point, imports 7 modules)          │
│         ↓
│ `functions` (shared infrastructure, used by 23 ... │
│         ↓
│ `server-errors` (shared infrastructure, used by... │
│         ↓
│ `server` (shared infrastructure, used by 5 files)  │
└─ END ───┘
Involved Modules
ModuleRole
clientCore application module
functionsUtility and helper functions
server-errorsCore application module
serverCore application module
Dependencies

Shared libraries used: packages/kit/src/utils

Insights
  • ⚠️ Critical path — Failures here have significant business impact
  • 📊 Consider adding monitoring and alerting
  • 🧪 Ensure comprehensive test coverage

Import Network

The system has 607 internal import edges connecting 205 source files.

Network Topology
MetricValueMeaning
Total Edges607Direct import relationships
Hub Count3Central integration points
Avg Connections~3 per fileCoupling density
Key Integration Points

These modules aggregate data from multiple sources:

HubInboundRole
server-errors27 filesCore application module
functions23 filesUtility and helper functions
os21 filesUtility 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 --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

Architecture Diff

Mixed audience · Git diff analysis and impact assessment

No changes detected.

<!-- repolens:docs-badge --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

System Map

Mixed audience · Visual dependency graph with explanation

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: 11 modules and 24 relationships

Source: Real import analysis


Architecture Diagram

┌─────────────────────────────────────────────────────────────┐
│              🏗️  SYSTEM ARCHITECTURE MAP                    │
└─────────────────────────────────────────────────────────────┘

🎯  CLI ENTRY
│
└── cli.js (1 file)
       → core
       → utils
│
⚙️  CORE LOGIC
│
└── core (31 files)
       → utils
       → exports
       → messages
       ... +3 more
│
🛠️  UTILITIES
│
└── utils (25 files)
       → messages
       → runtime
│
📦  OTHER
│
├── runtime (105 files)
│      → messages
│      → utils
│      → pathname.js
│      ... +2 more
├── exports (27 files)
│      → constants.js
│      → pathname.js
│      → messages
│      ... +5 more
├── messages (11 files)
├── constants.js (1 file)
├── pathname.js (1 file)
├── runner.js (1 file)
│      → messages
├── telemetry.js (1 file)
└── version.js (1 file)
│

Legend:
  →  imports / depends on
  ╌→ tests

Key Connections

Most depended-on modules (highest import count):

ModuleImported by
packages/kit/src/utils159 modules
packages/kit/src/messages107 modules
packages/kit/src/core22 modules
packages/kit/src/constants.js11 modules
packages/kit/src/exports5 modules

Most dependent modules (highest dependency count):

ModuleDepends on
packages/kit/src/runtime133 modules
packages/kit/src/core91 modules
packages/kit/src/exports80 modules
packages/kit/src/utils7 modules
packages/kit/src/cli.js5 modules

<!-- repolens:docs-badge --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

Developer Onboarding

Engineers · Quick start guide for new developers

Welcome to SvelteKit! 👋

This guide will help you get up to speed quickly. SvelteKit is a general-purpose tools project built with Node.js, JavaScript, containing 11 modules across 205 files.

What You'll Learn
  1. ✅ Repository structure and organization
  2. ✅ Technology stack and tools
  3. ✅ Key modules to understand first
  4. ✅ How data flows through the system
  5. ✅ How to start contributing

Quick Reference Card

AspectDetails
LanguagesNode.js, JavaScript
Frameworksgeneral-purpose tools
Build ToolsVite
TestingVitest
Size11 modules, 205 files
Domains6 functional areas
TypeCommand-line interface

Repository Structure

Understanding the directory layout is your first step to navigating the codebase:

DirectoryPurposeStart Here?
packages/kit/srcProject files⭐ Yes
Where to Begin

Focus on these directories first:

  1. `packages/kit/src` — Project files

Monorepo Navigation

This is a pnpm workspaces monorepo with 45 packages. Here's how to navigate:

PackageLocationWhat It Does
@sveltejs/kitpackages/kitPackage functionality
test-write-types-actionspackages/kit/src/core/sync/write_types/test/actionsTesting utilities
test-write-types-app-typespackages/kit/src/core/sync/write_types/test/app-typesFrontend application
test-write-types-layoutpackages/kit/src/core/sync/write_types/test/layoutTesting utilities
test-write-types-layout-advancedpackages/kit/src/core/sync/write_types/test/layout-advancedTesting utilities
test-write-types-param-type-inferencepackages/kit/src/core/sync/write_types/test/param-type-inferenceTesting utilities
test-write-types-simple-page-server-and-sharedpackages/kit/src/core/sync/write_types/test/simple-page-server-and-sharedBackend/API server
test-write-types-simple-page-server-onlypackages/kit/src/core/sync/write_types/test/simple-page-server-onlyBackend/API server
test-write-types-simple-page-shared-onlypackages/kit/src/core/sync/write_types/test/simple-page-shared-onlyUtility libraries
test-write-types-slugspackages/kit/src/core/sync/write_types/test/slugsTesting utilities
+10 more—Additional packages

Pro tip: Each package can typically be developed independently. Check the package's own README.md for specific setup instructions.


Technology Stack

LayerTechnologiesWhat to Learn
LanguageNode.js, JavaScriptDynamic typing — use console.log for runtime inspection
BuildViteUnderstand the build pipeline
TestingVitestRun existing tests to understand behavior

Core Modules to Understand

These are the most important modules by size and centrality. Understanding them will unlock the rest of the codebase:

PriorityModuleFilesTypeWhy It Matters
⭐ Highpackages/kit/src/runtime105Other ModulesLarge module — core functionality
⭐ Highpackages/kit/src/core31coreLarge module — core functionality
⭐ Highpackages/kit/src/exports27publisherLarge module — core functionality
Mediumpackages/kit/src/utils25Shared LibrariesShared code — reused throughout
Mediumpackages/kit/src/messages11Other ModulesKey system component
Mediumpackages/kit/src/cli.js1cliKey system component
Lowpackages/kit/src/constants.js1Other ModulesKey system component
Lowpackages/kit/src/pathname.js1Other ModulesKey system component
Lowpackages/kit/src/runner.js1Other ModulesKey system component
Lowpackages/kit/src/telemetry.js1Other ModulesKey system component
Key Integration Points

These modules are imported by many other files. Changes here have wide impact:

  • `packages/kit/src/messages/server-errors` — Used by 27 files — Core application module
  • `packages/kit/src/utils/functions` — Used by 23 files — Utility and helper functions
  • `packages/kit/src/utils/os` — Used by 21 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:

FlowDescriptionKey Modules
client Command FlowImport chain starting from `packages/kit/src/runtime/client/...client, functions
vite Request FlowImport chain starting from packages/kit/src/exports/vite —...vite, os
prerender Request FlowImport chain starting from `packages/kit/src/core/postbuild/...prerender, functions
analyse Request FlowImport chain starting from `packages/kit/src/core/postbuild/...analyse, server-errors
client Command FlowImport chain starting from `packages/kit/src/runtime/app/for...client, functions

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 sveltekit
npm install  # or yarn, pnpm
2. Explore the Structure
  • Review the directory structure above
  • Open the README.md for project-specific instructions
  • Look for CONTRIBUTING.md for 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. Run the Tests
npm test  # or: npx vitest run

Running tests helps you:

  • Verify your setup is correct
  • See expected behavior documented in test cases
  • Understand module interfaces through test examples
5. Make Your First Change

Start small:

  1. Find a small bug or typo to fix
  2. Make the change in a feature branch
  3. Run tests to ensure nothing breaks
  4. Submit a pull request for review

Common Pitfalls

New contributors often run into these issues:

  • Circular dependencies — This codebase has 4 circular imports. Be careful not to introduce more.
  • Monorepo boundaries — Remember to build dependent packages when making changes.
  • Environment setup — Check for .env.example files and ensure you have all required environment variables.
  • Branch naming — Follow the team's branch naming conventions (usually feature/, fix/, docs/).

Additional Resources

ResourcePurpose
README.mdProject overview and quick start
CONTRIBUTING.mdContribution guidelines (if exists)
CHANGELOG.mdRecent changes and release history
package.jsonAvailable scripts and dependencies
Root package.jsonMonorepo workspace configuration

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 --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

GraphQL Schema

Engineers · GraphQL types, queries, mutations, and resolver map

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 --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

TypeScript Type Graph

Engineers · TypeScript interfaces, types, classes, and relationships

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 --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

Dependency Graph

Engineers · Module dependency analysis with cycle detection

205 files · 607 imports · 14 external packages · ⚠️ 4 circular dependency cycle(s) · 13 orphan file(s)

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

MetricValue
Source files205
Import edges607
External packages14
Circular dependencies4
Orphan files (no imports or importers)13

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:

ModuleImported By
packages/kit/src/messages/server-errors27 files
packages/kit/src/utils/functions23 files
packages/kit/src/utils/os21 files

Circular Dependencies

4 circular dependency chains were detected. Circular imports can cause initialization errors, increase bundle sizes, and make modules harder to test in isolation. Consider refactoring shared logic into a separate module.

  1. packages/kit/src/runtime/server/internal → packages/kit/src/runtime/server/remote-functions → packages/kit/src/runtime/server/errors → packages/kit/src/runtime/server/internal
  2. packages/kit/src/runtime/server/internal → packages/kit/src/runtime/server/remote-functions → packages/kit/src/runtime/server/page/actions → packages/kit/src/runtime/server/utils → packages/kit/src/runtime/server/internal
  3. packages/kit/src/runtime/server/internal → packages/kit/src/runtime/server/remote-functions → packages/kit/src/runtime/server/internal
  4. packages/kit/src/runtime/server/fetch → packages/kit/src/runtime/server/respond → packages/kit/src/runtime/server/fetch

External Dependencies

The codebase imports 14 external packages. These are third-party modules (not the language standard library):

Package
---------
$app
<sveltekit:generated>
@opentelemetry/api
@rolldown/pluginutils
@sveltejs/kit
cookie
devalue
esm-env
magic-string
mrmime
sirv
svelte
typescript
vite

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 --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

Architecture Drift

Mixed audience · Structural changes compared to baseline snapshot

No baseline found. Run repolens publish once 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:

DimensionWhat is Tracked
ModulesNew, removed, or significantly resized modules
API EndpointsAdded or removed backend routes
DependenciesChanges to external package imports
FrameworksTechnology stack additions or removals
Circular DependenciesIncreases in dependency cycles
GraphQL SchemaType additions or removals
Codebase ScaleOverall file count changes

<!-- repolens:docs-badge --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

Security Hotspots

Engineers · Security anti-pattern detection with CWE classification

20 security finding(s) · 20 low severity · across 16 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

SeverityCount
🔵 Low20

205 source files scanned · 16 files with findings

ReDoS

Dynamic regex construction from user input can cause ReDoS. Use static regex or input validation.

FileLinePatternSeverityCWE
packages/kit/src/core/postbuild/entities.js2240Potentially catastrophic regex🔵 LowCWE-1333
packages/kit/src/core/sync/utils.js55Potentially catastrophic regex🔵 LowCWE-1333
packages/kit/src/exports/vite/plugins/remote.js228Potentially catastrophic regex🔵 LowCWE-1333
packages/kit/src/exports/vite/static_analysis/index.js20Potentially catastrophic regex🔵 LowCWE-1333
packages/kit/src/runtime/server/page/serialize_data.js28Potentially catastrophic regex🔵 LowCWE-1333
packages/kit/src/utils/escape.js26Potentially catastrophic regex🔵 LowCWE-1333
packages/kit/src/utils/filesystem.js21Potentially catastrophic regex🔵 LowCWE-1333
packages/kit/src/utils/routing.js42Potentially catastrophic regex🔵 LowCWE-1333
packages/kit/src/utils/routing.js290Potentially catastrophic regex🔵 LowCWE-1333

Prototype Pollution

Deep merge utilities may be vulnerable to prototype pollution if they don't check hasOwnProperty. Verify the implementation.

FileLinePatternSeverityCWE
packages/kit/src/exports/node/index.js125Recursive object merge without prototype check🔵 LowCWE-1321
packages/kit/src/runtime/app/state/client.svelte.js25Recursive object merge without prototype check🔵 LowCWE-1321
packages/kit/src/runtime/client/client.js1491Recursive object merge without prototype check🔵 LowCWE-1321
packages/kit/src/runtime/client/client.js3537Recursive object merge without prototype check🔵 LowCWE-1321
packages/kit/src/runtime/form-utils.js873Recursive object merge without prototype check🔵 LowCWE-1321
packages/kit/src/runtime/server/errors.js58Recursive object merge without prototype check🔵 LowCWE-1321
packages/kit/src/runtime/server/errors.js94Recursive object merge without prototype check🔵 LowCWE-1321
packages/kit/src/runtime/server/data/index.js63Recursive object merge without prototype check🔵 LowCWE-1321
packages/kit/src/runtime/server/page/index.js191Recursive object merge without prototype check🔵 LowCWE-1321
packages/kit/src/runtime/server/page/index.js224Recursive object merge without prototype check🔵 LowCWE-1321

Insecure Randomness

Math.random() is not cryptographically secure. Use crypto.randomUUID() or crypto.getRandomValues() for security tokens.

FileLinePatternSeverityCWE
packages/kit/src/runtime/client/remote-functions/query-live/instance.svelte.js115Math.random() for security-sensitive operation🔵 LowCWE-330

Affected Files

  • packages/kit/src/core/postbuild/entities.js
  • packages/kit/src/core/sync/utils.js
  • packages/kit/src/exports/node/index.js
  • packages/kit/src/exports/vite/plugins/remote.js
  • packages/kit/src/exports/vite/static_analysis/index.js
  • packages/kit/src/runtime/app/state/client.svelte.js
  • packages/kit/src/runtime/client/client.js
  • packages/kit/src/runtime/client/remote-functions/query-live/instance.svelte.js
  • packages/kit/src/runtime/form-utils.js
  • packages/kit/src/runtime/server/errors.js
  • packages/kit/src/runtime/server/data/index.js
  • packages/kit/src/runtime/server/page/index.js
  • packages/kit/src/runtime/server/page/serialize_data.js
  • packages/kit/src/utils/escape.js
  • packages/kit/src/utils/filesystem.js
  • packages/kit/src/utils/routing.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 --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples

Code Health Report

Mixed audience · Per-module health scores from complexity, coupling, docs, and security

205 files analyzed · Average health: 86/100 · 148 A, 22 B, 30 C, 5 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

MetricValue
Files analyzed205
Average health score86/100
Average complexity21
Hotspots (score < 60)20

Grade Distribution

GradeCountMeaning
🟢 A (80–100)148Healthy — low complexity, well-documented
🔵 B (60–79)22Acceptable — minor improvements possible
🟡 C (40–59)30Needs attention — elevated complexity or coupling
🟠 D (20–39)5At risk — multiple quality signals degraded
🔴 F (0–19)0Critical — immediate refactoring recommended

Hotspots — Priority Refactoring Targets

These modules have the lowest health scores and should be prioritized for improvement:

ModuleScoreGradeComplexityCouplingDoc%Security
packages/kit/src/runtime/client/client.js30🟠 D54916↓ 23↑100%2 (0 high)
packages/kit/src/runtime/app/server/remote/form.js36🟠 D371↓ 3↑0%—
packages/kit/src/core/sync/create_manifest_data/index.js37🟠 D1226↓ 10↑100%—
packages/kit/src/core/env.js39🟠 D426↓ 9↑83%—
packages/kit/src/runtime/server/page/render.js39🟠 D1013↓ 17↑100%—
packages/kit/src/runtime/server/respond.js40🟡 C1012↓ 23↑100%—
packages/kit/src/runtime/shared.js41🟡 C5214↓ 3↑100%—
packages/kit/src/runtime/server/remote-functions.js43🟡 C744↓ 8↑100%—
packages/kit/src/core/postbuild/analyse.js45🟡 C480↓ 11↑——
packages/kit/src/core/postbuild/prerender.js45🟡 C1090↓ 18↑——
packages/kit/src/core/sync/create_manifest_data/sort.js45🟡 C461↓ 1↑100%—
packages/kit/src/core/sync/write_app_types.js45🟡 C461↓ 7↑100%—
packages/kit/src/core/sync/write_types/index.js45🟡 C1601↓ 5↑100%—
packages/kit/src/exports/vite/dev/index.js45🟡 C671↓ 21↑100%—
packages/kit/src/exports/vite/index.js45🟡 C440↓ 20↑100%—
packages/kit/src/exports/vite/static_analysis/index.js45🟡 C602↓ 1↑100%1 (0 high)
packages/kit/src/runtime/app/forms/client.js45🟡 C500↓ 7↑100%—
packages/kit/src/runtime/app/server/remote/query.js45🟡 C432↓ 6↑50%—
packages/kit/src/runtime/client/remote-functions/form.svelte.js45🟡 C1021↓ 5↑100%—
packages/kit/src/runtime/form-utils.js45🟡 C1814↓ 4↑100%1 (0 high)

Most Complex Functions

These functions have the highest cyclomatic complexity and are the most likely sources of bugs:

FunctionFileLineComplexity
internal_respond()packages/kit/src/runtime/server/respond.js9383
_start_router()packages/kit/src/runtime/client/client.js309176
push_href()packages/kit/src/core/postbuild/crawl.js4561
duplicate_files()packages/kit/src/core/sync/create_manifest_data/index.js29059
save()packages/kit/src/core/postbuild/prerender.js54250
render_page()packages/kit/src/runtime/server/page/index.js4250
navigate()packages/kit/src/runtime/client/client.js193849
resolve()packages/kit/src/runtime/server/respond.js59049
load_route()packages/kit/src/runtime/client/client.js137347
statically_analyse_page_options()packages/kit/src/exports/vite/static_analysis/index.js3245
read()packages/kit/src/runtime/form-utils.js77744
server_fetch()packages/kit/src/runtime/server/fetch.js2241
load_server_data()packages/kit/src/runtime/server/page/load_data.js2240
split()packages/kit/src/core/sync/create_manifest_data/sort.js3237
render_response()packages/kit/src/runtime/server/page/render.js5935

All Modules by Health Score

Showing 50 of 205 modules (sorted worst-first)

ModuleScoreGradeLinesComplexityFan-InFan-Out
packages/kit/src/runtime/client/client.js30🟠 D38215491623
packages/kit/src/runtime/app/server/remote/form.js36🟠 D3673713
packages/kit/src/core/sync/create_manifest_data/index.js37🟠 D586122610
packages/kit/src/core/env.js39🟠 D4444269
packages/kit/src/runtime/server/page/render.js39🟠 D703101317
packages/kit/src/runtime/server/respond.js40🟡 C863101223
packages/kit/src/runtime/shared.js41🟡 C36652143
packages/kit/src/runtime/server/remote-functions.js43🟡 C6127448
packages/kit/src/core/postbuild/analyse.js45🟡 C28548011
packages/kit/src/core/postbuild/prerender.js45🟡 C761109018
packages/kit/src/core/sync/create_manifest_data/sort.js45🟡 C1634611
packages/kit/src/core/sync/write_app_types.js45🟡 C3164617
packages/kit/src/core/sync/write_types/index.js45🟡 C87916015
packages/kit/src/exports/vite/dev/index.js45🟡 C50567121
packages/kit/src/exports/vite/index.js45🟡 C67744020
packages/kit/src/exports/vite/static_analysis/index.js45🟡 C3066021
packages/kit/src/runtime/app/forms/client.js45🟡 C2705007
packages/kit/src/runtime/app/server/remote/query.js45🟡 C6614326
packages/kit/src/runtime/client/remote-functions/form.svelte.js45🟡 C83110215
packages/kit/src/runtime/form-utils.js45🟡 C93418144
packages/kit/src/runtime/server/cookie.js45🟡 C3355315
packages/kit/src/runtime/server/fetch.js45🟡 C2244015
packages/kit/src/runtime/server/page/csp.js45🟡 C3865913
packages/kit/src/runtime/server/page/index.js45🟡 C37751117
packages/kit/src/runtime/server/page/load_data.js45🟡 C5109438
packages/kit/src/utils/routing.js45🟡 C38678112
packages/kit/src/exports/vite/static_analysis/utils.js46🟡 C1193710
packages/kit/src/runtime/client/remote-functions/query-live/instance.svelte.js46🟡 C4283715
packages/kit/src/core/config/index.js47🟡 C2113665
packages/kit/src/exports/vite/dev/generate_manifest.js50🟡 C3103514
packages/kit/src/runtime/client/remote-functions/shared.svelte.js51🟡 C29937103
packages/kit/src/core/config/options.js52🟡 C4765313
packages/kit/src/runtime/client/utils.js52🟡 C2915442
packages/kit/src/exports/node/index.js56🟡 C3495122
packages/kit/src/runtime/client/fetcher.js58🟡 C2003314
packages/kit/src/messages/shared-errors.js60🔵 B36987151
packages/kit/src/core/adapt/builder.js65🔵 B42730113
packages/kit/src/core/postbuild/crawl.js65🔵 B2603012
packages/kit/src/runtime/server/endpoint.js67🔵 B1292814
packages/kit/src/utils/filesystem.js67🔵 B16127142
packages/kit/src/utils/url.js67🔵 B22331122
packages/kit/src/runtime/server/instance.js70🔵 B1622517
packages/kit/src/exports/index.js71🔵 B3293106
packages/kit/src/runtime/server/sourcemaps.js71🔵 B1882921
packages/kit/src/runtime/client/focus.js74🔵 B952111
packages/kit/src/core/sync/create_manifest_data/conflict.js76🔵 B732211
packages/kit/src/runtime/app/state/client.svelte.js76🔵 B2101900
packages/kit/src/runtime/client/remote-functions/query/instance.svelte.js76🔵 B3101914
packages/kit/src/core/sync/write_client_manifest.js77🔵 B1951113
packages/kit/src/runtime/server/internal.js77🔵 B10023145

Scoring Methodology

The health score (0–100) is computed from four dimensions:

FactorWeightHow It's Measured
Complexity–1/pt above 10, –2/pt above 30Cyclomatic complexity for JavaScript/TypeScript, Python, and Go (regex, not AST)
Function complexity–2/pt above 8 per functionHighest complexity function in the file
Coupling–1/5 units above 20Fan-in × Fan-out (import connections)
Documentation–10 if <50%, –5 if <80%JSDoc/TSDoc coverage of exports
Security–10/high, –5/medium findingSecurity 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 --> ![Docs by RepoLens](https://github.com/CHAPIBUNNY/repolens) · Examples