A robust REST API built with .NET Core for managing distributors and packages. This API provides a scalable and maintainable solution for distribution management systems.
Note: This is a completed project that served as a demonstration of clean architecture and best practices in .NET Core development. While the code is available for reference and learning purposes, it is no longer actively maintained.
- Clean Architecture implementation
- Docker containerization support
- Heroku deployment ready
- Centralized exception handling
- Database migrations
- Controller/Services/Repositories
- RESTful API design
- Environment-based configuration
- .NET Core 2.1.12
- Entity Framework Core 2.1.11
- Docker 19.03
- Heroku
- SQL Server
- Swagger/OpenAPI 4.0.7
- AutoMapper 7.0.1
- JWT Authentication
- .NET Core SDK 2.1.12 or later
- Docker 19.03 (optional)
- SQL Server (recommended) or any Entity Framework Core compatible database
- Git 2.23.0 or later
- Clone the repository:
git clone [REPOSITORY_URL]- Navigate to the project directory:
cd distripack-api- Copy the example configuration file:
cp appsettings.example.json appsettings.Development.json- Configure your database connection string in
appsettings.Development.json:
{
"ConnectionStrings": {
"DefaultConnection": "Server=your_server;Database=distripack;Trusted_Connection=True;MultipleActiveResultSets=true"
}
}- Restore dependencies:
dotnet restore- Run database migrations:
dotnet ef database update- Run the project:
dotnet runThe following environment variables are required:
ASPNETCORE_ENVIRONMENT: Set to "Development" for local developmentConnectionStrings__DefaultConnection: Database connection stringJWT__Secret: Secret key for JWT token generationJWT__Issuer: JWT token issuerJWT__Audience: JWT token audienceJWT__ExpirationInMinutes: Token expiration time in minutes
Here are some example API calls:
# Get all clients
curl -X GET https://localhost:5001/api/clients
# Get client by ID
curl -X GET https://localhost:5001/api/clients/1
# Create new client
curl -X POST https://localhost:5001/api/clients \
-H "Content-Type: application/json" \
-d '{"name": "John Doe", "email": "john@example.com"}'
# Get client transactions
curl -X GET https://localhost:5001/api/transactions/1Build and run the application using Docker:
# Build the image
docker build -t distripack-api .
# Run the container
docker run -p 5000:80 -e ASPNETCORE_ENVIRONMENT=Development distripack-apiThe project is configured for Heroku deployment. Before deploying:
- Create a Heroku account
- Install Heroku CLI
- Configure environment variables in Heroku dashboard
- Deploy using Heroku CLI or GitHub integration
distripack-api/
├── Controllers/ # API Controllers
├── Models/ # Data Models
├── Services/ # Business Logic
├── Persistence/ # Data Access Layer
├── Migrations/ # Database Migrations
├── Helper/ # Utility Classes
└── Properties/ # Project Properties
- All sensitive credentials and configurations are managed through environment variables
appsettings.jsonshould never be committed to the repository- JWT authentication implementation
- HTTPS enforcement in production
- Input validation and sanitization
- CORS policies configured
- Rate limiting implemented
This project is licensed under the MIT License - see the LICENSE file for details.
While this project is no longer actively maintained, we welcome:
- Bug reports
- Documentation improvements
- Code quality suggestions
Please note that feature requests or major changes may not be implemented as this is a completed project.
As this is a completed project, support is limited to:
- Documentation review
- Code review for learning purposes
- Bug reports
For any inquiries, please:
- Open an issue in the repository
- Contact wagner.guido.5@gmail.com
- Check the documentation
Once the application is running, you can access the Swagger documentation at:
https://localhost:5001/swagger
The Swagger UI provides interactive documentation for all API endpoints, including:
- Request/response schemas
- Authentication requirements
- Example requests
- Try-it-out functionality
Note: Swagger is only available in Development environment.
Run the test suite:
dotnet testKey NuGet packages used in this project:
- Microsoft.EntityFrameworkCore (2.1.11)
- Microsoft.EntityFrameworkCore.SqlServer (2.1.11)
- Microsoft.EntityFrameworkCore.Tools (2.1.11)
- AutoMapper (7.0.1)
- AutoMapper.Extensions.Microsoft.DependencyInjection (5.0.1)
- Microsoft.VisualStudio.Web.CodeGeneration.Design (2.1.9)
- Microsoft.AspNetCore.App
- Swashbuckle.AspNetCore (4.0.7)
This project was completed in 2019 and serves as a demonstration of:
- Clean Architecture principles
- .NET Core best practices
- RESTful API design
- Docker containerization
- CI/CD implementation
- Database management with Entity Framework Core
- Security best practices
- Testing methodologies
While the code is available for reference and learning purposes, it is no longer actively maintained or updated.