# vickscarlet/liferestart architecture

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

- Interactive diagram: https://gitdiagram.com/vickscarlet/liferestart
- Repository: https://github.com/vickscarlet/liferestart

## Overview

Remake is a life-simulation game with a web interface and a console entry point. The main player workflow moves through mode and character selection, talent selection, attribute allocation, yearly play, summary, and achievement/progression screens. Web hooks coordinate those stages and call the game core to start, advance, summarize, and end a run; profile and unique state are loaded from and saved to browser storage. The graph also shows the sampled talent logic and its content, condition, and random-selection dependencies. Several UI and core modules are represented by their tree paths; their internal wiring was not sampled.

Main entry points: [`packages/hooks/src/play.ts`](https://github.com/vickscarlet/liferestart/blob/main/packages/hooks/src/play.ts) (Play hooks), [`packages/core/src/game.ts`](https://github.com/vickscarlet/liferestart/blob/main/packages/core/src/game.ts) (Game core), [`packages/core/src/talent.ts`](https://github.com/vickscarlet/liferestart/blob/main/packages/core/src/talent.ts) (Talent logic), [`apps/web/src/hooks/storage.ts`](https://github.com/vickscarlet/liferestart/blob/main/apps/web/src/hooks/storage.ts) (Storage lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["Player interfaces"]
  node_web["Web entry<br/>[index.tsx]"]
  node_gameui["Game shell<br/>[Game.tsx]"]
  node_stages["Game stages"]
  node_consoleapp["Console game<br/>[app.ts]"]
  node_consoleentry["Console entry<br/>[index.ts]"]
end

subgraph group_coordination["Web coordination"]
  node_gamehooks["Play hooks<br/>[play.ts]"]
  node_profilehooks["Profile hooks<br/>[profile.ts]"]
  node_allochooks["Allocation hooks<br/>[alloc.ts]"]
  node_talenthooks["Talent hooks<br/>[talent.ts]"]
  node_achievementhooks["Achievement hooks<br/>[achievement.ts]"]
  node_storagehook["Storage lifecycle<br/>[storage.ts]"]
  node_storageapi["Storage API<br/>[index.ts]"]
  node_localstorage[("Local storage<br/>[local.ts]")]
end

subgraph group_engine["Game engine"]
  node_core["Game core<br/>[game.ts]"]
  node_state["Game state<br/>[state.ts]"]
  node_talentcore["Talent logic<br/>[talent.ts]"]
  node_achievementcore["Achievement logic<br/>[achievement.ts]"]
  node_events["Event logic<br/>[event.ts]"]
end

subgraph group_content["Game content"]
  node_contentdata["Game content"]
  node_conditions["Condition parser<br/>[index.ts]"]
  node_random["Random utilities<br/>[index.ts]"]
end

node_player(("Player"))
node_consoleuser(("Console user"))

node_player -->|"opens"| node_web
node_web -->|"renders"| node_gameui
node_gameui -->|"presents"| node_stages
node_stages -->|"uses"| node_gamehooks
node_gamehooks -->|"starts, advances, summarizes, ends"| node_core
node_gamehooks -->|"reads profile"| node_profilehooks
node_gamehooks -->|"reads allocation"| node_allochooks
node_gamehooks -->|"resets talent state"| node_talenthooks
node_gamehooks -->|"updates game state"| node_state
node_storagehook -->|"loads profile into"| node_profilehooks
node_storagehook -->|"initializes, reads, writes"| node_storageapi
node_storageapi --> node_localstorage
node_core --> node_talentcore
node_core --> node_achievementcore
node_core --> node_events
node_talentcore -->|"reads talents"| node_contentdata
node_talentcore -->|"checks conditions"| node_conditions
node_talentcore -->|"selects randomly"| node_random
node_consoleuser -->|"runs"| node_consoleentry
node_consoleentry -->|"creates, initializes"| node_consoleapp

click node_web "https://github.com/vickscarlet/liferestart/blob/main/apps/web/src/index.tsx"
click node_gameui "https://github.com/vickscarlet/liferestart/blob/main/apps/web/src/Game.tsx"
click node_stages "https://github.com/vickscarlet/liferestart/tree/main/apps/web/src/containers"
click node_gamehooks "https://github.com/vickscarlet/liferestart/blob/main/packages/hooks/src/play.ts"
click node_profilehooks "https://github.com/vickscarlet/liferestart/blob/main/packages/hooks/src/profile.ts"
click node_allochooks "https://github.com/vickscarlet/liferestart/blob/main/packages/hooks/src/alloc.ts"
click node_talenthooks "https://github.com/vickscarlet/liferestart/blob/main/packages/hooks/src/talent.ts"
click node_achievementhooks "https://github.com/vickscarlet/liferestart/blob/main/packages/hooks/src/achievement.ts"
click node_storagehook "https://github.com/vickscarlet/liferestart/blob/main/apps/web/src/hooks/storage.ts"
click node_storageapi "https://github.com/vickscarlet/liferestart/blob/main/apps/web/src/storage/index.ts"
click node_localstorage "https://github.com/vickscarlet/liferestart/blob/main/apps/web/src/storage/local.ts"
click node_core "https://github.com/vickscarlet/liferestart/blob/main/packages/core/src/game.ts"
click node_state "https://github.com/vickscarlet/liferestart/blob/main/packages/core/src/state.ts"
click node_talentcore "https://github.com/vickscarlet/liferestart/blob/main/packages/core/src/talent.ts"
click node_achievementcore "https://github.com/vickscarlet/liferestart/blob/main/packages/core/src/achievement.ts"
click node_events "https://github.com/vickscarlet/liferestart/blob/main/packages/core/src/event.ts"
click node_contentdata "https://github.com/vickscarlet/liferestart/tree/main/packages/data/src"
click node_conditions "https://github.com/vickscarlet/liferestart/blob/main/packages/condition/index.ts"
click node_random "https://github.com/vickscarlet/liferestart/blob/main/packages/vitex/index.ts"
click node_consoleapp "https://github.com/vickscarlet/liferestart/blob/main/apps/console/app.ts"
click node_consoleentry "https://github.com/vickscarlet/liferestart/blob/main/apps/console/index.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_web,node_gameui,node_stages,node_consoleapp,node_consoleentry,node_consoleuser toneBlue
class node_gamehooks,node_profilehooks,node_allochooks,node_talenthooks,node_achievementhooks,node_storagehook,node_storageapi,node_localstorage toneAmber
class node_core,node_state,node_talentcore,node_achievementcore,node_events toneMint
class node_contentdata,node_conditions,node_random toneRose
class node_player toneIndigo
```

## Components

### Player interfaces

- [Web entry](https://github.com/vickscarlet/liferestart/blob/main/apps/web/src/index.tsx): `apps/web/src/index.tsx`
- [Game shell](https://github.com/vickscarlet/liferestart/blob/main/apps/web/src/Game.tsx): `apps/web/src/Game.tsx`
- [Game stages](https://github.com/vickscarlet/liferestart/tree/main/apps/web/src/containers): `apps/web/src/containers`
- [Console game](https://github.com/vickscarlet/liferestart/blob/main/apps/console/app.ts): `apps/console/app.ts`
- [Console entry](https://github.com/vickscarlet/liferestart/blob/main/apps/console/index.ts): `apps/console/index.ts`

### Web coordination

- [Play hooks](https://github.com/vickscarlet/liferestart/blob/main/packages/hooks/src/play.ts): `packages/hooks/src/play.ts`
- [Profile hooks](https://github.com/vickscarlet/liferestart/blob/main/packages/hooks/src/profile.ts): `packages/hooks/src/profile.ts`
- [Allocation hooks](https://github.com/vickscarlet/liferestart/blob/main/packages/hooks/src/alloc.ts): `packages/hooks/src/alloc.ts`
- [Talent hooks](https://github.com/vickscarlet/liferestart/blob/main/packages/hooks/src/talent.ts): `packages/hooks/src/talent.ts`
- [Achievement hooks](https://github.com/vickscarlet/liferestart/blob/main/packages/hooks/src/achievement.ts): `packages/hooks/src/achievement.ts`
- [Storage lifecycle](https://github.com/vickscarlet/liferestart/blob/main/apps/web/src/hooks/storage.ts): `apps/web/src/hooks/storage.ts`
- [Storage API](https://github.com/vickscarlet/liferestart/blob/main/apps/web/src/storage/index.ts): `apps/web/src/storage/index.ts`
- [Local storage](https://github.com/vickscarlet/liferestart/blob/main/apps/web/src/storage/local.ts): `apps/web/src/storage/local.ts`

### Game engine

- [Game core](https://github.com/vickscarlet/liferestart/blob/main/packages/core/src/game.ts): `packages/core/src/game.ts`
- [Game state](https://github.com/vickscarlet/liferestart/blob/main/packages/core/src/state.ts): `packages/core/src/state.ts`
- [Talent logic](https://github.com/vickscarlet/liferestart/blob/main/packages/core/src/talent.ts): `packages/core/src/talent.ts`
- [Achievement logic](https://github.com/vickscarlet/liferestart/blob/main/packages/core/src/achievement.ts): `packages/core/src/achievement.ts`
- [Event logic](https://github.com/vickscarlet/liferestart/blob/main/packages/core/src/event.ts): `packages/core/src/event.ts`

### Game content

- [Game content](https://github.com/vickscarlet/liferestart/tree/main/packages/data/src): `packages/data/src`
- [Condition parser](https://github.com/vickscarlet/liferestart/blob/main/packages/condition/index.ts): `packages/condition/index.ts`
- [Random utilities](https://github.com/vickscarlet/liferestart/blob/main/packages/vitex/index.ts): `packages/vitex/index.ts`

### Other components

- **Player**
- **Console user**

## Connections

- Player → Web entry: opens
- Web entry → Game shell: renders
- Game shell → Game stages: presents
- Game stages → Play hooks: uses
- Play hooks → Game core: starts, advances, summarizes, ends
- Play hooks → Profile hooks: reads profile
- Play hooks → Allocation hooks: reads allocation
- Play hooks → Talent hooks: resets talent state
- Play hooks → Game state: updates game state
- Storage lifecycle → Profile hooks: loads profile into
- Storage lifecycle → Storage API: initializes, reads, writes
- Storage API → Local storage
- Game core → Talent logic
- Game core → Achievement logic
- Game core → Event logic
- Talent logic → Game content: reads talents
- Talent logic → Condition parser: checks conditions
- Talent logic → Random utilities: selects randomly
- Console user → Console entry: runs
- Console entry → Console game: creates, initializes
