Shivam Kumar

Category · Commerce

Originoire

A server-rendered footwear store with product discovery, user accounts, carts, wishlists, checkout, order history, and admin tools.

Repository — access may be required · Architecture report

Node.js Express EJS MongoDB Firebase Stripe PayPal JWT

System architecture

flowchart LR
    U[Shopper or admin] --> E[Express app]
    E --> A[JWT authentication]
    A --> R[Store and admin routes]
    R --> V[EJS pages]
    R --> M[(MongoDB)]
    R --> F[Firebase Storage]
    R --> S[Stripe and PayPal]
    R --> N[Email service]

Request and data flow

  1. Express verifies the login cookie when present, loads the user, and renders an EJS page.
  2. Store routes query products and create temporary Firebase links for product images.
  3. Cart and wishlist routes validate products before updating MongoDB. Checkout totals are recalculated from current prices.
  4. Payment routes create Stripe or PayPal payments and order records, while admin routes manage products and homepage content.

Engineering highlights and trade-offs

  • Single web application: Rendering, authentication, catalog, admin, and payments live in one Express service. This is simple to deploy but tightly couples each feature.
  • Flexible products: Simple, variable, and custom products support variants, media, related items, and upsells.
  • Document storage: Separate MongoDB collections hold users, products, carts, orders, wishlists, and homepage data. Flexible JSON-like fields simplify product variants but reduce database validation.
  • Catalog limits: Product lists are paginated, but search loads the full catalog into Node.js. Database search would scale better.
  • Private media: Firebase produces expiring image links. This protects media but creates repeated storage calls because there is no application cache.

Testing, observability, and security

  • Testing: There is no automated test suite, coverage report, linter, or CI workflow.
  • Observability: The app uses console logs and basic error pages. Structured logging packages are installed but not connected.
  • Security: Passwords are hashed, JWTs are verified, order ownership is checked, totals come from server data, and media links expire. Before deployment, committed credentials and customer backups must be removed, keys rotated, cookies hardened, routes protected from CSRF and abuse, and Stripe payments verified server-side.