A modern, scalable ASP.NET Core Web API project demonstrating clean architecture principles and best practices for building production-grade REST APIs.
Responsive API is a comprehensive project management system built with ASP.NET Core 8.0, featuring a well-organized architecture with clear separation of concerns.
ResponsiveAPI/
├── Controllers/ # API endpoint controllers
│ ├── UsersController
│ ├── ProjectsController
│ └── TasksController
├── Models/ # Data models and DTOs
│ ├── User.cs
│ ├── Project.cs
│ ├── Task.cs
│ └── DTOs/
├── Services/ # Business logic layer
│ ├── UserService
│ ├── ProjectService
│ └── TaskService
├── Repositories/ # Data access layer
│ ├── UserRepository
│ ├── ProjectRepository
│ └── TaskRepository
├── Interfaces/ # Interface definitions
│ ├── IUserService
│ ├── IProjectService
│ ├── IUserRepository
│ └── More...
├── Data/ # Database context
│ └── ApplicationDbContext
├── Middleware/ # Custom middleware
│ ├── ErrorHandlingMiddleware
│ └── LoggingMiddleware
├── Configurations/ # AutoMapper profiles
├── Extensions/ # Service extensions
├── Utils/ # Utility helpers
└── Program.cs # Application entry point
- RESTful API Endpoints for Users, Projects, and Tasks
- Entity Framework Core for data access with SQL Server
- Dependency Injection for loose coupling
- AutoMapper for object mapping
- Swagger/OpenAPI documentation
- Error Handling Middleware for consistent error responses
- Logging Middleware for request/response tracking
- Repository Pattern for clean data access
- Service Layer for business logic
- CORS support for cross-origin requests
GET /api/users- Get all usersGET /api/users/{id}- Get user by IDPOST /api/users- Create new userPUT /api/users/{id}- Update userDELETE /api/users/{id}- Delete user
GET /api/projects- Get all projectsGET /api/projects/{id}- Get project by IDGET /api/projects/user/{userId}- Get projects by userPOST /api/projects- Create new projectPUT /api/projects/{id}- Update projectDELETE /api/projects/{id}- Delete project
GET /api/tasks- Get all tasksGET /api/tasks/{id}- Get task by IDGET /api/tasks/project/{projectId}- Get tasks by projectGET /api/tasks/user/{userId}- Get tasks by userPOST /api/tasks- Create new taskPUT /api/tasks/{id}- Update taskDELETE /api/tasks/{id}- Delete task
- .NET 8.0
- ASP.NET Core Web API
- Entity Framework Core
- AutoMapper
- Swagger/OpenAPI
- SQL Server
- .NET 8.0 SDK or later
- SQL Server or SQL Server Express
- Visual Studio or VS Code
- Clone the repository
- Update connection string in
appsettings.json - Run migrations:
dotnet ef database update - Run the application:
dotnet run
The project uses Entity Framework Core with SQL Server. The default connection string is:
Server=.;Database=ResponsiveAPI;Trusted_Connection=true;TrustServerCertificate=true;
This project follows clean architecture principles:
- Controllers: Handle HTTP requests and responses
- Services: Implement business logic
- Repositories: Manage data access
- Models: Define domain entities and DTOs
- Interfaces: Define contracts for services and repositories
Contains configuration for:
- Database connection strings
- Logging levels
- API settings
Development-specific settings with detailed error logging.
POST /api/users Content-Type: application/json { "firstName": "John", "lastName": "Doe", "email": "john@example.com", "phoneNumber": "+1234567890" }
POST /api/projects?userId=1 Content-Type: application/json { "title": "My Project", "description": "Project description", "startDate": "2024年03月27日", "endDate": "2024年12月31日" }
dotnet build
dotnet testdotnet run
The API will be available at https://localhost:5001 and Swagger UI at https://localhost:5001/ (in Development mode).
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Responsive API Team
For support, please open an issue in the repository.