A modern, high-performance RESTful API for managing a product catalog, built with .NET 10 and MongoDB.
MongoStoreApi is a robust backend service designed to demonstrate best practices in building scalable APIs using the .NET ecosystem and NoSQL databases. It provides a complete set of CRUD operations for product management, leveraging a clean architecture approach, dependency injection, and containerized infrastructure.
This project serves as a practical portfolio piece showcasing API design, Docker integration, and automated CI/CD pipelines, making it an excellent reference for modern backend engineering standards.
- Full CRUD Operations: Create, Read, Update, and Delete products seamlessly.
- NoSQL Integration: Built on top of MongoDB using the official C# Driver.
- Containerized Database: Easy local setup using Docker Compose.
- API Documentation: Interactive Swagger UI configured out of the box.
- Automated Testing Ready: Includes
.httpfiles for quick endpoint validation. - CI/CD Pipeline: GitHub Actions workflow configured for automated building and testing.
- Clean Architecture: Separation of concerns with Services, Models, and Controllers.
- Framework: .NET 10 (ASP.NET Core Web API)
- Database: MongoDB 7.0
- Containerization: Docker & Docker Compose
- Documentation: Swashbuckle (Swagger / OpenAPI)
- CI/CD: GitHub Actions
Before you begin, ensure you have the following installed on your machine:
- Git
- .NET 10 SDK
- Docker Desktop (required to run the MongoDB container)
- An IDE like Visual Studio Code or Visual Studio 2022
Follow these steps to clone the repository and run the application locally.
Open your terminal and run the following command to clone the project:
git clone https://github.com/your-username/MongoStoreApi.git
cd MongoStoreApiThe project includes a docker-compose.yml file to quickly spin up a local MongoDB instance. Make sure Docker Desktop is running, then execute:
docker-compose up -dThis command downloads the MongoDB image and starts the database container in the background on port 27017.
With the database running, you can now restore the dependencies and start the API:
# Restore NuGet packages
dotnet restore
# Build the project
dotnet build
# Run the application
dotnet runOnce the application is running, open your browser and navigate to the Swagger UI to interact with the API:
- Swagger UI: https://localhost:PORT/swagger (Check your terminal output for the exact HTTPS port assigned by .NET, usually 7123 or 5001).
The API exposes the following endpoints under the /api/products route:
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/products | Retrieves a list of all products |
| GET | /api/products/{id} | Retrieves a specific product by its ID |
| POST | /api/products | Creates a new product |
| PUT | /api/products/{id} | Updates an existing product by its ID |
| DELETE | /api/products/{id} | Deletes a product by its ID |
Distributed under the MIT License. See LICENSE for more information.
Developed with 💻 and ☕ by Gilberto Andreatta