a045281f76
Build / build (push) Failing after 6m27s
Replace the empty flat docs with the Media Farm shelf layout: vision, philosophy, language, architecture (including packages, RecipeProvider, and Create Goal), player day, and prototype freezes. The NeoForge example code is still not the architecture.
233 lines
5.8 KiB
Markdown
233 lines
5.8 KiB
Markdown
# 🏛️ Architecture
|
||
|
||
This is a living scaffold. It will change as we iterate.
|
||
|
||
Language lives in [[🗣️ Ubiquitous Language]]. This document describes how that domain is structured in code.
|
||
|
||
Satistaskory is designed with Domain-Driven Design.
|
||
|
||
---
|
||
|
||
## 📜 Golden Rule
|
||
|
||
The Domain Layer must not know about EMI, JEI, REI, NeoForge APIs, UI frameworks, or save formats.
|
||
|
||
Infrastructure serves the domain. Never the other way around.
|
||
|
||
Goals are the domain. Recipes are implementation details.
|
||
|
||
---
|
||
|
||
## Core domain chain
|
||
|
||
```text
|
||
Goal
|
||
↓
|
||
Recipe Resolution
|
||
↓
|
||
Material Requirements
|
||
↓
|
||
Material Aggregation
|
||
↓
|
||
Inventory State (available quantities)
|
||
↓
|
||
Missing Materials / Ready To Craft
|
||
↓
|
||
Completed Goal
|
||
```
|
||
|
||
---
|
||
|
||
## Layers
|
||
|
||
Dependencies point inward. The domain does not depend on infrastructure.
|
||
|
||
```text
|
||
+--------------------------+
|
||
| UI Layer |
|
||
+--------------------------+
|
||
|
|
||
v
|
||
+--------------------------+
|
||
| Application Layer |
|
||
+--------------------------+
|
||
|
|
||
v
|
||
+--------------------------+
|
||
| Domain Layer | <-----+
|
||
+--------------------------+ |
|
||
|
|
||
+--------------------------+
|
||
| Infrastructure Layer |
|
||
+--------------------------+
|
||
```
|
||
|
||
The UI and application layers call the domain.
|
||
|
||
Infrastructure implements interfaces defined by the domain (and used by the application). It is not below the domain in a dependency sense; it sits outside and plugs in.
|
||
|
||
---
|
||
|
||
## Domain
|
||
|
||
This layer contains the actual business logic.
|
||
|
||
Primary objects:
|
||
|
||
- `Goal` — [[🎯 Goal]]
|
||
- `MaterialRequirement` — [[🧱 Material Requirement]]
|
||
- `ProgressState` — [[📉 Missing Material]], [[🛠️ Ready To Craft]]
|
||
|
||
`Project` and [[✅ Completed Goal]] exist in the language. They are not packaged in the first slice. See [[📦 Packages]].
|
||
|
||
`InventoryState` is a value the domain consumes (available quantities). How that snapshot is collected is infrastructure. See [[🎒 Inventory State]].
|
||
|
||
Domain services:
|
||
|
||
- [[🧾 Recipe Resolution]] — goal → material requirements
|
||
- [[➕ Material Aggregation]] — active goals → aggregated list
|
||
- [[📈 Progress Calculation]] — missing, ready-to-craft, completion
|
||
|
||
Recipe resolution uses a `RecipeProvider` port. It does not call a recipe mod.
|
||
|
||
---
|
||
|
||
## Application
|
||
|
||
Coordinates use cases.
|
||
|
||
First use case: [[▶️ Create Goal]].
|
||
|
||
Same slice: Adjust Goal Quantity, Remove Goal, Clear Goals, Refresh Progress.
|
||
|
||
Mark Goal Complete is named. It is not in the first slice.
|
||
|
||
The application layer calls infrastructure through ports (`RecipeProvider`, inventory snapshot). It does not contain domain rules. It loads what the use case needs, asks the domain to decide, and presents the result. Persistence is in-memory for this slice.
|
||
|
||
Packages: [[📦 Packages]].
|
||
|
||
---
|
||
|
||
## Infrastructure
|
||
|
||
Infrastructure exists to satisfy domain requirements.
|
||
|
||
Infrastructure may be replaced.
|
||
|
||
Examples:
|
||
|
||
- NeoForge
|
||
- EMI
|
||
- JEI
|
||
- REI
|
||
- Save data storage
|
||
- Inventory scanning
|
||
|
||
Infrastructure is never the source of domain truth.
|
||
|
||
---
|
||
|
||
## Recipe abstraction
|
||
|
||
The domain should never directly depend on a recipe mod.
|
||
|
||
Port: [[🔌 Recipe Provider]] — `resolve(ItemId, quantity) → list of MaterialRequirement`.
|
||
|
||
First implementation: `StubRecipeProvider`. Later: EMI, JEI, REI, vanilla.
|
||
|
||
The rest of the system should not care which provider is active.
|
||
|
||
Recipe viewing is out of scope. This port exists so the domain can resolve requirements, not so Satistaskory can become a recipe browser.
|
||
|
||
---
|
||
|
||
## Persistence abstraction
|
||
|
||
The domain should not know where data is stored.
|
||
|
||
Possible implementations:
|
||
|
||
- World Save
|
||
- Server Save
|
||
- Future Cloud Sync
|
||
|
||
First slice: in-memory. No save adapter yet.
|
||
|
||
---
|
||
|
||
## Inventory abstraction
|
||
|
||
The domain should not know how inventory is read.
|
||
|
||
It receives available quantities (`InventoryState`).
|
||
|
||
How those quantities are gathered (player inventory, ender chest, later storage integrations) is infrastructure and may change without a domain rewrite.
|
||
|
||
First slice: player inventory only.
|
||
|
||
---
|
||
|
||
## UI philosophy
|
||
|
||
The UI should be replaceable. It renders domain information. It does not contain domain logic.
|
||
|
||
Discovered consumers (see [[🖥️ Experience]]):
|
||
|
||
- **Capture** — in-place on inventory, crafting bench craft pane, and craft book. Hover → `+ Add to Crafting Goals`. We do not own those views.
|
||
- **Living** — play overlay panel on the **right** of the play screen (not a pause menu). Two regions: [[🎯 Goal|goals]] with quantity `[+]` / `[-]`, then aggregated materials still needed (one row per material, with a count). `X Clear Items` clears the goal list. See [[🖼️ Wireframes]] Screen 2.
|
||
|
||
Not discovered:
|
||
|
||
- Full-screen planner
|
||
- Row selection / per-goal filter of the missing list
|
||
|
||
Progressive disclosure is a UI concern guided by the domain: the materials region defaults to missing materials; expand into per-goal breakdowns, recipe trees, and dependency chains only on demand. Those expansions are not this panel’s first drawing.
|
||
|
||
---
|
||
|
||
## Architectural rules
|
||
|
||
1. Goals are the domain.
|
||
2. Recipes are infrastructure.
|
||
3. UI is infrastructure.
|
||
4. Storage is infrastructure.
|
||
5. Integrations are infrastructure.
|
||
6. The domain layer must not depend on infrastructure.
|
||
7. Infrastructure may depend on the domain.
|
||
|
||
---
|
||
|
||
## Success criteria
|
||
|
||
If EMI, JEI, REI, or another recipe mod disappears tomorrow, Satistaskory should require only an adapter replacement and not a domain rewrite.
|
||
|
||
The domain model should survive infrastructure changes.
|
||
|
||
See [[🎯 Success Metrics]].
|
||
|
||
---
|
||
|
||
## Related Documents
|
||
|
||
[[🧠 Philosophy]]
|
||
|
||
[[📦 Bounded Contexts]]
|
||
|
||
[[📝 Decisions]]
|
||
|
||
[[🗣️ Ubiquitous Language]]
|
||
|
||
[[🧾 Recipe Resolution]]
|
||
|
||
[[🖥️ Experience]]
|
||
|
||
[[🚶 Day in the Life]]
|
||
|
||
[[🖼️ Wireframes]]
|
||
|
||
[[📦 Packages]]
|
||
|
||
[[🔌 Recipe Provider]]
|
||
|
||
[[▶️ Create Goal]]
|