# acodev/olddash architecture

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

- Interactive diagram: https://gitdiagram.com/acodev/olddash
- Repository: https://github.com/acodev/olddash

## Overview

1. **Overall shape**
   - This is a single Next.js application using the App Router.
   - The app combines UI pages, API routes, and server-side business logic in one codebase rather than splitting into separate frontend/backend services.
   - The main architectural boundary is `src/app` for routes and `src/lib` for domain logic, with `src/components` for reusable UI.

2. **Presentation layer**
   - User-facing screens live under `src/app/*/page.tsx` for areas like dashboard, billing, revenue, users, groups, packager, profile, login, password reset, and auger management.
   - Most pages are thin route shells that compose feature components from `src/components/*`.
   - Shared layout and navigation are centralized in `src/app/layout.tsx` and sidebar/nav components.

3. **API layer**
   - All server endpoints are implemented as Next.js route handlers under `src/app/api/**/route.ts`.
   - The API surface is broad and domain-oriented: projects, users, groups, payment methods, payments, reports, revenue, product images/types, package downloads, skin validation, auth flows, and auger operations.
   - These handlers are the main ingress for client actions and likely call into `src/lib/*` services or Prisma.

4. **Data persistence**
   - Prisma is the database layer, with the schema in `prisma/schema.prisma` and the client wrapper in `src/lib/prisma.ts`.
   - This suggests a relational database-backed app where most entities such as users, projects, payment methods, invites, groups, and reports are stored centrally.
   - The API routes and feature components likely read/write through Prisma rather than directly accessing external storage.

5. **Authentication and session model**
   - Authentication is handled through NextAuth in `src/app/api/auth/[...nextauth]/route.ts` and `src/lib/auth.ts`.
   - Session state is propagated to the client via `src/components/providers/SessionProvider.tsx` and general providers in `Providers.tsx`.
   - Access control is enforced in the UI with `PermissionGuard`, `NoAccessState`, and hooks like `useSession` and `usePermissions`.

6. **Core business domains**
   - The repository is organized around several operational domains:
     - **Projects** and available products
     - **Users**, invites, and groups
     - **Billing** and payment methods
     - **Revenue** and payment reporting
     - **Auger** management/status/submissions
     - **Packager** creation and downloads
     - **Skin validation**
   - This is not a generic CRUD app; it appears to be an internal operations platform for managing digital products, payments, and partner access.

7. **Packager subsystem**
   - Packaging logic is isolated in `src/lib/packager/**` with separate builders for addon, skinpack, and world artifacts.
   - Each builder has templates and helper libraries for tasks like crypto, image processing, mapping, UUID generation, token handling, placeholder substitution, and zipping.
   - Built packages are exposed as downloadable assets from `public/packages/**`, and package download is served through `src/app/api/download-package/**`.
   - The presence of many ZIP files under `public/packages/skinpack` indicates the app also serves prebuilt distributable artifacts, not just generated ones.

8. **Payment and billing flow**
   - Payment-related functionality centers on `payment-methods`, `billing`, and `payments/wise-batch`.
   - `src/lib/paymentService.ts` and `src/lib/revenueService.ts` likely encapsulate the accounting/business logic used by the payment and revenue endpoints.
   - `src/app/api/reports/payments/send-email` indicates reporting can be exported or notified via email, making email part of the financial workflow.

9. **Auger integration**
   - Auger-related code lives in `src/lib/augerService.ts`, `src/other/auger/*`, and multiple API/page routes for projects, submissions, management, and status.
   - The repo contains marketplace metadata files such as genre, price tier, tags, and submission modal config, suggesting the app supports structured marketplace submission workflows.
   - This looks like an external platform integration with a dedicated admin/ops surface inside the app.

10. **Content and media utilities**
   - `product-images`, `product-types`, and `validate-skin` form a media/content validation area.
   - The custom `SkinValidator` components and `MinecraftSkinViewer` suggest visual inspection and validation are part of the workflow, not just file storage.
   - Static resources and generated files are split between `public/` and UI components.

11. **Reusable UI and interaction layer**
   - Most UI primitives come from `src/components/ui/*`, with feature-specific composites like tables, charts, forms, dropzones, and management views.
   - The app uses a modern component-driven client layer, including shared navigation, tables, dialogs, calendars, charts, and toast/alert patterns.
   - Responsive behavior is supported by hooks like `use-mobile` and debouncing utilities.

12. **Important architectural boundaries for a diagram**
   - Draw the system as one Next.js application with three main internal zones:
     - **Route/UI layer** in `src/app`
     - **Server/API and domain services** in `src/app/api` and `src/lib`
     - **Shared client components** in `src/components`
   - External dependencies to show are the database via Prisma, authentication via NextAuth, email/payment-related integrations, and any Auger/Wise workflows.
   - Static downloadable artifacts under `public/packages` are a separate asset boundary from live generated packager logic.

