This Employee Management System is a full-stack application built with a .NET 8 API backend and an Angular frontend. It provides CRUD (Create, Read, Update, Delete) operations for managing employee data.
The project is divided into two main parts:
EmployeeManagementAPI/
├── CQRS
│ ├── Commands
│ │ └── CreateEmployeeCommand.cs
│ └── Handlers
│ └── CreateEmployeeHandler.cs
├── Controllers/
│ └── EmployeesController.cs
├── Models/
│ └── Employee.cs
├── Data/
│ └── EmployeeDbContext.cs
├── Properties
│ └── launchSettings.json
├── appsettings.json
└── Program.cs
employee-management-system/
├── src/
│ ├── app/
│ │ ├── components/
│ │ │ ├── employee-list/
│ │ │ ├── employee-detail/
│ │ │ └── employee-form/
│ │ ├── services/
│ │ │ └── employee.service.ts
│ │ ├── models/
│ │ │ └── employee.model.ts
│ │ ├── app.component.ts
│ │ ├── app.component.html
│ │ ├── app.component.css
│ │ └── app.routes.ts
│ ├── index.html
│ ├── main.server.ts
│ ├── main.ts
│ └── styles.css
├── angular.json
├── package.json
└── tsconfig.json
- Backend:
- .NET 8
- Entity Framework Core
- SQLite Database
- Frontend:
- Angular 15+
- TypeScript
- RxJS
-
Standalone Components: We used Angular's standalone components to reduce the need for NgModules and simplify the application structure.
-
Service-based Architecture: The EmployeeService acts as an intermediary between the components and the API, promoting separation of concerns.
-
Reactive Programming: We utilized RxJS Observables for handling asynchronous operations, making the code more maintainable and easier to reason about.
-
Routing: Angular Router was implemented to create a single-page application experience, allowing for seamless navigation between views.
-
REST API: The backend follows RESTful principles, providing a clear and consistent interface for CRUD operations.
-
HttpClient Injection: Initially, we faced issues with injecting the HttpClient into our services and components. This was resolved by properly providing the HttpClientModule in the AppComponent and using provideHttpClient() in the main.ts file.
-
Standalone Components Setup: Transitioning to standalone components required careful management of imports and providers, which was a learning curve but ultimately led to a more streamlined application structure.
-
Cross-Origin Resource Sharing (CORS): Ensuring proper CORS configuration on the backend to allow requests from the Angular frontend.
- Clone the repository
- Backend Setup:
- Navigate to the EmployeeManagementAPI directory
- Run
dotnet restore
- Run
dotnet run
- Frontend Setup:
- Navigate to the employee-management-system directory
- Run
npm install
- Run
ng serve
Once both the backend and frontend are running, navigate to http://localhost:4200
in your web browser. From there, you can:
- View the list of employees
- Add a new employee
- Edit existing employee details
- Delete an employee
- GET /api/employees - Retrieve all employees
- GET /api/employees/{id} - Retrieve a specific employee
- POST /api/employees - Create a new employee
- PUT /api/employees/{id} - Update an existing employee
- DELETE /api/employees/{id} - Delete an employee
- Implement authentication and authorization
- Add pagination for the employee list
- Implement sorting and filtering options
- Add unit and integration tests
- Improve error handling and user feedback
- Enhance the UI/UX design