# wasp-lang/wasp architecture

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

- Interactive diagram: https://gitdiagram.com/wasp-lang/wasp
- Repository: https://github.com/wasp-lang/wasp

## Overview

The project is Wasp – a full‐stack web application specification framework built to “generate” a full React, Node.js (Express), and Prisma app from a concise declarative file (the “.wasp” file). The open‐source repository is the heart of the Wasp universe. Its purpose is to dramatically simplify full-stack web development, making it as rapid as writing just a few lines in a configuration file. It uses a compiler (mostly in Haskell) to translate a high-level declarative specification into boilerplate for the front-end, back-end, and database parts of the application. There are additional packages for deployment, Prisma management, Studio, and tooling, as well as a website with documentation and examples.

##### Primary components based on the file structure and README
- The core compiler (in the “waspc” directory), which is written in Haskell. This component is central; it parses the .wasp file and produces the generated application.
- The CLI and code generation layer (organized under folders like “waspc/cli” and “waspc/data/Generator”) which implements file copying, template rendering, and generation of the front-end, back-end, and deployment assets.
- The supporting packages (in “waspc/packages”) for deployment (deploy), Prisma (for database code), Studio (for UI of data), and TypeScript inspection.
- The examples folder (found also as “examples/…” in the repository) demonstrates concrete full-stack applications built with Wasp.
- The web folder which is the website with documentation, blog posts, and landing pages; though it is not part of the application runtime, it represents documentation and developer marketing.
- Ancillary tools (in “waspc/tools”) to help install or package code.

##### Relationships and data flows
- The Wasp developer writes a “main.wasp” configuration file that describes the app’s high-level aspects, such as app metadata, routes, pages, queries, and even Prisma models.
- The compiler (waspc) reads this high‐level specification, then uses the generators to produce a full boilerplate application. This includes:
– A client (React with react-query, etc.) for the front-end.
– A server (Node.js/Express) for back-end logic including RPC calls and authentication.
– A Prisma schema for database management.
- Deployment packages also exist so that the generated code can be deployed on various platforms without lock-in.
- In addition, the system supports generating configuration for jobs, email sending, and integration with third party auth providers (handled by configurable modules).

##### Incorporate technologies and sustainability details
- Mention that the front-end is built using React (with potential additional libraries like react-query) and uses TailwindCSS (evident from several tailwind.config files).
- The back-end is built with Node.js (Express is likely used given the “server” folder and common web practices).
- The Prisma ORM (support files like “schema.prisma”) facilitates database interactions.
- Deployment is abstract and can be done with different providers using configuration files present in “packages/deploy”.
- The repository uses modern Haskell tooling (cabal), TypeScript’s tooling (tsconfig.json), and various GitHub workflows for CI.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Input Layer
    DS["Developer Specification (.wasp file)"]:::input

    %% Core Compiler
    WC["Wasp Compiler (Haskell)"]:::core

    %% Generators
    subgraph "Generators"
        CG["Client Generator (React)"]:::generator
        SG["Server Generator (Express/Node, Prisma)"]:::generator
        DG["Deployment Generator"]:::generator
    end

    %% Generated Web Application
    subgraph "Generated Web Application"
        Client["Client (React)"]:::output
        Server["Server (Express/Node)"]:::output
        DB["Database Models (Prisma)"]:::output
        DP["Deployment Package"]:::output
    end

    %% Supporting Packages & Tools
    SP["Supporting Packages\n(Deploy, Prisma, Studio, TS-Inspect)"]:::support
    AT["Ancillary Tools"]:::support

    %% Additional Components
    Examples["Example Full-Stack Apps"]:::examples
    Docs["Documentation & Website"]:::docs
    CI["CI/CD (GitHub Workflows)"]:::support
    ExtAuth["Third-Party Auth Providers"]:::support

    %% Data Flow Connections
    DS -->|"specifies"| WC
    WC -->|"triggers"| CG
    WC -->|"triggers"| SG
    WC -->|"triggers"| DG

    CG -->|"generates"| Client
    SG -->|"generates"| Server
    SG -->|"integrates"| DB
    DG -->|"generates"| DP

    %% Supporting components integration
    WC -->|"uses"| SP
    WC -->|"utilizes"| AT

    Client ---|"forms part of"| Client
    Client --- Server
    Server --- DB

    %% Generated app connections to external resources
    Client -->|"demonstrated by"| Examples
    Client -->|"documented in"| Docs
    Server -->|"secured by"| ExtAuth
    Client & Server & DP & DB --> CI

    %% Styles and Colors
    classDef input fill:#f9f,stroke:#333,stroke-width:2px;
    classDef core fill:#ffcccc,stroke:#990000,stroke-width:2px;
    classDef generator fill:#ccffcc,stroke:#006600,stroke-width:2px;
    classDef output fill:#cce5ff,stroke:#003366,stroke-width:2px;
    classDef support fill:#fff2cc,stroke:#b38f00,stroke-width:2px;
    classDef examples fill:#d9ead3,stroke:#38761d,stroke-width:2px;
    classDef docs fill:#d0e0e3,stroke:#115e67,stroke-width:2px;

    %% Click Events
    click WC "https://github.com/wasp-lang/wasp/tree/main/waspc"
    click CG "https://github.com/wasp-lang/wasp/tree/main/waspc/cli"
    click SG "https://github.com/wasp-lang/wasp/tree/main/waspc/data/Generator"
    click DG "https://github.com/wasp-lang/wasp/tree/main/waspc/data/Generator"
    click SP "https://github.com/wasp-lang/wasp/tree/main/waspc/packages"
    click AT "https://github.com/wasp-lang/wasp/tree/main/waspc/tools"
    click Examples "https://github.com/wasp-lang/wasp/tree/main/examples"
    click Docs "https://github.com/wasp-lang/wasp/tree/main/web"
```
