A robust and modern Contact Management API built with ASP.NET Core 8.0, featuring secure authentication, Redis caching, and PostgreSQL database integration.
-
Authentication & Authorization
- JWT-based authentication
- Secure password hashing with BCrypt
- Role-based access control
-
Database & Caching
- PostgreSQL database integration
- Redis caching for improved performance
- Entity Framework Core for data access
-
API Features
- RESTful API design
- Swagger/OpenAPI documentation
- AutoMapper for object mapping
- Comprehensive DTOs for data transfer
- ASP.NET Core 8.0
- Entity Framework Core 8.0
- PostgreSQL
- Redis
- JWT Authentication
- Swagger/OpenAPI
- Docker support
- WebSockets
- .NET 8.0 SDK
- PostgreSQL
- Redis
- Docker (optional)
-
Clone the repository
git clone [your-repository-url] cd CMAPI -
Configure the database
- Update the connection string in
appsettings.jsonwith your PostgreSQL credentials - Update the Redis connection string if needed
- Update the connection string in
-
Run database migrations
dotnet ef database update
-
Run the application
dotnet run
Or using Docker:
docker build -t cmapi . docker run -p 5000:80 cmapi -
Access the API
- API will be available at
https://localhost:5001 - Swagger documentation at
https://localhost:5001/swagger
- API will be available at
To create a new migration:
dotnet ef migrations add [MigrationName]To apply migrations:
dotnet ef database updateTo remove the last migration:
dotnet ef migrations removeCMAPI/
├── Controllers/ # API endpoints
├── Models/ # Database models
├── DTO/ # Data transfer objects
├── Services/ # Business logic
├── Data/ # Database context and configurations
├── Middleware/ # Custom middleware components
├── Helper/ # Utility classes
└── Migrations/ # Database migrations
The following environment variables can be configured in appsettings.json:
- Database connection string
- Redis connection string
- JWT secret key
- API configuration settings
The API documentation is available through Swagger UI when running the application. Access it at:
https://localhost:5001/swagger
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.