A learning project built with .NET 8, following Clean Architecture principles.
The API allows users to register, upload and manage photos/documents, with file storage simulated using AWS S3 (LocalStack) and persistence with SQL Server running in Docker.
- REST API built with ASP.NET Core
- Entity Framework Core with SQL Server
- Repository + Service layers for clean separation of concerns
- File upload support for user photos and documents
- S3 integration (via LocalStack for local development)
- Health check endpoint (
/health) - Dockerized environment with SQL Server and LocalStack
FileUploadApi
├── FileUploadApi.API # ASP.NET Core Web API (controllers, DI setup, Program.cs)
├── FileUploadApi.Application # Business logic (services, interfaces, DTOs)
├── FileUploadApi.Domain # Core domain (entities, aggregates)
├── FileUploadApi.Infrastructure # Data access, EF Core DbContext, repository implementations
└── docker-compose.yml # Local development environment (SQL Server, LocalStack)
- .NET 8 SDK
- Docker (tested on macOS with Apple Silicon/M4)
- AWS CLI (optional, for interacting with LocalStack)
git clone https://github.com/your-username/FileUploadApi.git
cd FileUploadApidocker compose up -ddotnet ef database update --project FileUploadApi.Infrastructure --startup-project FileUploadApi.APIUsing AWS CLI and LocalStack, run the following command in your terminal:
aws --endpoint-url=http://localhost:4566 s3 mb s3://user-photosThis will create a bucket named user-photos locally. You should see the output:
make_bucket: user-photos
dotnet run --project FileUploadApi.APIThe API will be available at: https://localhost:5001 Swagger UI: https://localhost:5001/swagger
GET /healthPOST /api/userphotos/{userId}
Content-Type: multipart/form-data- Uploads a photo for the given user.
- If a photo already exists, the previous one is deleted from S3 and updated in the database.
DELETE /api/userphotos/{userId}- Deletes the photo for the given user.
- If no photo exists, the request is ignored.
Configuration is stored in appsettings.json:
"Storage": {
"BucketNamePhotos": "user-photos",
"BucketNameDocument": "user-documents",
"Region": "us-east-1",
"EndpointUrl": "http://localhost:4566",
"AccessKey": "test",
"SecretKey": "test"
}-
Uses Clean Architecture principles:
Domaincontains entities and core logicApplicationdefines interfaces and servicesInfrastructureimplements repositories and database accessAPIis the entry point (controllers, DI, middleware)
-
LocalStack simulates AWS S3 for uploads
-
SQL Server container is forced to
amd64for Apple Silicon compatibility (slower, but works)
- Add JWT Authentication
- Create endpoints for user registration & login
- Extend to upload/download documents
- Implement unit tests with xUnit + Moq
- Deploy to Azure or AWS
MIT License. This project is for learning purposes.