Back to projects
2026Full Stack & AppSec Developer

PetShop Pro — Zero-Trust Corporate E-Commerce with Django & Angular 22

Corporate e-commerce platform in Django 5.2, zoneless Angular 22, MySQL, and Celery/Redis: Zero-Trust checkout, idempotency, PAID_AFTER_CANCEL, HttpOnly JWT with single-flight refresh, and 106 passing tests.

  • Python 3.13
  • Django 5.2
  • Django REST Framework
  • MySQL 8
  • Celery
  • Redis
  • Angular 22
  • TypeScript
  • Tailwind CSS
  • Vitest
  • GitHub Actions
Architecture diagram of PetShop Pro connecting zoneless Angular 22, Zero-Trust checkout, Django REST Framework, compensating transactions, Celery/Redis, and 106 tests

Problem

Many custom e-commerce builds work fine in happy-path demos but fail under real Argentine retail conditions: frequent price updates, concurrent competition for limited stock, duplicate payment retries during brief network drops, and abandoned checkouts.

PetShop Pro was engineered from scratch as a corporate pet food and supplies e-commerce platform combining bank-grade transactional integrity on the backend with a fast, accessible, low-friction storefront on the frontend.

Architecture and decisions

Decoupled full stack system powered by Python 3.13, Django 5.2, Django REST Framework, MySQL 8, and Celery + Redis paired with a zoneless Angular 22 Standalone, strict TypeScript, and Tailwind CSS SPA:

Zero-Trust checkout, compensation & idempotency

  • Live server-side quoting before charging: the client never submits trusted prices. Entering checkout syncs the cart against /api/orders/quote/; if prices or inventory shifted while browsing, the UI surfaces the exact delta and requires explicit user confirmation.
  • Fingerprint-bound idempotency: every purchase attempt attaches an Idempotency-Key bound to the order fingerprint, preventing duplicate charges or stock locks across double-clicks and retries.
  • Compensating transactions & PAID_AFTER_CANCEL: MySQL inventory reservations are decoupled from external gateway calls. Gateway failures trigger automatic stock-restoring compensations, while legitimate late webhooks arriving after order expiry transition the order into an auditable PAID_AFTER_CANCEL state instead of silently losing funds.
  • Decoupled Payments (Strategy Pattern): extensible payment architecture supporting Mercado Pago, cards, digital wallets, and bank transfers—dynamically enabling only environment-active providers (sandbox / live) with cryptographic webhook verification plus Celery + Redis async notifications and reservation expiry.
// Idempotent checkout payload anchored to the server's Zero-Trust quote
export interface CheckoutOrderRequest {
  readonly idempotencyKey: string;
  readonly quoteHash: string;
  readonly paymentStrategy: 'mercadopago' | 'card' | 'wallet' | 'transfer';
}

End-to-end AppSec & conversion-focused accessible UX/UI

  • Hardened sessions & credential hygiene: short-lived JWTs (15 min) in HttpOnly cookies (XSS-resistant), token_version rotation for immediate revocation, and a single-flight Angular HTTP interceptor preventing concurrent 401 refresh race conditions. Password resets pass tokens via # fragments purged immediately with history.replaceState (preventing Referer/log leaks), paired with Open Redirect defense (returnUrl) and real image inspection via Pillow.
  • Leak-free funnel & WCAG AA: replaced early login walls with a public Slide-Over Cart (CartDrawer) requiring sign-in only at payment while preserving /checkout. Added reactive search (debounceTime(300) + switchMap), Skeleton Loaders, full /catalogo/:id product pages, Plus Jakarta Sans with tabular-nums for ARS pricing, uniform SVG icons, aria-live regions, keyboard-accessible custom modals (Escape), and prefers-reduced-motion.

Challenges

  • Consistency across local reservations and external gateways: avoiding long-held database locks during payment gateway HTTP round-trips without permitting oversells or dropping late-settled payments (PAID_AFTER_CANCEL), while verifying every webhook signature cryptographically.
  • Concurrent token refresh & bundle discipline: coordinating parallel requests inside zoneless Angular 22 via a single-flight interceptor to avoid 401 refresh storms, while consolidating the design system to shrink global CSS and keep compressed initial loads under 100 kB.

Outcomes

  • 106 automated tests passing (100%): 55 Django integration & security tests plus 51 Vitest / Angular unit specs.
  • Strict static & CI/CD security gates: strict: true + strictTemplates: true, accessibility-aware eslint with 0 errors / 0 warnings, clean manage.py check --deploy, and hardened GitHub Actions CI verifying migrations, pip check, npm audit, Gitleaks secret scanning, lint, tests, and production builds.
  • Measured frontend optimization: 26.6% reduction in global stylesheet size (46.63 kB → 34.24 kB) and compressed initial load under 100 kB via route-level lazy loading.

A full walkthrough covering the reactive catalog, public CartDrawer, Zero-Trust checkout, and operational flows is available via the Video demo link in the header and sidebar. Proprietary codebase reserved for commercial licensing.