# tsukutteasobo/asobo architecture

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

- Interactive diagram: https://gitdiagram.com/tsukutteasobo/asobo
- Repository: https://github.com/tsukutteasobo/asobo

## Overview

##### Project Type and Purpose
- This is a **Monorepo** offering a **Nuxt 3 + Nuxt UI** application template.
- It includes:
- A front-end SSR/UI project (`src/app`)
- A server/API module (`src/server`)
- Shared TypeScript types (`src/shared`)
- Scaffolding tooling via **scaffdog** in `.config/.scaffdog`
- Workspace management with **pnpm**

##### Main Components to Reflect
1. **Developer / CLI Layer**
- Runs commands: `pnpm ui dev`, `pnpm gen:cm`, `nr gen:api`
- Invokes **pnpm** / **antfu/ni**, **scaffdog**
2. **Code-Generation Engine**
- `.config/.scaffdog` reads templates, outputs new components/pages/api files under `src/app/components`, `src/app/pages`, or `src/server`
3. **Monorepo Packages** (pnpm Workspace)
- **app**
- Nuxt 3 application (`src/app/nuxt.config.ts`, `app.vue`, `app.config.ts`)
- UI layer: `components/ui`, feature components: `components/feature`
- Routing/pages: `pages`
- Layouts & assets
- **server**
- TypeScript API endpoints, business logic (under `src/server`)
- **shared**
- Shared TypeScript types (under `src/shared/types`)
4. **Framework & Build Tools**
- **Nuxt 3** (SSR + Vite under the hood)
- **Nuxt UI** component library
- **Vite** bundler/dev server
- **Vitest**, **ESLint** for testing & linting
5. **Browser / User**
- Receives rendered pages from Nuxt SSR or CSR of Vue UI

##### Relationships & Data Flows
- Developer → CLI → Scaffdog → Code artifacts in Monorepo
- Developer → CLI → pnpm workspace scripts → Nuxt/Vite →
a) Builds front-end bundle → Browser
b) Serves API routes → Server module
- `app` ↔ `server` call via internal HTTP calls or Nuxt server routes
- `app` & `server` both consume types from `shared`

##### Architectural Patterns & Principles
- **Monorepo Separation of Concerns**: packages for UI, server, shared
- **Server-Side Rendering** with Nuxt + optional CSR
- **Code Generation** via scaffdog for consistency & rapid prototyping
- **Workspace Tooling** ensures single lockfile & cross-package linking

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer & CLI Layer
    subgraph "Developer & CLI" 
        direction TB
        PKG["package.json"]:::cli
        PNPM["pnpm-workspace.yaml"]:::cli
    end

    %% Code Generation Engine
    subgraph "Code Generation (scaffdog)" 
        direction TB
        CFG_DIR[".config/.scaffdog"]:::codegen
        CFG_MD["component.md"]:::codegen
        CFG_JS["config.js"]:::codegen
    end

    %% Build Tools
    subgraph "Build & Dev Tools"
        direction TB
        NUXT_CONF["src/nuxt.config.ts"]:::build
        VITEST[".config/vitest.ts"]:::build
        ESLINT["src/eslint.config.mjs"]:::build
    end

    %% Monorepo Workspace
    subgraph "pnpm Workspace" 
        direction TB

        subgraph "app (Nuxt 3 + UI)" 
            direction TB
            APP_DIR["src/app"]:::app
            APP_CFG["app.config.ts"]:::app
            APP_VUE["app.vue"]:::app
            MAIN_CSS["assets/css/main.css"]:::app
            THEME_CSS["assets/css/theme.css"]:::app
            UI_COMP["components/ui/index.vue"]:::app
            FEAT_COMP["components/feature/index.vue"]:::app
            LAYOUT["layouts/default.vue"]:::app
            PAGES["pages/index.vue"]:::app
        end

        subgraph "server (API Module)"
            direction TB
            SERVER_DIR["src/server"]:::server
            SERVER_TS["src/server/tsconfig.json"]:::server
        end

        subgraph "shared (Types)"
            direction TB
            SHARED_KEEP["src/shared/types/.keep"]:::shared
        end
    end

    %% Browser / User
    BROWSER["Browser / User"]:::browser

    %% Connections
    PKG --> CFG_DIR
    PNPM --> CFG_DIR
    CFG_DIR --> APP_DIR
    CFG_DIR --> SERVER_DIR

    PKG --> NUXT_CONF
    PNPM --> NUXT_CONF
    NUXT_CONF --> APP_DIR
    NUXT_CONF --> SERVER_DIR

    APP_DIR --> SERVER_DIR
    APP_DIR --> SHARED_KEEP
    SERVER_DIR --> SHARED_KEEP

    APP_DIR --> BROWSER
    NUXT_CONF --> BROWSER

    %% Click Events
    click PKG "https://github.com/tsukutteasobo/asobo/blob/main/package.json"
    click PNPM "https://github.com/tsukutteasobo/asobo/blob/main/pnpm-workspace.yaml"
    click CFG_DIR "https://github.com/tsukutteasobo/asobo/blob/main/.config/.scaffdog"
    click CFG_MD "https://github.com/tsukutteasobo/asobo/blob/main/.config/.scaffdog/component.md"
    click CFG_JS "https://github.com/tsukutteasobo/asobo/blob/main/.config/.scaffdog/config.js"
    click NUXT_CONF "https://github.com/tsukutteasobo/asobo/blob/main/src/nuxt.config.ts"
    click VITEST "https://github.com/tsukutteasobo/asobo/blob/main/.config/vitest.ts"
    click ESLINT "https://github.com/tsukutteasobo/asobo/blob/main/src/eslint.config.mjs"
    click APP_DIR "https://github.com/tsukutteasobo/asobo/tree/main/src/app"
    click APP_CFG "https://github.com/tsukutteasobo/asobo/blob/main/src/app/app.config.ts"
    click APP_VUE "https://github.com/tsukutteasobo/asobo/blob/main/src/app/app.vue"
    click MAIN_CSS "https://github.com/tsukutteasobo/asobo/blob/main/src/app/assets/css/main.css"
    click THEME_CSS "https://github.com/tsukutteasobo/asobo/blob/main/src/app/assets/css/theme.css"
    click UI_COMP "https://github.com/tsukutteasobo/asobo/blob/main/src/app/components/ui/index.vue"
    click FEAT_COMP "https://github.com/tsukutteasobo/asobo/blob/main/src/app/components/feature/index.vue"
    click LAYOUT "https://github.com/tsukutteasobo/asobo/blob/main/src/app/layouts/default.vue"
    click PAGES "https://github.com/tsukutteasobo/asobo/blob/main/src/app/pages/index.vue"
    click SERVER_DIR "https://github.com/tsukutteasobo/asobo/tree/main/src/server"
    click SERVER_TS "https://github.com/tsukutteasobo/asobo/blob/main/src/server/tsconfig.json"
    click SHARED_KEEP "https://github.com/tsukutteasobo/asobo/blob/main/src/shared/types/.keep"

    %% Styles
    classDef cli fill:#cce5ff,stroke:#004085,color:#004085
    classDef codegen fill:#d4edda,stroke:#155724,color:#155724
    classDef build fill:#d1ecf1,stroke:#0c5460,color:#0c5460
    classDef app fill:#fff3cd,stroke:#856404,color:#856404
    classDef server fill:#f8d7da,stroke:#721c24,color:#721c24
    classDef shared fill:#e2e3e5,stroke:#6c757d,color:#6c757d
    classDef browser fill:#f5e1ff,stroke:#6f42c1,color:#6f42c1
```
