# metastem/wikiless architecture

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

- Interactive diagram: https://gitdiagram.com/metastem/wikiless
- Repository: https://github.com/metastem/wikiless

## Overview

##### Main Components
- Backend Server: Located in the “src” folder (files like wikiless.js, routes.js, cache_control.js, and utils.js) form the core application logic. This Node.js server is responsible for routing requests, handling caching, and processing custom configurations.
- Static Assets & Frontend: The “static” directory contains all front-end resources including HTML pages (e.g., about.html), multiple CSS files (for different languages and themes, such as Wikipedia dark/light styles), images, and the skin templates (e.g., Vector skin) that define the UI.
- Configuration & Deployment: Files such as Dockerfile, docker-compose.yml, .dockerignore, wikiless.config, and package.json indicate that the application is containerized and configured to run in Docker environments. These files are essential for deployment and configuration management.
- Miscellaneous: Files like LICENSE.md, README.md, SECURITY.md, and GitHub-related files suggest this project’s open-source nature and collaboration model. They are less critical for the runtime architecture but important for project management and community contribution.

##### Relationships and Interactions
- Client Interaction: A user’s browser (client) interacts via HTTP (as indicated by usage of “http://localhost:8180”) with the backend server, which then serves dynamic content and static assets.
- Routing and API Layer: The backend routes incoming HTTP requests using the logic in “routes.js.” It acts as both the controller for business logic and as a gateway that delivers both customized content and static files.
- Static Content Delivery: Upon request, the server either directly serves the static HTML/CSS resources from the “static” folder or renders dynamic pages based on the templates and CSS themes.
- Containerized Deployment: The Dockerfile and docker-compose setup highlight the encapsulation of the server’s runtime environment, allowing for a consistent deployment pipeline.
- Privacy Enforcement: Although not a separate component, note that privacy enhancements are likely woven into both server logic (e.g., caching, minimal data logging) and static content (using privacy-focused design choices).

##### Architectural Patterns and Design Principles
- Containerization & Microservices Readiness: The use of Docker files indicates that the project is ready for containerized deployment and could potentially be scaled or integrated with additional microservices if needed.
- Security and Privacy First: Emphasis on privacy, with minimal dependency on tracking mechanisms, as per the README, is embedded in the design.

##### Including Relevant Technologies
- Node.js is central to running the server-side logic.
- Docker is used for containerization and deployment.
- CSS and HTML resources define the user interface.
- GitHub and open-source practices are integrated into the project’s development workflow.

- Within the server, separate modules for routing (routes.js), caching (cache_control.js), and utility functions (utils.js).
- Server module to the static content repository (the “static” directory) showing that static resources are served as part of the response.
- Enclose the backend server (and possibly the static assets) inside a “Docker Container” boundary to denote containerized deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% High-level Components
    Client["Client Browser"]:::clientStyle
    Client -->|"HTTP_Request"| DockerCont

    %% Docker Container Boundary
    subgraph "Docker Container"
        direction TB
        NS["Node.js Server"]:::serverStyle
        NS --> W["Entry Point (wikiless.js)"]:::serverStyle
        NS --> R["Routing (routes.js)"]:::serverStyle
        NS --> C["Caching (cache_control.js)"]:::serverStyle
        NS --> U["Utilities (utils.js)"]:::serverStyle
    end

    %% Static Assets outside Docker container but served by Node.js Server
    NS -->|"serves"| SA["Static Assets Repository"]:::staticStyle
    SA --> VS["Vector Skin Template"]:::staticStyle

    %% Configuration & Deployment Section
    Config["Configuration & Deployment"]:::configStyle
    Config --- D1["Dockerfile"]:::configStyle
    Config --- D2["docker-compose.yml"]:::configStyle
    Config --- D3[".dockerignore"]:::configStyle
    Config --- D4["wikiless.config"]:::configStyle
    Config --- D5["package.json"]:::configStyle

    %% Miscellaneous Project Information
    Misc["Miscellaneous Project Info"]:::miscStyle
    Misc --- M1["LICENSE.md"]:::miscStyle
    Misc --- M2["README.md"]:::miscStyle
    Misc --- M3["SECURITY.md"]:::miscStyle
    Misc --- M4[".github/"]:::miscStyle

    %% Click Events for Backend Server Files
    click W "https://github.com/metastem/wikiless/blob/main/src/wikiless.js"
    click R "https://github.com/metastem/wikiless/blob/main/src/routes.js"
    click C "https://github.com/metastem/wikiless/blob/main/src/cache_control.js"
    click U "https://github.com/metastem/wikiless/blob/main/src/utils.js"

    %% Click Events for Static Assets
    click SA "https://github.com/metastem/wikiless/tree/main/static/"
    click VS "https://github.com/metastem/wikiless/tree/main/static/w/skins/Vector"

    %% Click Events for Configuration & Deployment Files
    click D1 "https://github.com/metastem/wikiless/tree/main/Dockerfile"
    click D2 "https://github.com/metastem/wikiless/blob/main/docker-compose.yml"
    click D3 "https://github.com/metastem/wikiless/blob/main/.dockerignore"
    click D4 "https://github.com/metastem/wikiless/blob/main/wikiless.config"
    click D5 "https://github.com/metastem/wikiless/blob/main/package.json"

    %% Click Events for Miscellaneous Project Info
    click M1 "https://github.com/metastem/wikiless/blob/main/LICENSE.md"
    click M2 "https://github.com/metastem/wikiless/blob/main/README.md"
    click M3 "https://github.com/metastem/wikiless/blob/main/SECURITY.md"
    click M4 "https://github.com/metastem/wikiless/tree/main/.github/"

    %% Styles
    classDef clientStyle fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef serverStyle fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef staticStyle fill:#FFD700,stroke:#000,stroke-width:2px;
    classDef configStyle fill:#FFA07A,stroke:#000,stroke-width:2px;
    classDef miscStyle fill:#DDA0DD,stroke:#000,stroke-width:2px;
```
