Skip to content

Module Template

Use this template when adding a new module/feature area (a cohesive slice like auctions, programs, challenges) that spans entities, use cases, routes, and docs.

# <Module> Module

## Overview

One paragraph: what this module does in the Dichit domain.

## Scope

| Concern | In scope | Out of scope |
| ------- | -------- | ------------ |

## Components

| Component       | Path                                        | Responsibility                |
| --------------- | ------------------------------------------- | ----------------------------- |
| Domain entities | `src/domain/entities/<module>/`             | shapes + invariants           |
| Use cases       | `src/application/use-cases/<module>/`       | orchestration                 |
| Contracts       | `src/application/interfaces/…`              | repository/service interfaces |
| Routes          | `src/interfaces/http/routes/v<N>/<module>/` | HTTP surface                  |
| WebSocket       | `src/interfaces/websocket/…`                | real-time events (if any)     |
| Infrastructure  | `src/infrastructure/…`                      | implementations               |
| Tests           | `src/**/*.test.ts`, `tests/**`              | unit + functional             |
| Docs            | `docs/api/rest/<module>.md`                 | documentation                 |

## Data model

List new/changed Prisma models and enums. See
[../database/schema.md](../database/schema.md).

```mermaid
erDiagram
    PARENT ||--o{ CHILD : has
```

Boundaries & invariants

  • Key business rules the module enforces.
  • What must never happen (e.g. overbid, double-payout, publish-before-commit).

Integration points

Testing strategy

---

## Rules

- Follow the existing feature pattern — copy a neighboring module's layout.
- New Prisma models → matching domain entities (see
  [../development/folder-structure.md](../development/folder-structure.md)).
- Keep the smallest coherent slice; don't expand scope.

## Checklist

- [ ] Entities, use cases, contracts, routes, infra all mapped
- [ ] Data model + migration covered
- [ ] Boundaries documented
- [ ] Docs updated for the module
- [ ] Tests referenced/added