A RESTful API built with .NET 8.0 for managing PC components inventory, categories, orders, and user authentication.
- Docker and Docker Compose installed
- .NET 8.0 SDK (for local development)
# Navigate to project directory
cd pc-components-api
# Build and start all services
docker-compose up --build
# API will be available at: http://localhost:8080
# Swagger UI: http://localhost:8080/swagger# 1. Start PostgreSQL database
docker run -d \
--name pccomponents-postgres \
-e POSTGRES_DB=pccomponentsdb \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-p 5432:5432 \
postgres:15
# 2. Update appsettings.json with your connection string if needed
# 3. Run the API
cd PCComponentsApi
dotnet run- Authentication API - User registration and login endpoints
- Products API - Product management endpoints
- Categories API - Category management endpoints
- Orders API - Order management endpoints
- Swagger UI - Interactive API documentation (available when running the API)
curl -X POST http://localhost:8080/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"email": "admin@pccomponents.com",
"fullName": "Admin User",
"password": "AdminPass123!",
"role": "admin"
}'curl -X POST http://localhost:8080/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "admin@pccomponents.com",
"password": "AdminPass123!"
}'curl http://localhost:8080/api/products \
-H "Authorization: Bearer YOUR_JWT_TOKEN"cd PCComponentsApi
dotnet builddotnet testdotnet ef migrations add InitialCreate
dotnet ef database update- ✅ BCrypt password hashing
- ✅ JWT token authentication
- ✅ Role-based authorization (admin/customer)
- ✅ Input validation with DataAnnotations
- ✅ Secure connection strings
- ✅ HTTPS support (configure for production)
{
"ConnectionStrings": {
"DefaultConnection": "Host=db;Port=5432;Database=pccomponentsdb;Username=postgres;Password=postgres"
},
"Jwt": {
"Key": "your-secret-key-here",
"Issuer": "PCComponentsApi",
"Audience": "PCComponentsApi",
"ExpirationInMinutes": 60
}
}# Start services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
# Rebuild
docker-compose up --build
# Clean up volumes
docker-compose down -v- .NET 8.0
- Entity Framework Core
- PostgreSQL (via Npgsql)
- JWT Bearer Authentication
- BCrypt.Net-Next
- Swagger/OpenAPI
- Change JWT secret key
- Configure HTTPS
- Set up proper logging
- Add database migrations
- Configure environment variables
- Set up monitoring and health checks
- Configure rate limiting
- Add input sanitization
- Enable CORS if needed
For issues or questions, please refer to the API Reference or the Swagger UI at /swagger when running the application.