Back to Projects
Live

Place of Treasure

Gift Shop E-Commerce with Configurable Gift Box Builder

Key Technical Highlights

GiftBoxItem join model — products composed into configurable gift box products with item selection constraints; purpose-built data model for the gift shop use case

Session-based guest carts using Upstash Redis — carts persist across sessions without login and merge cleanly into the user's cart on authentication

Custom JWT/jose authentication alongside Google OAuth — no NextAuth dependency, full control over session shape and token claims

Stripe Refunds API integrated into the returns workflow — refunds triggered programmatically on admin approval

Subcategory product taxonomy with filtering, search, wishlist, and promo codes — complete commerce feature set

The Case Study

Overview

Place of Treasure is a retail gift shop platform selling physical items, food, and customisable gift boxes. The data model had to be flexible enough to handle both standard products and composed gift box products — a non-trivial e-commerce problem.

The Gift Box Model

The standout technical decision is the GiftBoxItem join model. A gift box is not just a bundle — it's a configurable product where customers select which items to include, subject to constraints (minimum items, maximum items, category rules). The composed selection is stored as GiftBoxItem records linking the order to each selected product. This preserves the exact configuration for fulfilment, enables accurate inventory deduction per included item, and supports returns processing at the component level.

Guest Cart

Carts are session-based from the first product added. A guest shopping session is tied to a session ID stored in Upstash Redis with a TTL. On login or registration, the guest cart merges with the user's persistent cart — no items lost, no friction at the critical conversion moment. This was built with a custom JWT/jose auth setup (no NextAuth) giving full control over session shape and merge logic.

Auth Architecture

Rather than reaching for NextAuth, Place of Treasure implements custom JWT authentication using jose. This gave full control over token claims, refresh logic, and the guest-to-authenticated cart merge flow — a complexity that would have been awkward to express through NextAuth's session model.