# solana-developers/solana-templates architecture

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

- Interactive diagram: https://gitdiagram.com/solana-developers/solana-templates
- Repository: https://github.com/solana-developers/solana-templates

## Overview

##### Project type and purpose
- This is an open-source monorepo of project scaffolding “templates” for the create-solana-dapp CLI.
- It contains both “legacy” and current templates for multiple front-end and back-end stacks (Next.js+Tailwind, React+Vite+Tailwind, Node+Express, Node script).
- The CLI invokes these template folders, reads metadata (components.json, README), and copies files into a new dApp project.

##### File structure
- Top-level:
– pnpm-workspace.yaml + package.json: orchestrate multiple packages using pnpm workspaces.
– .github/workflows: CI for tests/validation.
– legacy/: archived/previous templates.
– templates/: active templates.
- Each template subfolder holds a self-contained project scaffold:
– Template metadata (components.json)
– Framework config (next.config.ts, vite.config.ts, Dockerfile for Node/Express)
– Source code for a minimal Solana dApp (frontend pages, Solana Anchor programs, UI components, data-access layers).
- Common patterns: file-based template metadata, monorepo workspaces, TypeScript + Node.js, multiple framework stacks.

##### README for additional insights
- Confirms that this repo serves as the “official templates” for create-solana-dapp CLI.
- No runtime services inside this repo—its sole role is to provide static files to the CLI.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Nodes
    CLI["create-solana-dapp CLI"]:::cli
    Workspace["Monorepo Root"]:::repo
    CI["CI Pipeline"]:::ci
    UserProject["User New Project"]:::repo

    subgraph "Legacy Templates"
        direction TB
        LegacyNextBasic["legacy-next-tailwind-basic"]:::template
        LegacyNextCounter["legacy-next-tailwind-counter"]:::template
        LegacyNextGeneric["legacy-next-tailwind"]:::template
        LegacyReactBasic["legacy-react-vite-tailwind-basic"]:::template
        LegacyReactCounter["legacy-react-vite-tailwind-counter"]:::template
        LegacyReactGeneric["legacy-react-vite-tailwind"]:::template
    end

    subgraph "Active Templates"
        direction TB
        ActiveNext["template-next-tailwind"]:::template
        ActiveReact["template-react-vite-tailwind"]:::template
        ActiveExpress["template-node-express"]:::template
        ActiveScript["template-node-script"]:::template
    end

    %% Relationships
    CLI -->|"reads metadata & files"| LegacyTemplates
    CLI -->|"reads metadata & files"| ActiveTemplates
    CLI -->|"copies files"| UserProject
    CI -->|"validates templates"| LegacyTemplates
    CI -->|"validates templates"| ActiveTemplates
    CLI -->|"monorepo context"| Workspace

    %% Click Events
    click Workspace "https://github.com/solana-developers/solana-templates/blob/main//package.json"
    click CI "https://github.com/solana-developers/solana-templates/blob/main//.github/workflows/test.yml"
    click LegacyTemplates "https://github.com/solana-developers/solana-templates/tree/main//legacy"
    click ActiveTemplates "https://github.com/solana-developers/solana-templates/tree/main//templates"
    click LegacyNextBasic "https://github.com/solana-developers/solana-templates/tree/main//legacy/legacy-next-tailwind-basic"
    click LegacyNextCounter "https://github.com/solana-developers/solana-templates/tree/main//legacy/legacy-next-tailwind-counter"
    click LegacyNextGeneric "https://github.com/solana-developers/solana-templates/tree/main//legacy/legacy-next-tailwind"
    click LegacyReactBasic "https://github.com/solana-developers/solana-templates/tree/main//legacy/legacy-react-vite-tailwind-basic"
    click LegacyReactCounter "https://github.com/solana-developers/solana-templates/tree/main//legacy/legacy-react-vite-tailwind-counter"
    click LegacyReactGeneric "https://github.com/solana-developers/solana-templates/tree/main//legacy/legacy-react-vite-tailwind"
    click ActiveNext "https://github.com/solana-developers/solana-templates/tree/main//templates/template-next-tailwind"
    click ActiveReact "https://github.com/solana-developers/solana-templates/tree/main//templates/template-react-vite-tailwind"
    click ActiveExpress "https://github.com/solana-developers/solana-templates/tree/main//templates/template-node-express"
    click ActiveScript "https://github.com/solana-developers/solana-templates/tree/main//templates/template-node-script"

    %% Styles
    classDef cli fill:#ADD8E6,stroke:#000,color:#000
    classDef repo fill:#D3D3D3,stroke:#000,color:#000
    classDef template fill:#90EE90,stroke:#000,color:#000
    classDef ci fill:#FFA500,stroke:#000,color:#000
```
