Skip to main content

Project Structure

Asset360 v3 follows a consistent project structure.

Top-Level Structure

asset360v3/
├── src/ # React frontend
├── worker/ # Cloudflare Worker backend
├── shared/ # Shared utilities
├── test/ # Test files
├── migrations/ # Database migrations
└── docs/ # This documentation

Worker Structure

worker/
├── services/ # Domain services
│ ├── fund/
│ ├── investor/
│ ├── accounting/
│ └── ...
├── coordinator/ # Orchestrators
├── db/ # Database client and schema
└── trpc/ # TRPC routers and schemas

Domain Structure

Each domain follows this pattern:

worker/services/{domain}/
├── domain.ts # Types and entities
├── repository.ts # Data access
├── service.ts # Business logic
└── index.ts # Public API (barrel file) ⭐

The Barrel File Pattern

The index.ts file is the public API for each domain:

// worker/services/fund/index.ts
export type {
CreateFundRequest,
FundEntity,
FundFeesJson,
UpdateFundRequest,
} from "./domain";

export { FundService } from "./service";
export { FundRepository } from "./repository";

Key Points:

  • ✅ Other domains MUST import from the barrel file
  • ❌ Direct imports from domain.ts, service.ts, repository.ts are forbidden
  • 🔒 ESLint automatically enforces this rule
  • 📦 Keeps internal implementation details private

See DDD Approach and Domain Isolation for details.