Initial commit

This commit is contained in:
ada
2026-05-25 05:47:28 +00:00
commit 4d6495ffda
97 changed files with 13403 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
# Domain Interfaces
**Content**: Service Contracts (Ports).
## Rules
1. **Definition**: Define the capability using `Context.Tag`.
2. **No Implementation**: Do not include implementation details (SQL, HTTP calls) here.
3. **Naming**: Use names describing the *capability*, not the tool (e.g., `PaymentRepo`, not `StripeClient`).
## Example
```typescript
import { Context, Effect } from "effect"
export class PaymentRepo extends Context.Tag("PaymentRepo")<
PaymentRepo,
{
readonly charge: (amount: number) => Effect.Effect<void, PaymentError>
}
>() {}
```
+20
View File
@@ -0,0 +1,20 @@
# Domain Models
**Content**: Data Schemas (Types) and Pure Logic.
## Rules
1. **Co-location**: Define the Schema and the pure functions that operate on it in the same file.
2. **Purity**: Functions here must be 100% pure. No side effects.
3. **Scope**: Functions here should primarily operate on the entity defined in the file.
## Example (`Cart.ts`)
```typescript
import { Schema } from "@effect/schema"
export const Cart = Schema.Struct({ ... })
export type Cart = Schema.Schema.Type<typeof Cart>
// Pure Logic
export const isEmpty = (cart: Cart): boolean => cart.items.length === 0
```