Skip to content

dmkalchev18/Ecommerce-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

E-Commerce Platform - Server

A .NET 10 Web API backend for an e-commerce platform with PostgreSQL and Meilisearch integration.


🚀 Tech Stack

  • .NET 10 - Web API framework
  • PostgreSQL - Main database
  • Meilisearch - Search engine
  • Entity Framework Core - ORM
  • ASP.NET Core Identity - Authentication

✨ Features

  • 🔐 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)

🏁 Getting Started

Prerequisites


Installation

1. Clone the repository

git clone https://github.com/yourusername/ecommerce-server.git
cd ecommerce-server

2. Configure the database

Configure the database in appsettings.Development.json:

{
  "ConnectionStrings": {
    "DefaultConnection": "Host=localhost;Database=EcommerceDb;Username=postgres;Password=yourpassword"
  }
}

3. Run migrations

dotnet ef database update

4. Start Meilisearch

docker run -d -p 7700:7700 \
  -e MEILI_MASTER_KEY='secret-key' \
  -v meili_data:/meili_data \
  --name meilisearch \
  getmeili/meilisearch

5. Run the server

dotnet run

Server will start at:

https://localhost:7053

📁 Project Structure

Ecommerce_server/
├── Controllers/     # API endpoints
├── Models/          # Database entities
├── Models/Dtos/     # Data transfer objects
├── Services/        # Business logic
├── Data/            # Database context
└── Program.cs       # Application entry point

🔧 Configuration

appsettings.json

{
  "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"
  }
}

🔍 Meilisearch Integration

Products are automatically synced to Meilisearch for fast searching. The sync runs:

  • Automatically every hour (background service)
  • On demand via /sync/full-sync endpoint
  • Per product when updated via /sync/product/{id}

📧 Email Testing (Development)

For local development, use Papercut:

  1. Download and run Papercut
  2. Configure SMTP in appsettings.Development.json:
"EmailSettings": {
  "SmtpServer": "localhost",
  "SmtpPort": 25
}

All emails will appear in the Papercut UI.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages