Project Structure¶
A guided map of the dichit-backend repository. This focuses on the top-level layout; for the rationale behind the layer design see architecture/clean-architecture.md and development/folder-structure.md.
dichit-backend/
├── src/
│ ├── domain/ # entities + domain helpers (no IO)
│ ├── application/ # use cases, services, queue processors, contracts
│ ├── infrastructure/ # Prisma repos, config, auth, cache, queue, AWS, etc.
│ ├── interfaces/ # Fastify bootstrap, HTTP routes/controllers, websocket, webhooks
│ ├── shared/ # constants, errors, zod/swagger schemas, utilities
│ └── generated/prisma/ # generated Prisma client (don't edit)
├── prisma/
│ ├── schema.prisma
│ ├── migrations/
│ └── seeders/ # env-specific seeders (dev / staging)
├── tests/ # functional/API tests + shared helpers
├── docs/ # <-- you are here: documentation
├── docker/ # Docker context / auxiliary images
├── dockerfiles/ # Dockerfiles
├── traefik/ # reverse-proxy config (cf. AWS)
├── infra/ # IaC
├── backups/ # local/dev db dumps
├── benchmarks/ # perf benchmarks
├── scripts/ # repo automation
└── package.json # scripts, deps, lint-staged
src/ layers¶
| Layer | Path(s) | Role |
|---|---|---|
| Domain | src/domain | Entities and domain helpers; zero infrastructure imports |
| Application | src/application | Use cases, services, queue processors, dependency contracts (interfaces/) |
| Infrastructure | src/infrastructure | Framework/provider integrations, repositories, config, auth, queue, cache |
| Interfaces | src/interfaces | Composition root, Fastify app, HTTP routes/controllers, WS, webhooks, shutdown |
| Shared | src/shared | Cross-cutting constants, Zod schemas, errors, swagger schemas, utils |
Inside src/interfaces¶
server.ts— process entry point: loads env, builds Fastify, listens.app.ts— composition root: Awilix DI, autoloaded plugins, versioned routes, WS.init.ts— env + Sentry bootstrap.http/routes/— platform, v1, v2, v3, common, and admin route scopes.http/webhooks/—pg/zwitch,sentry,whatsappwebhook receivers.websocket/— WS router, handlers, middleware, schemas, connection lifecycle.
Inside prisma¶
schema.prisma— the single source of truth for the data model.migrations/— SQL migrations (see database/migrations.md).seeders/—dev/andstaging/seed scripts withup/down.
Aliases (tsconfig.json)¶
Use these path aliases in imports — never relative paths that walk across layers. See development/dependency-injection.md.