Shopfinity is a production-ready full-stack eCommerce platform featuring a modern Next.js storefront and a robust ASP.NET Core REST API. Built with clean architecture principles, it delivers a complete online shopping experience with real-time inventory management, secure authentication, and powerful search capabilities.
- π JWT + Cookie Authentication with CSRF protection
- π Fuzzy Search with PostgreSQL
pg_trgmfor typo-tolerant product discovery - π Real-time Cart & Wishlist with optimistic UI updates
- π¦ Inventory-aware Checkout with transaction safety
- π¨βπΌ Admin Dashboard for product and order management
- π± Responsive Design with Tailwind CSS
| Technology | Purpose |
|---|---|
| Next.js 15 | React framework with App Router |
| TypeScript | Type-safe development |
| TanStack Query | Server state management |
| Tailwind CSS | Utility-first styling |
| Axios | HTTP client with cookie support |
| React Hook Form | Form handling |
| Zod | Schema validation |
| React Hot Toast | Notifications |
| Technology | Purpose |
|---|---|
| ASP.NET Core 8 | Web API framework |
| Entity Framework Core | ORM with PostgreSQL |
| ASP.NET Core Identity | User management |
| FluentValidation | Input validation |
| AutoMapper | Object mapping |
| Serilog | Structured logging |
| Npgsql | PostgreSQL driver |
- PostgreSQL with
pg_trgmextension for fuzzy search - Full-text search with GIN indexes
- Row-level security considerations
shopfinity/
βββ π Shopfinity.API/ # HTTP API, middleware, DI configuration
β βββ Controllers/v1/ # REST API endpoints
β βββ Middleware/ # Exception handling, CSRF, correlation IDs
β βββ Responses/ # Standardized API response models
β
βββ π Shopfinity.Application/ # Business logic, use cases, DTOs
β βββ Common/ # Shared abstractions, exceptions
β βββ Features/ # Feature-organized modules
β βββ Auth/
β βββ Carts/
β βββ Categories/
β βββ Orders/
β βββ Products/
β βββ Reviews/
β βββ Uploads/
β βββ Wishlists/
β
βββ π Shopfinity.Domain/ # Core entities, enums, constants
β βββ Entities/ # Domain models
β βββ Common/ # Base entity classes
β βββ Constants/ # Role definitions
β
βββ π Shopfinity.Infrastructure/ # Data access, Identity, external services
β βββ Data/ # DbContext, migrations, seeding
β βββ Identity/ # ApplicationUser, JWT services
β βββ Migrations/ # EF Core migration files
β βββ Services/ # File upload, image handling
β
βββ π shopfinity-web/ # Next.js frontend application
β βββ app/ # App Router pages
β β βββ (routes)/ # Public routes
β β βββ admin/ # Admin dashboard
β β βββ api/ # Next.js API routes (auth proxy)
β βββ components/ # React components
β βββ hooks/ # Custom React Query hooks
β βββ services/ # API service layer
β βββ types/ # TypeScript type definitions
β βββ lib/ # Utilities, axios config
β
βββ π Shopfinity.Tests/ # Unit & integration tests
- JWT Tokens stored in HttpOnly cookies for XSS protection
- CSRF Protection on mutating requests via
XSRF-TOKENcookie - Rate Limiting on search (20/10s), auth (5/min), reviews (3/5min)
- Password Policy: 8+ chars, uppercase, digit required
- Live Suggestions in navbar with 300ms debounce
- Fuzzy Matching using PostgreSQL
pg_trgmsimilarity - Full-Text Search with tsvector ranking
- Category Filtering by slug or ID
- Price Range Filtering
- Server-Side Cart persisted per user
- Inventory Validation before checkout
- Optimistic UI updates for instant feedback
- Transaction Safety with database transactions
- Idempotency Keys prevent duplicate orders
- Product CRUD with image uploads
- Category management
- Order status tracking
- Sales dashboard (planned)
- .NET 8 SDK
- Node.js 18+ (LTS recommended)
- PostgreSQL 14+
git clone https://github.com/mhdnazrul/shopfinity.git
cd shopfinityCreate PostgreSQL database:
CREATE DATABASE shopfinity;Configure connection in Shopfinity.API/appsettings.Development.json:
{
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=shopfinity;Username=postgres;Password=YOUR_PASSWORD"
},
"JwtSettings": {
"Key": "your-super-secret-key-at-least-32-characters-long",
"Issuer": "Shopfinity",
"Audience": "Shopfinity.Client",
"ExpiryMinutes": 60
}
}Apply migrations:
dotnet ef database update --project Shopfinity.Infrastructure --startup-project Shopfinity.APIdotnet run --project Shopfinity.API --launch-profile http
# API available at: http://localhost:5049cd shopfinity-web
# Create environment file
cp .env.example .env.local
# Edit .env.local: NEXT_PUBLIC_API_URL=http://localhost:5049
npm install
npm run dev
# App available at: http://localhost:3000# Run all tests
dotnet test
# Build frontend
cd shopfinity-web && npm run buildAfter first run, the database seeder creates:
| Role | Password | |
|---|---|---|
| π¨βπΌ Admin | admin@shopfinity.com |
Admin123! |
| π€ Customer | test@shopfinity.com |
Test123! |
β οΈ Change these in production!
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/v1/Auth/register |
Register new user |
| POST | /api/v1/Auth/login |
Authenticate user |
| POST | /api/v1/Auth/logout |
Sign out |
| POST | /api/v1/Auth/refresh |
Refresh JWT token |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/Products |
Search/filter products |
| GET | /api/v1/Products/search?q={term} |
Search suggestions |
| GET | /api/v1/Products/{slug} |
Get product details |
| POST | /api/v1/Products |
Create product (Admin) |
| PUT | /api/v1/Products/{id} |
Update product (Admin) |
| DELETE | /api/v1/Products/{id} |
Delete product (Admin) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/Carts |
Get user's cart |
| POST | /api/v1/Carts/items |
Add item to cart |
| DELETE | /api/v1/Carts/items/{id} |
Remove item from cart |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/Orders |
Get my orders |
| POST | /api/v1/Orders/checkout |
Place order |
| GET | /api/v1/Orders/admin/all |
Get all orders (Admin) |
| PUT | /api/v1/Orders/{id}/status |
Update order status (Admin) |
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/Wishlists |
Get my wishlist |
| POST | /api/v1/Wishlists |
Add to wishlist |
| DELETE | /api/v1/Wishlists/{id} |
Remove from wishlist |
See DEPLOYMENT.md for detailed deployment instructions for:
- Vercel (Frontend)
- Render/Railway (Backend)
- Supabase (PostgreSQL)
| Variable | Required | Description |
|---|---|---|
NEXT_PUBLIC_API_URL |
β | Backend API URL (no trailing slash) |
| Variable | Required | Description |
|---|---|---|
ConnectionStrings:DefaultConnection |
β | PostgreSQL connection string |
JwtSettings:Key |
β | JWT signing key (32+ chars) |
JwtSettings:Issuer |
β | Token issuer |
JwtSettings:Audience |
β | Token audience |
If shopfinity-web appears as a submodule but isn't configured:
# Remove nested git repository
cd shopfinity-web
rm -rf .git
cd ..
# Re-add to parent repository
git add shopfinity-web
git commit -m "Fix nested git repository"If migrations fail:
# Drop and recreate database
dotnet ef database drop --project Shopfinity.Infrastructure --startup-project Shopfinity.API
dotnet ef database update --project Shopfinity.Infrastructure --startup-project Shopfinity.APIIf fuzzy search doesn't work:
CREATE EXTENSION IF NOT EXISTS pg_trgm;See DATABASE.md for complete SQL schema documentation.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure:
dotnet testpassesnpm run buildsucceeds inshopfinity-web/- No console errors in browser
Distributed under the MIT License. See LICENSE for details.
Nazrul Islam
- π§ Email: mhdnazrul511@gmail.com
- π GitHub: https://github.com/mhdnazrul
- πΌ LinkedIn: https://linkedin.com/nazrulislam7
** roki **
Built with β€οΈ using Next.js, ASP.NET Core, and PostgreSQL