# Multi-Tenant Ecommerce Platform A production-ready, multi-tenant ecommerce platform that enables vendors to operate independent webshops while integrating with external marketplaces. Built with complete vendor isolation, comprehensive business features, and modern reactive frontend. ## ๐Ÿš€ Features ### Core Business Features - **Multi-Vendor Marketplace**: Complete vendor isolation with independent webshops - **Marketplace Integration**: Import and curate products from external marketplaces (Letzshop CSV) - **Product Catalog Management**: Vendor-scoped product publishing from marketplace imports - **Inventory Management**: Real-time stock tracking with location-based inventory - **Order Management**: Complete order lifecycle with status tracking and fulfillment - **Customer Management**: Vendor-scoped customer accounts with order history - **Team Management**: Role-based access control with granular permissions - **Shopping Cart**: Session-based cart with real-time updates ### Technical Features - **Modern Frontend Stack**: Alpine.js for reactive UI with zero build step - **RESTful API Architecture**: FastAPI with comprehensive OpenAPI documentation - **Service Layer Pattern**: Clean separation of business logic and data access - **Exception-First Error Handling**: Frontend-friendly error responses with consistent error codes - **Multi-tenant Security**: Complete data isolation with vendor context detection - **Background Job Processing**: Async marketplace imports with status tracking - **Comprehensive API**: Admin, Vendor, and Public (Customer) endpoints ### Security & Compliance - **Complete Data Isolation**: Chinese wall between vendor data - **JWT Authentication**: Secure token-based authentication for all user types - **Role-Based Access Control**: Granular permissions (Owner, Manager, Editor, Viewer) - **Vendor Context Detection**: Subdomain and path-based tenant isolation - **Input Validation**: Pydantic models for all API requests - **Exception Handling**: Structured error responses with proper HTTP status codes ## ๐Ÿ—๏ธ Architecture ### Technology Stack - **Backend**: Python 3.13+ with FastAPI - **Database**: PostgreSQL with SQLAlchemy ORM - **Frontend**: Vanilla HTML, CSS, JavaScript with Alpine.js (CDN-based, no build step) - **Authentication**: JWT tokens with role-based permissions - **Background Jobs**: Async CSV import processing - **API Documentation**: Auto-generated OpenAPI/Swagger ### Multi-Tenancy Model ``` Platform โ”œโ”€โ”€ Admin Portal (admin.platform.com or /admin) โ”‚ โ”œโ”€โ”€ Vendor management โ”‚ โ”œโ”€โ”€ User administration โ”‚ โ”œโ”€โ”€ Platform statistics โ”‚ โ””โ”€โ”€ Import job monitoring โ”œโ”€โ”€ Vendor A (vendor-a.platform.com or /vendor/{code}) โ”‚ โ”œโ”€โ”€ Marketplace product imports โ”‚ โ”œโ”€โ”€ Product catalog publishing โ”‚ โ”œโ”€โ”€ Order management โ”‚ โ”œโ”€โ”€ Customer management โ”‚ โ”œโ”€โ”€ Team management โ”‚ โ””โ”€โ”€ Inventory tracking โ”œโ”€โ”€ Vendor B (vendor-b.platform.com or /vendor/{code}) โ”‚ โ””โ”€โ”€ Completely isolated from Vendor A โ””โ”€โ”€ Customer Shop (/shop or subdomain) โ”œโ”€โ”€ Product browsing โ”œโ”€โ”€ Shopping cart โ”œโ”€โ”€ Order placement โ””โ”€โ”€ Order history ``` ### Data Flow ``` Marketplace CSV โ†’ Import Job โ†’ MarketplaceProduct (Staging) โ†’ Product (Catalog) โ†’ Order โ†’ Customer โ†“ โ†“ โ†“ Job Status Product Selection Inventory Tracking ``` ## ๐Ÿ“ Project Structure ``` โ”œโ”€โ”€ main.py # FastAPI application entry point โ”œโ”€โ”€ app/ โ”‚ โ”œโ”€โ”€ api/ โ”‚ โ”‚ โ”œโ”€โ”€ main.py # API router aggregation โ”‚ โ”‚ โ”œโ”€โ”€ deps.py # Dependency injection (auth, context) โ”‚ โ”‚ โ””โ”€โ”€ v1/ # API version 1 โ”‚ โ”‚ โ”œโ”€โ”€ admin/ # Admin endpoints โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ __init__.py โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ auth.py โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ vendors.py โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ users.py โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ marketplace.py โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ dashboard.py โ”‚ โ”‚ โ”œโ”€โ”€ vendor/ # Vendor endpoints โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ __init__.py โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ auth.py โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ dashboard.py โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ products.py โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ orders.py โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ marketplace.py โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ inventory.py โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ vendor.py โ”‚ โ”‚ โ””โ”€โ”€ public/ # Customer endpoints โ”‚ โ”‚ โ”œโ”€โ”€ __init__.py โ”‚ โ”‚ โ””โ”€โ”€ vendors/ โ”‚ โ”‚ โ”œโ”€โ”€ auth.py โ”‚ โ”‚ โ”œโ”€โ”€ products.py โ”‚ โ”‚ โ”œโ”€โ”€ cart.py โ”‚ โ”‚ โ””โ”€โ”€ orders.py โ”‚ โ”œโ”€โ”€ core/ โ”‚ โ”‚ โ”œโ”€โ”€ database.py # Database configuration โ”‚ โ”‚ โ”œโ”€โ”€ security.py # JWT and password utilities โ”‚ โ”‚ โ””โ”€โ”€ config.py # Application settings โ”‚ โ”œโ”€โ”€ exceptions/ # Custom exceptions โ”‚ โ”‚ โ”œโ”€โ”€ __init__.py โ”‚ โ”‚ โ”œโ”€โ”€ base.py โ”‚ โ”‚ โ”œโ”€โ”€ auth.py โ”‚ โ”‚ โ”œโ”€โ”€ vendor.py โ”‚ โ”‚ โ”œโ”€โ”€ customer.py โ”‚ โ”‚ โ”œโ”€โ”€ product.py โ”‚ โ”‚ โ”œโ”€โ”€ order.py โ”‚ โ”‚ โ”œโ”€โ”€ inventory.py โ”‚ โ”‚ โ”œโ”€โ”€ team.py โ”‚ โ”‚ โ”œโ”€โ”€ marketplace_product.py โ”‚ โ”‚ โ”œโ”€โ”€ marketplace_import_job.py โ”‚ โ”‚ โ””โ”€โ”€ admin.py โ”‚ โ””โ”€โ”€ services/ # Business logic layer โ”‚ โ”œโ”€โ”€ auth_service.py โ”‚ โ”œโ”€โ”€ admin_service.py โ”‚ โ”œโ”€โ”€ vendor_service.py โ”‚ โ”œโ”€โ”€ customer_service.py โ”‚ โ”œโ”€โ”€ product_service.py โ”‚ โ”œโ”€โ”€ order_service.py โ”‚ โ”œโ”€โ”€ cart_service.py โ”‚ โ”œโ”€โ”€ inventory_service.py โ”‚ โ”œโ”€โ”€ team_service.py โ”‚ โ”œโ”€โ”€ marketplace_service.py โ”‚ โ””โ”€โ”€ stats_service.py โ”œโ”€โ”€ models/ โ”‚ โ”œโ”€โ”€ database/ # SQLAlchemy ORM models โ”‚ โ”‚ โ”œโ”€โ”€ base.py โ”‚ โ”‚ โ”œโ”€โ”€ user.py โ”‚ โ”‚ โ”œโ”€โ”€ vendor.py โ”‚ โ”‚ โ”œโ”€โ”€ customer.py โ”‚ โ”‚ โ”œโ”€โ”€ product.py โ”‚ โ”‚ โ”œโ”€โ”€ order.py โ”‚ โ”‚ โ”œโ”€โ”€ inventory.py โ”‚ โ”‚ โ”œโ”€โ”€ marketplace_product.py โ”‚ โ”‚ โ””โ”€โ”€ marketplace_import_job.py โ”‚ โ””โ”€โ”€ schemas/ # Pydantic validation models โ”‚ โ”œโ”€โ”€ auth.py โ”‚ โ”œโ”€โ”€ vendor.py โ”‚ โ”œโ”€โ”€ customer.py โ”‚ โ”œโ”€โ”€ product.py โ”‚ โ”œโ”€โ”€ order.py โ”‚ โ”œโ”€โ”€ inventory.py โ”‚ โ”œโ”€โ”€ marketplace_product.py โ”‚ โ”œโ”€โ”€ marketplace_import_job.py โ”‚ โ””โ”€โ”€ stats.py โ”œโ”€โ”€ middleware/ โ”‚ โ”œโ”€โ”€ auth.py # JWT authentication โ”‚ โ”œโ”€โ”€ vendor_context.py # Multi-tenant context detection โ”‚ โ”œโ”€โ”€ rate_limiter.py # API rate limiting โ”‚ โ””โ”€โ”€ decorators.py # Utility decorators โ”œโ”€โ”€ static/ # Frontend assets (no build step required) โ”‚ โ”œโ”€โ”€ admin/ # Admin interface โ”‚ โ”‚ โ”œโ”€โ”€ login.html โ”‚ โ”‚ โ”œโ”€โ”€ dashboard.html โ”‚ โ”‚ โ””โ”€โ”€ vendors.html โ”‚ โ”œโ”€โ”€ vendor/ # Vendor management UI โ”‚ โ”‚ โ”œโ”€โ”€ login.html โ”‚ โ”‚ โ”œโ”€โ”€ dashboard.html โ”‚ โ”‚ โ””โ”€โ”€ admin/ โ”‚ โ”‚ โ”œโ”€โ”€ products.html โ”‚ โ”‚ โ”œโ”€โ”€ orders.html โ”‚ โ”‚ โ””โ”€โ”€ marketplace.html โ”‚ โ”œโ”€โ”€ shop/ # Customer shop interface โ”‚ โ”‚ โ”œโ”€โ”€ products.html โ”‚ โ”‚ โ”œโ”€โ”€ product.html # Alpine.js product detail โ”‚ โ”‚ โ”œโ”€โ”€ cart.html โ”‚ โ”‚ โ””โ”€โ”€ account/ โ”‚ โ”‚ โ”œโ”€โ”€ register.html โ”‚ โ”‚ โ”œโ”€โ”€ login.html โ”‚ โ”‚ โ””โ”€โ”€ orders.html โ”‚ โ”œโ”€โ”€ css/ โ”‚ โ”‚ โ”œโ”€โ”€ shared/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ base.css # CSS variables, utility classes โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ auth.css โ”‚ โ”‚ โ”œโ”€โ”€ admin/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ admin.css โ”‚ โ”‚ โ”œโ”€โ”€ vendor/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ vendor.css โ”‚ โ”‚ โ””โ”€โ”€ shop/ โ”‚ โ”‚ โ””โ”€โ”€ shop.css โ”‚ โ””โ”€โ”€ js/ โ”‚ โ””โ”€โ”€ shared/ โ”‚ โ”œโ”€โ”€ api-client.js โ”‚ โ”œโ”€โ”€ vendor-context.js โ”‚ โ””โ”€โ”€ utils.js โ”œโ”€โ”€ scripts/ โ”‚ โ”œโ”€โ”€ init_db.py # Database initialization โ”‚ โ””โ”€โ”€ create_admin.py # Admin user creation โ””โ”€โ”€ tests/ โ”œโ”€โ”€ unit/ โ”œโ”€โ”€ integration/ โ””โ”€โ”€ e2e/ ``` ## ๐Ÿš€ Quick Start ### Prerequisites - Python 3.13+ - PostgreSQL 14+ (SQLite for development) - Node.js (optional, only for development tools) ### Development Setup #### 1. Clone and Setup Environment ```bash git clone cd multi-tenant-ecommerce python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install -r requirements.txt ``` #### 2. Database Setup ```bash # Create database createdb ecommerce_db # Run migrations python scripts/init_db.py # Create initial admin user python scripts/create_admin.py ``` #### 3. Environment Configuration ```bash cp .env.example .env # Edit .env with your configuration ``` Minimal `.env`: ```env DATABASE_URL=postgresql://user:pass@localhost:5432/ecommerce_db SECRET_KEY=your-secret-key-here-generate-with-openssl ALGORITHM=HS256 ACCESS_TOKEN_EXPIRE_MINUTES=30 DEVELOPMENT_MODE=true ``` #### 4. Start Application ```bash # Start FastAPI application uvicorn main:app --reload --port 8000 ``` #### 5. Access the Platform - **Admin Panel**: http://localhost:8000/admin/ - **Vendor Login**: http://localhost:8000/vendor/login - **Customer Shop**: http://localhost:8000/shop/ - **API Documentation**: http://localhost:8000/docs - **Health Check**: http://localhost:8000/health ### First Steps 1. **Login to Admin Panel** - URL: http://localhost:8000/admin/ - Credentials: Created via `create_admin.py` 2. **Create First Vendor** - Navigate to Admin โ†’ Vendors - Click "Create Vendor" - Fill in vendor details (name, code, subdomain) - System creates vendor + owner user account - Note the temporary password 3. **Login as Vendor Owner** - URL: http://localhost:8000/vendor/login (or subdomain) - Use vendor owner credentials 4. **Import Products from Marketplace** - Navigate to Vendor โ†’ Marketplace Import - Configure Letzshop CSV URL - Trigger import job - Monitor import status 5. **Publish Products to Catalog** - Review imported products in staging - Select products to publish - Configure pricing and inventory - Publish to customer-facing catalog ## ๐Ÿ“‹ API Structure ### Admin APIs (`/api/v1/admin`) **Authentication:** ``` POST /auth/login # Admin login ``` **Vendor Management:** ``` GET /vendors # List all vendors POST /vendors # Create vendor with owner GET /vendors/{id} # Get vendor details PUT /vendors/{id}/verify # Verify/unverify vendor PUT /vendors/{id}/status # Toggle active status DELETE /vendors/{id} # Delete vendor ``` **User Management:** ``` GET /users # List all users PUT /users/{id}/status # Toggle user status ``` **Marketplace Monitoring:** ``` GET /marketplace-import-jobs # Monitor all import jobs ``` **Dashboard & Statistics:** ``` GET /dashboard # Admin dashboard GET /dashboard/stats # Comprehensive statistics GET /dashboard/stats/marketplace # Marketplace breakdown GET /dashboard/stats/platform # Platform-wide metrics ``` ### Vendor APIs (`/api/v1/vendor`) **Authentication:** ``` POST /auth/login # Vendor team login POST /auth/logout # Logout ``` **Dashboard:** ``` GET /dashboard/stats # Vendor-specific statistics ``` **Product Management:** ``` GET /products # List catalog products POST /products # Add product to catalog GET /products/{id} # Get product details PUT /products/{id} # Update product DELETE /products/{id} # Remove from catalog POST /products/from-import/{id} # Publish from marketplace PUT /products/{id}/toggle-active # Toggle product active PUT /products/{id}/toggle-featured # Toggle featured status ``` **Order Management:** ``` GET /orders # List vendor orders GET /orders/{id} # Get order details PUT /orders/{id}/status # Update order status ``` **Marketplace Integration:** ``` POST /marketplace/import # Trigger import job GET /marketplace/jobs # List import jobs GET /marketplace/jobs/{id} # Get job status GET /marketplace/products # List staged products POST /marketplace/products/publish # Bulk publish to catalog ``` **Inventory Management:** ``` GET /inventory # List inventory items POST /inventory # Add inventory PUT /inventory/{id} # Update inventory GET /inventory/movements # Inventory movement history ``` ### Public/Customer APIs (`/api/v1/public/vendors`) **Authentication:** ``` POST /{vendor_id}/auth/register # Customer registration POST /{vendor_id}/auth/login # Customer login POST /{vendor_id}/auth/logout # Customer logout ``` **Product Browsing:** ``` GET /{vendor_id}/products # Browse product catalog GET /{vendor_id}/products/{id} # Product details GET /{vendor_id}/products/search # Search products ``` **Shopping Cart:** ``` GET /{vendor_id}/cart/{session} # Get cart POST /{vendor_id}/cart/{session}/items # Add to cart PUT /{vendor_id}/cart/{session}/items/{id} # Update quantity DELETE /{vendor_id}/cart/{session}/items/{id} # Remove item DELETE /{vendor_id}/cart/{session} # Clear cart ``` **Order Placement:** ``` POST /{vendor_id}/orders # Place order GET /{vendor_id}/customers/{id}/orders # Order history GET /{vendor_id}/customers/{id}/orders/{id} # Order details ``` ## ๐ŸŽจ Frontend Architecture ### Alpine.js Integration #### Why Alpine.js? - โœ… Lightweight (15KB) - perfect for multi-tenant platform - โœ… No build step required - works directly in HTML - โœ… Reactive state management - modern UX without complexity - โœ… Perfect Jinja2 integration - server + client harmony - โœ… Scoped components - natural vendor isolation #### Example: Product Detail Page ```html

โ‚ฌ

``` ### CSS Architecture #### CSS Variables for Multi-Tenant Theming ```css /* Base variables in base.css */ :root { --primary-color: #3b82f6; --primary-dark: #2563eb; --success-color: #10b981; --danger-color: #ef4444; --warning-color: #f59e0b; /* Typography */ --font-base: 16px; --font-sm: 0.875rem; --font-xl: 1.25rem; /* Spacing */ --spacing-sm: 0.5rem; --spacing-md: 1rem; --spacing-lg: 1.5rem; /* Borders & Shadows */ --radius-md: 0.375rem; --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1); } /* Vendor-specific overrides */ [data-vendor-theme="dark"] { --primary-color: #1f2937; --background-color: #111827; } ``` ## ๐Ÿ”’ Security Implementation ### Authentication Flow **Admin Login:** ``` 1. POST /api/v1/admin/auth/login 2. Verify credentials + admin role 3. Generate JWT token 4. Store token in localStorage 5. Include in Authorization header for protected routes ``` **Vendor Team Login:** ``` 1. POST /api/v1/vendor/auth/login 2. Detect vendor context (subdomain or path) 3. Verify credentials + vendor membership 4. Generate JWT token with vendor context 5. All subsequent requests validated against vendor ``` **Customer Login:** ``` 1. POST /api/v1/public/vendors/{id}/auth/login 2. Verify customer credentials for specific vendor 3. Generate JWT token with customer context 4. Customer can only access their own data ``` ### Vendor Context Detection ```python # Automatic vendor detection from: 1. Subdomain: vendor-a.platform.com 2. Path parameter: /vendor/VENDOR_A/ 3. JWT token: Embedded vendor_id in claims # Complete data isolation: - All queries automatically scoped to vendor_id - Cross-vendor access prevented at service layer - Exception raised if vendor mismatch detected ``` ### Exception Handling Pattern ```python # Frontend-friendly error responses { "detail": "Human-readable error message", "error_code": "PRODUCT_NOT_FOUND", "status_code": 404, "timestamp": "2025-01-10T12:00:00Z", "request_id": "abc123" } # Consistent error codes across platform - VENDOR_NOT_FOUND - PRODUCT_NOT_IN_CATALOG - INSUFFICIENT_INVENTORY - INVALID_ORDER_STATUS - UNAUTHORIZED_VENDOR_ACCESS ``` ## ๐Ÿ“Š Database Schema ### Core Tables **Multi-Tenant Foundation:** ```sql vendors # Vendor accounts โ”œโ”€โ”€ users # Platform/admin users โ”œโ”€โ”€ vendor_users # Vendor team members (many-to-many) โ””โ”€โ”€ roles # Role definitions per vendor customers # Vendor-scoped customers โ””โ”€โ”€ customer_addresses ``` **Product & Inventory:** ```sql marketplace_products # Imported from marketplaces (staging) โ””โ”€โ”€ marketplace_import_jobs # Import tracking products # Published vendor catalog โ””โ”€โ”€ inventory # Stock tracking by location โ””โ”€โ”€ inventory_movements ``` **Orders & Commerce:** ```sql orders โ”œโ”€โ”€ order_items โ”œโ”€โ”€ shipping_address (FK to customer_addresses) โ””โ”€โ”€ billing_address (FK to customer_addresses) ``` ### Key Relationships ``` Vendor (1) โ”€โ”€โ†’ (N) Products Vendor (1) โ”€โ”€โ†’ (N) Customers Vendor (1) โ”€โ”€โ†’ (N) Orders Vendor (1) โ”€โ”€โ†’ (N) MarketplaceProducts Product (1) โ”€โ”€โ†’ (N) Inventory Product (1) โ”€โ”€โ†’ (1) MarketplaceProduct Order (1) โ”€โ”€โ†’ (N) OrderItems Order (1) โ”€โ”€โ†’ (1) Customer Order (1) โ”€โ”€โ†’ (1) ShippingAddress Order (1) โ”€โ”€โ†’ (1) BillingAddress ``` ## ๐Ÿงช Testing ### Current Test Coverage ```bash # Run all tests pytest tests/ # Run with coverage pytest --cov=app --cov=models --cov=middleware tests/ # Run specific test category pytest tests/unit/ pytest tests/integration/ pytest tests/e2e/ ``` ### Test Structure - **Unit Tests**: Service layer logic, model validation - **Integration Tests**: API endpoints, database operations - **E2E Tests**: Complete user workflows (admin creates vendor โ†’ vendor imports products โ†’ customer places order) ## ๐Ÿšฆ Development Status ### โœ… Completed Features **Slice 1: Multi-Tenant Foundation** - โœ… Admin creates vendors through admin interface - โœ… Vendor owner login with context detection - โœ… Complete vendor data isolation - โœ… Role-based access control - โœ… JWT authentication system **Slice 2: Marketplace Integration** - โœ… CSV import from Letzshop - โœ… Background job processing - โœ… Import status tracking - โœ… Product staging area - ๐Ÿšง Real-time Alpine.js status updates **Slice 3: Product Catalog** - โœ… Product publishing from marketplace staging - โœ… Vendor product catalog management - โœ… Product CRUD operations - โœ… Inventory tracking - โœ… Product filtering and search **Slice 4: Customer Shopping** - โœ… Customer service implementation - โœ… Customer registration/login - โœ… Product browsing interface - โœ… Shopping cart with Alpine.js - โœ… Product detail page (Alpine.js) **Slice 5: Order Processing** - โœ… Order creation from cart - โœ… Order management (vendor) - โœ… Order history (customer) - โœ… Order status tracking - โœ… Inventory reservation ### ๐Ÿšง In Progress (BOOTS) **Current Sprint:** - ๐Ÿšง Customer account dashboard (Alpine.js) - ๐Ÿšง Multi-step checkout flow - ๐Ÿšง Payment integration placeholder (Stripe ready) - ๐Ÿšง Order confirmation page - ๐Ÿšง Email notifications (order confirmations) ## ๐Ÿ“‹ Roadmap ### Phase 1: Core Platform (90% Complete) - โœ… Multi-tenant architecture - โœ… Vendor management - โœ… Product catalog system - โœ… Order processing - โœ… Customer management - ๐Ÿšง Payment integration (ready for Stripe) - ๐Ÿšง Email notifications ### Phase 2: Advanced Features (Next) - Persistent cart storage (Redis/Database) - Order search and filtering - Advanced inventory management - Product variants support - Customer reviews and ratings - Vendor analytics dashboard ### Phase 3: Enterprise Features (Future) - Multi-language support - Advanced reporting and exports - Webhook integrations - API rate limiting enhancements - Performance monitoring - Automated backups ## ๐Ÿ“ Naming Conventions The project follows strict naming conventions for consistency: ### Files - **API files**: Plural (`products.py`, `orders.py`) - **Model files**: Singular (`product.py`, `order.py`) - **Service files**: Singular + service (`product_service.py`) - **Exception files**: Singular (`product.py`, `order.py`) ### Terminology - **inventory** (not stock) - **vendor** (not shop) - **customer** (not user for end-users) - **team** (not staff) See `docs/6.complete_naming_convention.md` for full details. ## ๐Ÿค Contributing ### Development Workflow 1. Fork the repository 2. Create feature branch: `git checkout -b feature/amazing-feature` 3. Follow existing patterns (service layer, exceptions, Alpine.js) 4. Add tests for new features 5. Update API documentation 6. Submit pull request ### Code Quality ```bash # Format code black app/ models/ middleware/ # Sort imports isort app/ models/ middleware/ # Lint flake8 app/ models/ middleware/ ``` ## ๐Ÿ“„ License This project is licensed under the MIT License - see the LICENSE file for details. ## ๐Ÿ†˜ Support ### Documentation - **API Reference**: http://localhost:8000/docs - **Development Guides**: `/docs/` - **Naming Conventions**: `/docs/6.complete_naming_convention.md` - **Vertical Slice Plan**: `/docs/3.vertical_slice_roadmap.md` ### Key Features - **Zero Build Step**: Frontend works without compilation - **Alpine.js Reactive UI**: Modern UX without framework complexity - **Service Layer Pattern**: Clean, testable business logic - **Exception-First**: Consistent error handling - **Multi-Tenant by Design**: Complete vendor isolation --- Built with FastAPI, PostgreSQL, Alpine.js, and modern Python patterns for a scalable, maintainable multi-tenant ecommerce platform. ๐Ÿš€