Worker service folder structure
NOTE each dir in src is an independent project
worker-service/ # repository root (solution-level: docs, tooling, build)
├─ README.md # how to run, configure, and deploy the service
├─ .gitignore # git ignore rules
├─ global.json # pin .NET SDK version for consistent builds
├─ worker-service.sln # solution file
├─ docs/ # architecture notes, runbooks, troubleshooting
├─ scripts/ # local dev scripts (run, clean, lint, etc.)
├─ tests/ # test projects live here (unit/integration)
│ ├─ WorkerService.UnitTests/ # fast tests for domain + orchestration logic
│ └─ WorkerService.IntegrationTests/ # slower tests that hit real deps (optional)
└─ src/ # all production code projects
├─ WorkerService.App/ # executable (host) project that starts the worker
│ ├─ Program.cs # host/bootstrap: config, DI wiring, logging
│ ├─ Worker.cs # BackgroundService/IHostedService entrypoint
│ ├─ appsettings.json # default config (non-secret)
│ ├─ appsettings.Development.json # dev overrides (non-secret)
│ └─ Properties/ # launchSettings etc (optional)
├─ WorkerService.Contracts/ # public contracts: DTOs, messages, interfaces (optional)
│ ├─ Options/ # shared option types if consumed by multiple projects
│ └─ Abstractions/ # interfaces used across boundaries (optional)
├─ WorkerService.Domain/ # pure business rules/types; no I/O, no framework deps
│ ├─ Models/ # core domain entities/value objects
│ ├─ Services/ # domain services (pure logic)
│ └─ Errors/ # domain errors/results types
├─ WorkerService.Application/ # orchestration/use-cases; coordinates domain + ports
│ ├─ Options/ # IOptions<T> POCOs used by application layer
│ ├─ UseCases/ # “handlers” / commands / jobs (what the worker runs)
│ ├─ Scheduling/ # job scheduling abstractions (timers/queues), if any
│ └─ Observability/ # logging/metrics conventions (event ids, scopes), optional
└─ WorkerService.Infrastructure/ # implementations of ports: IO, external services, persistence
├─ Options/ # IOptions<T> for infra concerns (client configs, endpoints)
├─ Clients/ # HTTP/gRPC clients, SDK wrappers, external providers
├─ Persistence/ # storage implementations (even if file-based)
└─ Hosting/ # host integration helpers (registrations/extensions)