How neckerfree/employee-directory-demo works
This is a Clean Architecture employee-directory CRUD application: users manage departments and employees, with employee search/listing and department assignment, through a React SPA and ASP.NET API backed by PostgreSQL. The main runtime flow crosses the UI, API controllers, application use cases, repository/unit-of-work ports, and EF Core persistence; domain entities enforce core invariants. The README documents the broader stack, while the shown source provides stronger relationship evidence for the CRUD and persistence layers than for every UI-to-API detail.
Main entry points: Employees Employee use cases · AppDbContext.cs EF Core context · Departments Department use cases · apiSlice.ts API client
Components 22
React directory UI
- SPA routes
src/web/src/App.tsx - Employee pages
src/web/src/pages/EmployeeDirectoryPage.tsx - Department page
src/web/src/pages/DepartmentsPage.tsx - API client
src/web/src/api/apiSlice.ts
HTTP API
- Employee endpoints
src/EmployeeDirectory.Api/Controllers/EmployeesController.cs - Department endpoints
src/EmployeeDirectory.Api/Controllers/DepartmentsController.cs - Request middleware
src/EmployeeDirectory.Api/Middleware/CorrelationIdMiddleware.cs - API composition
src/EmployeeDirectory.Api/Program.cs
Application use cases
- Employee use cases
src/EmployeeDirectory.Application/Employees - Department use cases
src/EmployeeDirectory.Application/Departments - Employee repository port
src/EmployeeDirectory.Application/Employees/IEmployeeRepository.cs - Department repository port
src/EmployeeDirectory.Application/Departments/IDepartmentRepository.cs - Commit port
src/EmployeeDirectory.Application/Common/IUnitOfWork.cs
Domain model
- Employee aggregate
src/EmployeeDirectory.Domain/Entities/Employee.cs - Department entity
src/EmployeeDirectory.Domain/Entities/Department.cs
EF persistence
- Employee repository
src/EmployeeDirectory.Infrastructure/Repositories/EmployeeRepository.cs - Department repository
src/EmployeeDirectory.Infrastructure/Repositories/DepartmentRepository.cs - EF Core context
src/EmployeeDirectory.Infrastructure/Persistence/AppDbContext.cs - Unit of work
src/EmployeeDirectory.Infrastructure/Persistence/UnitOfWork.cs - Database health
src/EmployeeDirectory.Infrastructure/Persistence/DatabaseHealthCheck.cs
Other components
- Directory user
- PostgreSQL
Connections 23
- Directory user → SPA routes: uses
- SPA routes → Employee pages: routes to
src/web/src/App.tsx - SPA routes → Department page: routes to
src/web/src/App.tsx - Employee pages → API client: requests data
- Department page → API client: requests data
- API client → Employee endpoints: calls API
README.md - API client → Department endpoints: calls API
README.md - Employee endpoints → Employee use cases: dispatches
src/EmployeeDirectory.Api/Controllers/EmployeesController.cs - Department endpoints → Department use cases: dispatches
src/EmployeeDirectory.Api/Controllers/DepartmentsController.cs - API composition → Request middleware: configures
src/EmployeeDirectory.Api/Program.cs - Employee use cases → Employee repository port: queries and mutates
src/EmployeeDirectory.Application/Employees/CreateEmployeeHandler.cs - Employee use cases → Department repository port: checks department
src/EmployeeDirectory.Application/Employees/CreateEmployeeHandler.cs - Employee use cases → Commit port: commits changes
src/EmployeeDirectory.Application/Employees/CreateEmployeeHandler.cs - Employee use cases → Employee aggregate: creates and updates
src/EmployeeDirectory.Application/Employees/CreateEmployeeHandler.cs - Employee use cases → Department entity: checks membership
src/EmployeeDirectory.Application/Employees/CreateEmployeeHandler.cs - Department use cases → Department repository port: queries and mutates
src/EmployeeDirectory.Application/Departments/DeleteDepartmentHandler.cs - Department use cases → Employee repository port: checks assignments
src/EmployeeDirectory.Application/Departments/DeleteDepartmentHandler.cs - Department use cases → Commit port: commits changes
src/EmployeeDirectory.Application/Departments/DeleteDepartmentHandler.cs - Employee repository → EF Core context: uses EF context
src/EmployeeDirectory.Infrastructure/Repositories/EmployeeRepository.cs - Department repository → EF Core context: uses EF context
src/EmployeeDirectory.Infrastructure/Repositories/DepartmentRepository.cs - Unit of work → EF Core context: commits through
- Database health → EF Core context: checks database
src/EmployeeDirectory.Infrastructure/Persistence/DatabaseHealthCheck.cs - EF Core context → PostgreSQL: persists data
README.md