Main entry points: [`src/components/PackagerClient.tsx`](https://github.com/acodev/olddash/blob/main/src/components/PackagerClient.tsx) (Feature views), [`src/lib/packager/index.ts`](https://github.com/acodev/olddash/blob/main/src/lib/packager/index.ts) (Packager engine), [`src/lib/auth.ts`](https://github.com/acodev/olddash/blob/main/src/lib/auth.ts) (Auth logic), [`src/lib/prisma.ts`](https://github.com/acodev/olddash/blob/main/src/lib/prisma.ts) (Prisma client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App Router"]
  node_app_root["Root shell<br/>next-app<br/>[layout.tsx]"]
  node_app_pages["Screens<br/>route pages"]
  node_app_api["API routes<br/>route handlers"]
  node_app_auth["Auth routes<br/>[route.ts]"]
  node_app_projects["Projects API<br/>domain API"]
  node_app_people["People API<br/>domain API"]
  node_app_finance["Finance API<br/>domain API"]
  node_app_packager["Packager API<br/>generation API<br/>[route.ts]"]
  node_app_media["Media checks<br/>validation API<br/>[route.ts]"]
  node_app_auger["Auger API<br/>integration API<br/>[route.ts]"]
end

subgraph group_ui["Shared UI"]
  node_ui_shell["Nav shell<br/>ui chrome<br/>[app-sidebar.tsx]"]
  node_ui_feature["Feature views<br/>feature components<br/>[PackagerClient.tsx]"]
  node_ui_auth["Auth UI<br/>auth components"]
  node_ui_shared["UI primitives<br/>design system"]
end

subgraph group_server["Server Domain"]
  node_srv_auth["Auth logic<br/>nextauth config<br/>[auth.ts]"]
  node_srv_db[("Prisma client<br/>database access<br/>[prisma.ts]")]
  node_srv_finance["Finance services<br/>business services<br/>[paymentService.ts]"]
  node_srv_packager["Packager engine<br/>artifact builder<br/>[index.ts]"]
  node_srv_validator["Skin validator<br/>validation logic<br/>[index.ts]"]
  node_srv_auger["Auger service<br/>integration service<br/>[augerService.ts]"]
end

subgraph group_external["External Boundaries"]
  node_ext_db[("Database<br/>postgres/mysql<br/>[schema.prisma]")]
  node_ext_mail["Email<br/>notification<br/>[mail.ts]"]
  node_ext_wise["Wise batch<br/>payment rail"]
  node_ext_packages["Package assets<br/>static artifacts"]
  node_ext_auger["Auger platform<br/>external marketplace<br/>[marketplaceTags.ts]"]
end

node_app_root -->|"uses"| node_ui_shell
node_app_root -->|"wraps"| node_ui_auth
node_app_pages -->|"composes"| node_ui_feature
node_app_pages -->|"renders"| node_ui_shared
node_app_api -->|"reads/writes"| node_srv_db
node_app_api -->|"authenticates"| node_srv_auth
node_app_auth -->|"implements"| node_srv_auth
node_app_auth -->|"sends"| node_ext_mail
node_app_projects -->|"queries"| node_srv_db
node_app_people -->|"queries"| node_srv_db
node_app_finance -->|"delegates"| node_srv_finance
node_app_finance -->|"exports"| node_ext_wise
node_app_finance -->|"emails"| node_ext_mail
node_app_packager -->|"builds"| node_srv_packager
node_app_packager -->|"serves"| node_ext_packages
node_app_media -->|"validates"| node_srv_validator
node_app_auger -->|"coordinates"| node_srv_auger
node_srv_auth -->|"stores sessions/users"| node_ext_db
node_srv_db -->|"connects"| node_ext_db
node_srv_finance -->|"reads/writes"| node_ext_db
node_srv_packager -->|"outputs"| node_ext_packages
node_srv_packager -->|"uses"| node_srv_validator
node_srv_auger -->|"integrates"| node_ext_auger
node_ui_auth -->|"consumes"| node_srv_auth
node_ui_feature -->|"calls"| node_srv_finance
node_ui_feature -->|"calls"| node_srv_packager
node_ui_feature -->|"calls"| node_srv_auger
node_ui_shared -->|"supports"| node_ui_feature

click node_app_root "https://github.com/acodev/olddash/blob/main/src/app/layout.tsx"
click node_app_pages "https://github.com/acodev/olddash/tree/main/src/app"
click node_app_api "https://github.com/acodev/olddash/tree/main/src/app/api"
click node_app_auth "https://github.com/acodev/olddash/blob/main/src/app/api/auth/[...nextauth]/route.ts"
click node_app_projects "https://github.com/acodev/olddash/tree/main/src/app/api/projects"
click node_app_people "https://github.com/acodev/olddash/tree/main/src/app/api/users"
click node_app_finance "https://github.com/acodev/olddash/tree/main/src/app/api/payment-methods"
click node_app_packager "https://github.com/acodev/olddash/blob/main/src/app/api/packager/route.ts"
click node_app_media "https://github.com/acodev/olddash/blob/main/src/app/api/validate-skin/route.ts"
click node_app_auger "https://github.com/acodev/olddash/blob/main/src/app/api/auger-projects/route.ts"
click node_ui_shell "https://github.com/acodev/olddash/blob/main/src/components/app-sidebar.tsx"
click node_ui_feature "https://github.com/acodev/olddash/blob/main/src/components/PackagerClient.tsx"
click node_ui_auth "https://github.com/acodev/olddash/blob/main/src/components/providers/SessionProvider.tsx"
click node_ui_shared "https://github.com/acodev/olddash/tree/main/src/components/ui"
click node_srv_auth "https://github.com/acodev/olddash/blob/main/src/lib/auth.ts"
click node_srv_db "https://github.com/acodev/olddash/blob/main/src/lib/prisma.ts"
click node_srv_finance "https://github.com/acodev/olddash/blob/main/src/lib/paymentService.ts"
click node_srv_packager "https://github.com/acodev/olddash/blob/main/src/lib/packager/index.ts"
click node_srv_validator "https://github.com/acodev/olddash/blob/main/src/lib/validator/index.ts"
click node_srv_auger "https://github.com/acodev/olddash/blob/main/src/lib/augerService.ts"
click node_ext_db "https://github.com/acodev/olddash/blob/main/prisma/schema.prisma"
click node_ext_mail "https://github.com/acodev/olddash/blob/main/src/lib/mail.ts"
click node_ext_wise "https://github.com/acodev/olddash/blob/main/src/other/Wise/bacth_paymentsWise.csv"
click node_ext_packages "https://github.com/acodev/olddash/tree/main/public/packages/skinpack"
click node_ext_auger "https://github.com/acodev/olddash/blob/main/src/other/auger/marketplaceTags.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app_root,node_app_pages,node_app_api,node_app_auth,node_app_projects,node_app_people,node_app_finance,node_app_packager,node_app_media,node_app_auger toneBlue
class node_ui_shell,node_ui_feature,node_ui_auth,node_ui_shared toneAmber
class node_srv_auth,node_srv_db,node_srv_finance,node_srv_packager,node_srv_validator,node_srv_auger toneMint
class node_ext_db,node_ext_mail,node_ext_wise,node_ext_packages,node_ext_auger toneRose
```

## Components

### App Router

Next.js pages, layouts, and route handlers

- [Root shell](https://github.com/acodev/olddash/blob/main/src/app/layout.tsx): next-app · Global layout, landing entry, and app providers · `src/app/layout.tsx`
- [Screens](https://github.com/acodev/olddash/tree/main/src/app): route pages · Dashboard, billing, users, revenue, packager, profile, login, and admin screens · `src/app`
- [API routes](https://github.com/acodev/olddash/tree/main/src/app/api): route handlers · All server endpoints under src/app/api · `src/app/api`
- [Auth routes](https://github.com/acodev/olddash/blob/main/src/app/api/auth/[...nextauth]/route.ts): nextauth routes · Login, forgot/reset password, invite accept, and NextAuth handler · `src/app/api/auth/[...nextauth]/route.ts`
- [Projects API](https://github.com/acodev/olddash/tree/main/src/app/api/projects): domain API · Projects, available products, sync, and project details · `src/app/api/projects`
- [People API](https://github.com/acodev/olddash/tree/main/src/app/api/users): domain API · Users, invites, partner groups, and permissions-related endpoints · `src/app/api/users`
- [Finance API](https://github.com/acodev/olddash/tree/main/src/app/api/payment-methods): domain API · Billing, payment methods, wise batch payments, revenue, and reports · `src/app/api/payment-methods`
- [Packager API](https://github.com/acodev/olddash/blob/main/src/app/api/packager/route.ts): generation API · Package generation and download endpoints · `src/app/api/packager/route.ts`
- [Media checks](https://github.com/acodev/olddash/blob/main/src/app/api/validate-skin/route.ts): validation API · Product images, product types, and skin validation endpoints · `src/app/api/validate-skin/route.ts`
- [Auger API](https://github.com/acodev/olddash/blob/main/src/app/api/auger-projects/route.ts): integration API · Auger projects, submissions, status, and management flows · `src/app/api/auger-projects/route.ts`

### Shared UI

Reusable client components and hooks

- [Nav shell](https://github.com/acodev/olddash/blob/main/src/components/app-sidebar.tsx): ui chrome · Sidebar, header, navigation, and layout chrome · `src/components/app-sidebar.tsx`
- [Feature views](https://github.com/acodev/olddash/blob/main/src/components/PackagerClient.tsx): feature components · Management tables, billing forms, revenue views, packager client, and auger screens · `src/components/PackagerClient.tsx`
- [Auth UI](https://github.com/acodev/olddash/blob/main/src/components/providers/SessionProvider.tsx): auth components · Login, forgot-password, permission guard, no-access state, and session provider · `src/components/providers/SessionProvider.tsx`
- [UI primitives](https://github.com/acodev/olddash/tree/main/src/components/ui): design system · Reusable tables, dialogs, charts, inputs, alerts, and other base components · `src/components/ui`

### Server Domain

Auth, persistence, business services, and packager logic

- [Auth logic](https://github.com/acodev/olddash/blob/main/src/lib/auth.ts): nextauth config · Session and access control logic used by routes and UI · `src/lib/auth.ts`
- [Prisma client](https://github.com/acodev/olddash/blob/main/src/lib/prisma.ts): database access · Database wrapper and schema-backed persistence layer · `src/lib/prisma.ts`
- [Finance services](https://github.com/acodev/olddash/blob/main/src/lib/paymentService.ts): business services · Payment and revenue workflows used by finance endpoints · `src/lib/paymentService.ts`
- [Packager engine](https://github.com/acodev/olddash/blob/main/src/lib/packager/index.ts): artifact builder · Addon, skinpack, and world packaging builders plus helper libraries · `src/lib/packager/index.ts`
- [Skin validator](https://github.com/acodev/olddash/blob/main/src/lib/validator/index.ts): validation logic · Skin layout and validation helpers for content checks · `src/lib/validator/index.ts`
- [Auger service](https://github.com/acodev/olddash/blob/main/src/lib/augerService.ts): integration service · Auger-specific coordination and external workflow logic · `src/lib/augerService.ts`

### External Boundaries

Database, email, payment, and marketplace integrations

- [Database](https://github.com/acodev/olddash/blob/main/prisma/schema.prisma): postgres/mysql · Relational datastore defined by Prisma schema · `prisma/schema.prisma`
- [Email](https://github.com/acodev/olddash/blob/main/src/lib/mail.ts): notification · Outbound email for reports and password reset workflows · `src/lib/mail.ts`
- [Wise batch](https://github.com/acodev/olddash/blob/main/src/other/Wise/bacth_paymentsWise.csv): payment rail · Batch payment workflow and Wise CSV artifact · `src/other/Wise/bacth_paymentsWise.csv`
- [Package assets](https://github.com/acodev/olddash/tree/main/public/packages/skinpack): static artifacts · Prebuilt downloadable package files served from public/packages · `public/packages/skinpack`
- [Auger platform](https://github.com/acodev/olddash/blob/main/src/other/auger/marketplaceTags.ts): external marketplace · Marketplace and submission destination for Auger integrations · `src/other/auger/marketplaceTags.ts`

## Connections

- Root shell → Nav shell: uses · Global chrome and navigation
- Root shell → Auth UI: wraps · Providers and session context
- Screens → Feature views: composes · Route pages are mostly feature shells
- Screens → UI primitives: renders · Pages rely on shared UI primitives
- API routes → Prisma client: reads/writes · API handlers persist through Prisma
- API routes → Auth logic: authenticates · Protected endpoints use NextAuth/session logic
- Auth routes → Auth logic: implements · Auth route handlers are backed by auth config
- Auth routes → Email: sends · Password reset and auth notifications
- Projects API → Prisma client: queries · Project and product data access
- People API → Prisma client: queries · Users, invites, and groups data
- Finance API → Finance services: delegates · Billing, payments, and revenue workflows
- Finance API → Wise batch: exports · Wise batch payment output
- Finance API → Email: emails · Financial report notifications
- Packager API → Packager engine: builds · Generates distributable packages
- Packager API → Package assets: serves · Downloads static and generated artifacts
- Media checks → Skin validator: validates · Skin and media checks
- Auger API → Auger service: coordinates · Auger admin and submission flows
- Auth logic → Database: stores sessions/users · Auth state depends on persisted identity data
- Prisma client → Database: connects · Primary relational database boundary
- Finance services → Database: reads/writes · Accounting records and payment state
- Packager engine → Package assets: outputs · Built artifacts land alongside public package files
- Packager engine → Skin validator: uses · Packaging may validate content/assets
- Auger service → Auger platform: integrates · External marketplace/submission platform
- Auth UI → Auth logic: consumes · Client auth state and permissions
- Feature views → Finance services: calls · Feature screens trigger finance workflows
- Feature views → Packager engine: calls · Packager UI invokes generation flow
- Feature views → Auger service: calls · Auger management views use integration service
- UI primitives → Feature views: supports · Reusable tables, charts, dialogs, and inputs
