How abin-jacob-dev/e-commerce-jersey-selling-website works
1. Overall shape
- This is a single Django monolith for an e-commerce site selling sports jerseys.
- The runtime entry points are the standard Django project files in campeon/campeon/ (settings.py, urls.py, wsgi.py, asgi.py), with manage.py as the CLI entry.
2. Request routing boundary
- The root URL config delegates traffic into five main apps: core, userauths, user, products, payment, plus a separate admin_panel.
- The architecture is server-rendered Django templates rather than an API-first or SPA design; pages are composed from app-specific templates and shared partials.
3. Core site subsystem
- core appears to own the public informational pages and entry experience: home, shop, about, contact, and 404 handling.
- It also includes a custom template tag module (query_transform.py) used for preserving query parameters in list/filter navigation.
4. Authentication and account subsystem
- userauths is the identity boundary and likely contains the custom Account model, OTP support, referral fields, and activation/reset flows.
- It also includes forms, views, adapters, and utilities, indicating integration with external auth such as Google login via django-allauth.
- This app is the source of login/sign-up, admin sign-in, account verification, and password reset flows.
5. User profile subsystem
- user handles post-auth account management: profile edits, addresses, referrals, and user-specific utility logic.
- The presence of migrations for Addresses and OTP-related data suggests it also manages shipping address book state and related verification helpers.
- This is the customer account domain, separate from authentication itself.
6. Catalog and commerce domain
- products is the largest domain app and likely contains the core commerce models: products, variants, categories, colors, cart, wishlist, orders, coupons, offers, wallet, and order-item state.
- The heavy migration history suggests the business rules evolved here, especially around pricing, discounts, refunds, returns, and order snapshots.
- The app also includes forms.py, context_processors.py, signals.py, service.py, and offer_service.py, showing a mix of UI helpers, event-driven side effects, and domain services.
7. Discount and pricing flow
- Offer/coupon logic is implemented inside products and partially payment, not in a standalone pricing engine.
- The repository structure implies pricing is computed from product/variant data, then adjusted by offers, coupons, and possibly wallet balances before checkout.
- offer_service.py suggests a dedicated decision layer for selecting the best offer for a product or category.
8. Checkout and payment subsystem
- payment encapsulates order payment processing and likely the Razorpay integration boundary.
- It includes services.py, which points to a service layer for payment order creation, verification, and status updates.
- Payment methods include COD, wallet, and Razorpay, so this app likely finalizes orders and reconciles payment state with order records in products.
9. Admin operations subsystem
- admin_panel is a custom back-office UI separate from Django’s built-in admin.
- Its templates cover dashboard analytics, product/category/color management, coupon and offer CRUD, order review, user blocking, and sales reporting.
- This is a separate operational interface for staff/superusers, not just a model registry.
10. Shared UI and presentation layer
- The templates/ tree is split by domain (core, products, user, userauths, admin) plus reusable partials and components.
- That layout indicates multiple Django view layers rendering to a shared presentation system, with no standalone frontend application.
- Bootstrap and JavaScript are used for interactivity, but the app remains server-driven.
11. Persistence and data model boundaries
- The project uses Django ORM migrations across each app, with development SQLite and production PostgreSQL supported via environment config.
- Business data is split by domain: identity in userauths, profile/address in user, commerce entities in products, and payment records in payment.
- This separation is important for diagramming because the same user flows cross several app-owned tables.
12. External services and infrastructure
- Cloudinary is used for media storage/CDN, so product and profile images are not handled as local durable files.
- SMTP handles account activation and password reset emails.
- Razorpay handles external payment authorization, while WeasyPrint and OpenPyXL generate PDFs and spreadsheets for invoices and sales reports.
13. Event and side-effect handling
- products/signals.py indicates some domain actions are reactive rather than only request-driven, likely for wallet/refund/referral/order updates.
- This means certain state transitions probably trigger cross-model side effects after save events, not just inside views.
- For an architecture diagram, this is the main “implicit” flow to show between orders, wallet/refunds, and referral accounting.
14. Operational deployment boundary
- The project is configured for standard Django deployment via WSGI/ASGI, with environment variables in .env.
- Static files are local, while media storage is externalized; the intended production stack is Django behind a web server with PostgreSQL and Cloudinary-backed media.
Main entry points: urls.py Root URLs · settings.py Settings · admin_panel Admin panel · products Products
Components 23
Runtime
Django entry points and deployment configuration.
- manage.py · Django command-line entry point.
campeon/manage.py - Settings · Project configuration, apps, middleware, database, and environment settings.
campeon/campeon/settings.py - Root URLs · Top-level request routing into the Django apps.
campeon/campeon/urls.py - WSGI/ASGI · Web and async deployment entry points.
campeon/campeon/wsgi.py
Public site
Server-rendered storefront pages and shared templates.
- Shared templates · Reusable server-rendered templates, partials, and components.
campeon/templates - Core · Home, shop, about, contact, and 404 handling.
campeon/core - Query tags · Utility tag for preserving query parameters in navigation.
campeon/core/templatetags/query_transform.py
Identity
Authentication and customer account boundaries.
- Auth · Sign-in, sign-up, activation, password reset, and OTP flows.
campeon/userauths - Account model · Custom account record with referral, activation, and profile fields.
campeon/userauths/models.py - Profile · Addresses, profile edits, referrals, and account utilities.
campeon/user - Address book · Shipping address and customer state managed by the user app.
campeon/user/models.py
Commerce
Catalog, cart, checkout, orders, and payment flows.
- Products · Catalog, cart, wishlist, orders, coupons, offers, wallet, and order state.
campeon/products - Catalog data · Core product, variant, category, cart, wishlist, order, coupon, and wallet models.
campeon/products/models.py - Pricing rules · Offer selection and business logic for discounts and pricing.
campeon/products/offer_service.py - Domain signals · Reactive side effects for order, wallet, refund, and referral updates.
campeon/products/signals.py - Payment · Payment order creation, verification, and payment status reconciliation.
campeon/payment - Payment service · Encapsulates payment processing and provider integration.
campeon/payment/services.py
Operations
Staff-facing back office and reporting.
- Admin panel · Custom staff dashboard for products, coupons, offers, orders, users, and reports.
campeon/admin_panel
External services
Third-party services and infrastructure used by the app.
- Cloudinary · External media hosting for images and assets.
- Razorpay · External payment authorization provider.
- SMTP mail · Outbound email for activation and password reset.
- PostgreSQL · Primary production database supported by environment config.
- Reports export · PDF and spreadsheet generation for invoices and sales reports.
Connections 29
- manage.py → Settings: loads · Django CLI uses project settings.
- Settings → PostgreSQL: connects · ORM persistence targets the relational database.
- Settings → Cloudinary: stores media · Image and asset handling is externalized.
- Settings → SMTP mail: sends mail · Activation and reset emails use SMTP.
- Settings → Razorpay: integrates · Checkout config enables payment provider integration.
- Root URLs → Core: routes to · Public informational pages.
- Root URLs → Auth: routes to · Authentication and account flows.
- Root URLs → Profile: routes to · Profile, addresses, referrals, and wallet pages.
- Root URLs → Products: routes to · Catalog, cart, wishlist, and checkout flows.
- Root URLs → Payment: routes to · Payment completion and status pages.
- Root URLs → Admin panel: routes to · Custom staff back-office routes.
- Core → Shared templates: renders · Uses the shared server-rendered presentation layer.
- Core → Query tags: uses · Preserves filter state in shop navigation.
- Auth → Account model: owns · Authentication boundary and custom account data.
- Auth → SMTP mail: email flows · Activation and password reset messages.
- Profile → Address book: owns · Customer address book and profile state.
- Profile → Account model: extends · Profile and referral flows depend on account identity.
- Products → Catalog data: owns · Primary commerce data model.
- Products → Pricing rules: uses · Offer and discount resolution.
- Products → Domain signals: emits · Order and wallet side effects.
- Pricing rules → Catalog data: reads · Pricing decisions depend on catalog and variant data.
- Payment → Payment service: uses · Payment processing is isolated in a service layer.
- Payment service → Razorpay: calls · External authorization and verification.
- Payment → Catalog data: updates orders · Final payment state reconciles with order records.
- Domain signals → Catalog data: updates · Reactive order, refund, wallet, and referral state changes.
- Admin panel → Products: manages · Staff CRUD and review of catalog and orders.
- Admin panel → Profile: manages · User blocking and account operations.
- Admin panel → Payment: reviews · Operational visibility into payment/order status.
- Admin panel → Reports export: exports · Sales reports and invoices are generated as documents.