# cptsmrz/remin architecture

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

- Interactive diagram: https://gitdiagram.com/cptsmrz/remin
- Repository: https://github.com/cptsmrz/remin

## Overview

This repository contains an early Remin wardrobe-inventory application: its substantial runtime code models inventories and wardrobe items, applies commands, creates domain events, and provides in-memory and persistence adapters. The README is still the generic Next.js starter README, so it does not document the product workflow or connect the page to the inventory service. The graph shows the supported domain and persistence relationships; the UI-to-service connection and wider documented-in-tree modules are not inferred from unsampled code.

Main entry points: [`lib/inventory/inventory-application-service.ts`](https://github.com/cptsmrz/remin/blob/main/lib/inventory/inventory-application-service.ts) (Inventory commands), [`lib/inventory/inventory.ts`](https://github.com/cptsmrz/remin/blob/main/lib/inventory/inventory.ts) (Inventory), [`lib/inventory/wardrobe-item.ts`](https://github.com/cptsmrz/remin/blob/main/lib/inventory/wardrobe-item.ts) (Wardrobe item), [`lib/inventory/inventory-repository.ts`](https://github.com/cptsmrz/remin/blob/main/lib/inventory/inventory-repository.ts) (Repository contract)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_application["Application"]
  node_service["Inventory commands"]
  node_repository_contract["Repository contract"]
  node_events["Domain events"]
end

subgraph group_domain["Inventory domain"]
  node_inventory["Inventory<br/>[inventory.ts]"]
  node_wardrobe_item["Wardrobe item<br/>[wardrobe-item.ts]"]
  node_item_state["Item lifecycle"]
  node_entity["Canonical entity<br/>[entity.ts]"]
  node_canonical_id["Canonical IDs<br/>[canonical-id.ts]"]
  node_canonical_event["Canonical event<br/>[event.ts]"]
end

subgraph group_persistence["Persistence"]
  node_memory_repo[("In-memory repository")]
  node_local_repo[("Local storage adapter")]
  node_mapper["Persistence mapper"]
  node_supabase_repo[("Supabase adapter")]
end

node_user(("User"))
node_page["App page<br/>[page.tsx]"]
node_browser_storage[("Browser storage")]
node_supabase[("Supabase")]

node_service -->|"loads and saves"| node_repository_contract
node_service -->|"creates and updates"| node_inventory
node_service -->|"manages items"| node_wardrobe_item
node_service -->|"creates events"| node_events
node_events -->|"uses event shape"| node_canonical_event
node_inventory -->|"contains items"| node_wardrobe_item
node_inventory -->|"checks availability"| node_item_state
node_wardrobe_item -->|"validates transitions"| node_item_state
node_inventory -->|"extends"| node_entity
node_wardrobe_item -->|"extends"| node_entity
node_entity -->|"uses identifier"| node_canonical_id
node_canonical_event -->|"uses identifiers"| node_canonical_id
node_memory_repo -->|"implements"| node_repository_contract
node_local_repo -->|"implements"| node_repository_contract
node_local_repo -->|"maps records"| node_mapper
node_supabase_repo -->|"implements"| node_repository_contract
node_supabase_repo -->|"maps records"| node_mapper
node_local_repo -->|"reads and writes"| node_browser_storage
node_supabase_repo -->|"queries tables"| node_supabase

click node_page "https://github.com/cptsmrz/remin/blob/main/app/page.tsx"
click node_service "https://github.com/cptsmrz/remin/blob/main/lib/inventory/inventory-application-service.ts"
click node_repository_contract "https://github.com/cptsmrz/remin/blob/main/lib/inventory/inventory-repository.ts"
click node_events "https://github.com/cptsmrz/remin/blob/main/lib/inventory/inventory-events.ts"
click node_inventory "https://github.com/cptsmrz/remin/blob/main/lib/inventory/inventory.ts"
click node_wardrobe_item "https://github.com/cptsmrz/remin/blob/main/lib/inventory/wardrobe-item.ts"
click node_item_state "https://github.com/cptsmrz/remin/blob/main/lib/inventory/wardrobe-item-state.ts"
click node_entity "https://github.com/cptsmrz/remin/blob/main/lib/domain/entity.ts"
click node_canonical_id "https://github.com/cptsmrz/remin/blob/main/lib/domain/canonical-id.ts"
click node_canonical_event "https://github.com/cptsmrz/remin/blob/main/lib/domain/event.ts"
click node_memory_repo "https://github.com/cptsmrz/remin/blob/main/lib/inventory/in-memory-inventory-repository.ts"
click node_local_repo "https://github.com/cptsmrz/remin/blob/main/lib/infrastructure/persistence/local-storage-inventory-repository.ts"
click node_mapper "https://github.com/cptsmrz/remin/blob/main/lib/infrastructure/persistence/inventory-mapper.ts"
click node_supabase_repo "https://github.com/cptsmrz/remin/blob/main/lib/infrastructure/persistence/supabase-inventory-repository.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_service,node_repository_contract,node_events,node_user toneBlue
class node_inventory,node_wardrobe_item,node_item_state,node_entity,node_canonical_id,node_canonical_event,node_browser_storage,node_supabase toneAmber
class node_memory_repo,node_local_repo,node_mapper,node_supabase_repo toneMint
class node_page toneTeal
```

## Components

### Application

- [Inventory commands](https://github.com/cptsmrz/remin/blob/main/lib/inventory/inventory-application-service.ts): `lib/inventory/inventory-application-service.ts`
- [Repository contract](https://github.com/cptsmrz/remin/blob/main/lib/inventory/inventory-repository.ts): `lib/inventory/inventory-repository.ts`
- [Domain events](https://github.com/cptsmrz/remin/blob/main/lib/inventory/inventory-events.ts): `lib/inventory/inventory-events.ts`

### Inventory domain

- [Inventory](https://github.com/cptsmrz/remin/blob/main/lib/inventory/inventory.ts): `lib/inventory/inventory.ts`
- [Wardrobe item](https://github.com/cptsmrz/remin/blob/main/lib/inventory/wardrobe-item.ts): `lib/inventory/wardrobe-item.ts`
- [Item lifecycle](https://github.com/cptsmrz/remin/blob/main/lib/inventory/wardrobe-item-state.ts): `lib/inventory/wardrobe-item-state.ts`
- [Canonical entity](https://github.com/cptsmrz/remin/blob/main/lib/domain/entity.ts): `lib/domain/entity.ts`
- [Canonical IDs](https://github.com/cptsmrz/remin/blob/main/lib/domain/canonical-id.ts): `lib/domain/canonical-id.ts`
- [Canonical event](https://github.com/cptsmrz/remin/blob/main/lib/domain/event.ts): `lib/domain/event.ts`

### Persistence

- [In-memory repository](https://github.com/cptsmrz/remin/blob/main/lib/inventory/in-memory-inventory-repository.ts): `lib/inventory/in-memory-inventory-repository.ts`
- [Local storage adapter](https://github.com/cptsmrz/remin/blob/main/lib/infrastructure/persistence/local-storage-inventory-repository.ts): `lib/infrastructure/persistence/local-storage-inventory-repository.ts`
- [Persistence mapper](https://github.com/cptsmrz/remin/blob/main/lib/infrastructure/persistence/inventory-mapper.ts): `lib/infrastructure/persistence/inventory-mapper.ts`
- [Supabase adapter](https://github.com/cptsmrz/remin/blob/main/lib/infrastructure/persistence/supabase-inventory-repository.ts): `lib/infrastructure/persistence/supabase-inventory-repository.ts`

### Other components

- **User**
- [App page](https://github.com/cptsmrz/remin/blob/main/app/page.tsx): `app/page.tsx`
- **Browser storage**
- **Supabase**

## Connections

- Inventory commands → Repository contract: loads and saves (evidence: `lib/inventory/inventory-application-service.ts`)
- Inventory commands → Inventory: creates and updates (evidence: `lib/inventory/inventory-application-service.ts`)
- Inventory commands → Wardrobe item: manages items (evidence: `lib/inventory/inventory-application-service.ts`)
- Inventory commands → Domain events: creates events (evidence: `lib/inventory/inventory-application-service.ts`)
- Domain events → Canonical event: uses event shape (evidence: `lib/inventory/inventory-events.ts`)
- Inventory → Wardrobe item: contains items (evidence: `lib/inventory/inventory.ts`)
- Inventory → Item lifecycle: checks availability (evidence: `lib/inventory/inventory.ts`)
- Wardrobe item → Item lifecycle: validates transitions (evidence: `lib/inventory/wardrobe-item.ts`)
- Inventory → Canonical entity: extends (evidence: `lib/inventory/inventory.ts`)
- Wardrobe item → Canonical entity: extends (evidence: `lib/inventory/wardrobe-item.ts`)
- Canonical entity → Canonical IDs: uses identifier (evidence: `lib/domain/entity.ts`)
- Canonical event → Canonical IDs: uses identifiers (evidence: `lib/domain/event.ts`)
- In-memory repository → Repository contract: implements (evidence: `lib/inventory/in-memory-inventory-repository.ts`)
- Local storage adapter → Repository contract: implements (evidence: `lib/infrastructure/persistence/local-storage-inventory-repository.ts`)
- Local storage adapter → Persistence mapper: maps records (evidence: `lib/infrastructure/persistence/local-storage-inventory-repository.ts`)
- Supabase adapter → Repository contract: implements (evidence: `lib/infrastructure/persistence/supabase-inventory-repository.ts`)
- Supabase adapter → Persistence mapper: maps records (evidence: `lib/infrastructure/persistence/supabase-inventory-repository.ts`)
- Local storage adapter → Browser storage: reads and writes (evidence: `lib/infrastructure/persistence/local-storage-inventory-repository.ts`)
- Supabase adapter → Supabase: queries tables (evidence: `lib/infrastructure/persistence/supabase-inventory-repository.ts`)
