A .NET 10 Web API backend for an e-commerce platform with PostgreSQL and Meilisearch integration.
- .NET 10 - Web API framework
- PostgreSQL - Main database
- Meilisearch - Search engine
- Entity Framework Core - ORM
- ASP.NET Core Identity - Authentication
- 🔐 Cookie-based authentication with CSRF protection
- 👤 User registration & email confirmation
- 🔑 Password reset flow
- 📦 Product CRUD with image upload
- 🏷️ Category & supplier management
- 📊 Inventory tracking across warehouses
- 🛒 Order processing lifecycle
- 🔍 Meilisearch integration for fast product search
- 🖼️ Image upload with local storage
- 📧 Email notifications (SMTP)
git clone https://github.com/yourusername/ecommerce-server.git
cd ecommerce-serverConfigure the database in appsettings.Development.json:
{
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Database=EcommerceDb;Username=postgres;Password=yourpassword"
}
}dotnet ef database updatedocker run -d -p 7700:7700 \
-e MEILI_MASTER_KEY='secret-key' \
-v meili_data:/meili_data \
--name meilisearch \
getmeili/meilisearchdotnet runServer will start at:
https://localhost:7053
Ecommerce_server/
├── Controllers/ # API endpoints
├── Models/ # Database entities
├── Models/Dtos/ # Data transfer objects
├── Services/ # Business logic
├── Data/ # Database context
└── Program.cs # Application entry point
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Database=EcommerceDb;Username=postgres;Password=yourpassword"
},
"EmailSettings": {
"SmtpServer": "localhost",
"SmtpPort": 25,
"SmtpUsername": "",
"SmtpPassword": "",
"FromEmail": "noreply@ecommerce.com",
"FromName": "Ecommerce Store"
},
"Meilisearch": {
"Endpoint": "http://localhost:7700",
"MasterKey": "secret-key"
},
"AppSettings": {
"ClientUrl": "http://localhost:4200",
"ApiUrl": "https://localhost:7053"
}
}Products are automatically synced to Meilisearch for fast searching. The sync runs:
- Automatically every hour (background service)
- On demand via
/sync/full-syncendpoint - Per product when updated via
/sync/product/{id}
For local development, use Papercut:
- Download and run Papercut
- Configure SMTP in
appsettings.Development.json:
"EmailSettings": {
"SmtpServer": "localhost",
"SmtpPort": 25
}All emails will appear in the Papercut UI.