# academind/you-must-use-effect architecture

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

- Interactive diagram: https://gitdiagram.com/academind/you-must-use-effect
- Repository: https://github.com/academind/you-must-use-effect

## Overview

This repository is a set of standalone TypeScript demos teaching the Effect library, not an application with one end-to-end business workflow. The principal workflow is an engineer running an individual snippet and observing how Effect models a value, failure, dependency, or runtime capability. The snippets cover error handling, service construction, concurrency, queues, rate limiting, schemas, and configuration. The README and filenames support these capability branches; sampled source confirms only some implementations and their wiring. The README’s resource-safety entry does not match the supplied tree, so it is omitted.

Main entry points: [`src/lib/fake-clients.ts`](https://github.com/academind/you-must-use-effect/blob/main/src/lib/fake-clients.ts) (Fake clients), [`src/01b-typed-errors-with-effect.ts`](https://github.com/academind/you-must-use-effect/blob/main/src/01b-typed-errors-with-effect.ts) (Typed errors), [`src/02-handling-errors.ts`](https://github.com/academind/you-must-use-effect/blob/main/src/02-handling-errors.ts) (Error handling), [`src/12b-structured-concurrency-with-effect.ts`](https://github.com/academind/you-must-use-effect/blob/main/src/12b-structured-concurrency-with-effect.ts) (Structured concurrency)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_foundations["Effects and errors"]
  node_lazy["Lazy effects"]
  node_plain_errors["Promise errors"]
  node_typed_errors["Typed errors"]
  node_error_handling["Error handling"]
  node_defects["Defects"]
end

subgraph group_dependencies["Services and layers"]
  node_services["Services<br/>[04-services.ts]"]
  node_layers["Dependency layers<br/>[05-layers.ts]"]
end

subgraph group_runtime["Runtime capabilities"]
  node_retry_timeout["Retry and timeout"]
  node_concurrency["Concurrency<br/>[07-concurrency.ts]"]
  node_queue["Back-pressure queue<br/>[08-queue.ts]"]
  node_rate_limiter["Rate limiting<br/>[09-rate-limiter.ts]"]
  node_schema["Schema validation<br/>[10-schema.ts]"]
  node_config["Typed configuration<br/>[11-config.ts]"]
  node_promise_concurrency["Promise concurrency"]
  node_effect_concurrency["Structured concurrency"]
  node_language_service["Effect diagnostics"]
end

subgraph group_support["Demo support"]
  node_fake_clients["Fake clients<br/>[fake-clients.ts]"]
end

node_engineer(("Engineer"))

node_engineer -->|"runs"| node_lazy
node_engineer -->|"runs"| node_plain_errors
node_engineer -->|"runs"| node_typed_errors
node_engineer -->|"runs"| node_error_handling
node_engineer -->|"runs"| node_defects
node_engineer -->|"runs"| node_services
node_engineer -->|"runs"| node_layers
node_engineer -->|"runs"| node_retry_timeout
node_engineer -->|"runs"| node_concurrency
node_engineer -->|"runs"| node_queue
node_engineer -->|"runs"| node_rate_limiter
node_engineer -->|"runs"| node_schema
node_engineer -->|"runs"| node_config
node_engineer -->|"runs"| node_promise_concurrency
node_engineer -->|"runs"| node_effect_concurrency
node_engineer -->|"runs"| node_language_service
node_typed_errors -->|"calls database"| node_fake_clients
node_error_handling -->|"calls database"| node_fake_clients
node_effect_concurrency -->|"calls moderation and storage"| node_fake_clients

click node_lazy "https://github.com/academind/you-must-use-effect/blob/main/src/00-effect-is-a-value.ts"
click node_plain_errors "https://github.com/academind/you-must-use-effect/blob/main/src/01a-typed-errors-without-effect.ts"
click node_typed_errors "https://github.com/academind/you-must-use-effect/blob/main/src/01b-typed-errors-with-effect.ts"
click node_error_handling "https://github.com/academind/you-must-use-effect/blob/main/src/02-handling-errors.ts"
click node_defects "https://github.com/academind/you-must-use-effect/blob/main/src/03-errors-vs-defects.ts"
click node_services "https://github.com/academind/you-must-use-effect/blob/main/src/04-services.ts"
click node_layers "https://github.com/academind/you-must-use-effect/blob/main/src/05-layers.ts"
click node_retry_timeout "https://github.com/academind/you-must-use-effect/blob/main/src/06-retry-and-timeout.ts"
click node_concurrency "https://github.com/academind/you-must-use-effect/blob/main/src/07-concurrency.ts"
click node_queue "https://github.com/academind/you-must-use-effect/blob/main/src/08-queue.ts"
click node_rate_limiter "https://github.com/academind/you-must-use-effect/blob/main/src/09-rate-limiter.ts"
click node_schema "https://github.com/academind/you-must-use-effect/blob/main/src/10-schema.ts"
click node_config "https://github.com/academind/you-must-use-effect/blob/main/src/11-config.ts"
click node_promise_concurrency "https://github.com/academind/you-must-use-effect/blob/main/src/12a-structured-concurrency-without-effect.ts"
click node_effect_concurrency "https://github.com/academind/you-must-use-effect/blob/main/src/12b-structured-concurrency-with-effect.ts"
click node_language_service "https://github.com/academind/you-must-use-effect/blob/main/src/13-effect-language-service.ts"
click node_fake_clients "https://github.com/academind/you-must-use-effect/blob/main/src/lib/fake-clients.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_lazy,node_plain_errors,node_typed_errors,node_error_handling,node_defects toneBlue
class node_services,node_layers toneAmber
class node_retry_timeout,node_concurrency,node_queue,node_rate_limiter,node_schema,node_config,node_promise_concurrency,node_effect_concurrency,node_language_service toneMint
class node_fake_clients toneRose
class node_engineer toneIndigo
```

## Components

### Effects and errors

- [Lazy effects](https://github.com/academind/you-must-use-effect/blob/main/src/00-effect-is-a-value.ts): `src/00-effect-is-a-value.ts`
- [Promise errors](https://github.com/academind/you-must-use-effect/blob/main/src/01a-typed-errors-without-effect.ts): `src/01a-typed-errors-without-effect.ts`
- [Typed errors](https://github.com/academind/you-must-use-effect/blob/main/src/01b-typed-errors-with-effect.ts): `src/01b-typed-errors-with-effect.ts`
- [Error handling](https://github.com/academind/you-must-use-effect/blob/main/src/02-handling-errors.ts): `src/02-handling-errors.ts`
- [Defects](https://github.com/academind/you-must-use-effect/blob/main/src/03-errors-vs-defects.ts): `src/03-errors-vs-defects.ts`

### Services and layers

- [Services](https://github.com/academind/you-must-use-effect/blob/main/src/04-services.ts): `src/04-services.ts`
- [Dependency layers](https://github.com/academind/you-must-use-effect/blob/main/src/05-layers.ts): `src/05-layers.ts`

### Runtime capabilities

- [Retry and timeout](https://github.com/academind/you-must-use-effect/blob/main/src/06-retry-and-timeout.ts): `src/06-retry-and-timeout.ts`
- [Concurrency](https://github.com/academind/you-must-use-effect/blob/main/src/07-concurrency.ts): `src/07-concurrency.ts`
- [Back-pressure queue](https://github.com/academind/you-must-use-effect/blob/main/src/08-queue.ts): `src/08-queue.ts`
- [Rate limiting](https://github.com/academind/you-must-use-effect/blob/main/src/09-rate-limiter.ts): `src/09-rate-limiter.ts`
- [Schema validation](https://github.com/academind/you-must-use-effect/blob/main/src/10-schema.ts): `src/10-schema.ts`
- [Typed configuration](https://github.com/academind/you-must-use-effect/blob/main/src/11-config.ts): `src/11-config.ts`
- [Promise concurrency](https://github.com/academind/you-must-use-effect/blob/main/src/12a-structured-concurrency-without-effect.ts): `src/12a-structured-concurrency-without-effect.ts`
- [Structured concurrency](https://github.com/academind/you-must-use-effect/blob/main/src/12b-structured-concurrency-with-effect.ts): `src/12b-structured-concurrency-with-effect.ts`
- [Effect diagnostics](https://github.com/academind/you-must-use-effect/blob/main/src/13-effect-language-service.ts): `src/13-effect-language-service.ts`

### Demo support

- [Fake clients](https://github.com/academind/you-must-use-effect/blob/main/src/lib/fake-clients.ts): `src/lib/fake-clients.ts`

### Other components

- **Engineer**

## Connections

- Engineer → Lazy effects: runs
- Engineer → Promise errors: runs
- Engineer → Typed errors: runs
- Engineer → Error handling: runs
- Engineer → Defects: runs
- Engineer → Services: runs
- Engineer → Dependency layers: runs
- Engineer → Retry and timeout: runs
- Engineer → Concurrency: runs
- Engineer → Back-pressure queue: runs
- Engineer → Rate limiting: runs
- Engineer → Schema validation: runs
- Engineer → Typed configuration: runs
- Engineer → Promise concurrency: runs
- Engineer → Structured concurrency: runs
- Engineer → Effect diagnostics: runs
- Typed errors → Fake clients: calls database
- Error handling → Fake clients: calls database
- Structured concurrency → Fake clients: calls moderation and storage
