Skip to content

gil-gam/MongoStoreApi

Repository files navigation

🛒 MongoStoreApi

.NET MongoDB Docker GitHub Actions License

A modern, high-performance RESTful API for managing a product catalog, built with .NET 10 and MongoDB.


📖 About the Project

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.


🚀 Features

  • 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 .http files 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.

🛠️ Tech Stack

  • Framework: .NET 10 (ASP.NET Core Web API)
  • Database: MongoDB 7.0
  • Containerization: Docker & Docker Compose
  • Documentation: Swashbuckle (Swagger / OpenAPI)
  • CI/CD: GitHub Actions

⚙️ Prerequisites

Before you begin, ensure you have the following installed on your machine:


🏃‍♂️ Getting Started

Follow these steps to clone the repository and run the application locally.

1. Clone the Repository

Open your terminal and run the following command to clone the project:

git clone https://github.com/your-username/MongoStoreApi.git
cd MongoStoreApi

2. Start the MongoDB Database (Docker)

The 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 -d

This command downloads the MongoDB image and starts the database container in the background on port 27017.

3. Run the .NET Application

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 run

4. Access the API

Once the application is running, open your browser and navigate to the Swagger UI to interact with the API:

📡 API Endpoints

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

📝 License

Distributed under the MIT License. See LICENSE for more information.

Developed with 💻 and ☕ by Gilberto Andreatta

About

A RESTful API for product store management built with .NET 10 and MongoDB. Features clean architecture, Docker support, Swagger UI, and GitHub Actions CI/CD pipeline.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages