# vikejs/vike architecture

> Architecture diagram of the GitHub repository vikejs/vike, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vikejs/vike
- Repository: https://github.com/vikejs/vike

## Overview

##### High-Level Architecture Components

a. Core Components:
- Client Runtime (client/)
- Server Runtime (node/runtime/)
- Plugin System (node/plugin/)
- Page Rendering Engine
- Configuration System

b. Integration Layers:
- Framework Adapters (React, Vue, Solid)
- Vite Integration
- Build System

##### Key Relationships to Highlight

- Data flow between client and server
- Plugin interactions
- Build process flow
- Page rendering pipeline

##### Detailed Component Breakdown

a. Client Runtime:
- Client Runtime
- Client Routing
- Page Context Management
- Navigation Handling
- Hydration

b. Server Runtime:
- Server Runtime
- Page Rendering
- Route Resolution
- HTML Generation
- Asset Management

##### Special Elements

- Configuration Management
- File System Routing
- Development Server
- Production Build Pipeline

##### Implementation Details

Implementation aspects:
- Hook System
- Page Context Flow
- Asset Pipeline
- Framework-specific Adapters

##### The page rendering lifecycle

Remember to include:
- Version information
- Integration points with Vite
- Framework adapter architecture
- Build/Dev/Production pipelines
- Configuration flow
- Asset handling

This will provide a comprehensive view of Vike's architecture while maintaining clarity and usefulness for the principal software engineer.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Core["Core Components"]
        CR["Client Runtime"]
        SR["Server Runtime"]
        PS["Plugin System"]
        PRE["Page Rendering Engine"]
        CS["Configuration System"]
    end

    subgraph ClientRuntime["Client Runtime Components"]
        CRoute["Client Routing"]
        SRoute["Server Routing"]
        PCM["Page Context Management"]
        NH["Navigation Handling"]
        HYD["Hydration"]
    end

    subgraph ServerRuntime["Server Runtime Components"]
        PR["Page Rendering"]
        RR["Route Resolution"]
        HG["HTML Generation"]
        AM["Asset Management"]
    end

    subgraph PluginSystem["Plugin System"]
        CP["Core Plugins"]
        PU["Plugin Utils"]
        BS["Build System"]
    end

    subgraph ConfigSystem["Configuration System"]
        CT["Config Types"]
        CP2["Config Processing"]
    end

    subgraph Integrations["Framework Adapters"]
        React["React Adapter"]
        Vue["Vue Adapter"]
        Solid["Solid Adapter"]
    end

    subgraph BuildPipeline["Build Pipeline"]
        Dev["Development Server"]
        Prod["Production Build"]
        VP["Vite Plugin"]
    end

    %% Core relationships
    CR --> SR
    PS --> CR
    PS --> SR
    CS --> CR
    CS --> SR

    %% Client Runtime relationships
    CR --> CRoute
    CR --> SRoute
    CR --> PCM
    CR --> NH
    CR --> HYD

    %% Server Runtime relationships
    SR --> PR
    SR --> RR
    SR --> HG
    SR --> AM

    %% Plugin System relationships
    PS --> CP
    PS --> PU
    PS --> BS

    %% Config System relationships
    CS --> CT
    CS --> CP2

    %% Integration relationships
    PS --> Integrations
    React --> CR
    Vue --> CR
    Solid --> CR

    %% Build Pipeline relationships
    BS --> Dev
    BS --> Prod
    BS --> VP

    %% Click events for component mapping
    click CR "https://github.com/vikejs/vike/tree/main/vike/client/"
    click CRoute "https://github.com/vikejs/vike/tree/main/vike/client/client-routing-runtime/"
    click SRoute "https://github.com/vikejs/vike/tree/main/vike/client/server-routing-runtime/"
    click SR "https://github.com/vikejs/vike/tree/main/vike/node/runtime/"
    click PR "https://github.com/vikejs/vike/tree/main/vike/node/runtime/renderPage/"
    click HG "https://github.com/vikejs/vike/tree/main/vike/node/runtime/html/"
    click AM "https://github.com/vikejs/vike/tree/main/vike/node/runtime/page-files/"
    click PS "https://github.com/vikejs/vike/tree/main/vike/node/plugin/"
    click CP "https://github.com/vikejs/vike/tree/main/vike/node/plugin/plugins/"
    click PU "https://github.com/vikejs/vike/tree/main/vike/node/plugin/shared/"
    click CS "https://github.com/vikejs/vike/tree/main/vike/shared/page-configs/"
    click CT "https://github.com/vikejs/vike/tree/main/vike/shared/page-configs/Config/"
    click CP2 "https://github.com/vikejs/vike/tree/main/vike/shared/page-configs/serialize/"
    click RR "https://github.com/vikejs/vike/blob/main/vike/shared/route/resolveRoute.ts"
    click React "https://github.com/vikejs/vike/tree/main/vike/test/vike-react/"
    click Vue "https://github.com/vikejs/vike/tree/main/vike/test/vike-vue/"
    click BS "https://github.com/vikejs/vike/tree/main/vike/node/plugin/plugins/buildConfig/"
    click PCM "https://github.com/vikejs/vike/blob/main/vike/shared/getPageContext.ts"

    classDef core fill:#2374ab
    classDef client fill:#ff7f50
    classDef server fill:#4caf50
    classDef plugin fill:#9c27b0
    classDef config fill:#ff9800
    classDef integration fill:#795548
    classDef build fill:#607d8b

    class CR,SR,PS,PRE,CS core
    class CRoute,SRoute,PCM,NH,HYD client
    class PR,RR,HG,AM server
    class CP,PU,BS plugin
    class CT,CP2 config
    class React,Vue,Solid integration
    class Dev,Prod,VP build
```
