CP Core Template
As Co-founder & CTO of Curious Packet, I architected and built a proprietary, production-ready full-stack e-commerce platform engine — with dedicated design and frontend collaborators — using Next.js 15, Neon Serverless Postgres, Drizzle ORM, and AWS S3 — designed to be forked and customized per client. This single template now powers three live storefronts (Shopiko, Bab Al Bahar, Everest Communications), cutting time-to-launch from months of greenfield work to days of configuration.
The Challenge
As I scaled Curious Packet from a solo consultancy into a product studio, I was winning e-commerce contracts for small-to-mid-sized brands — but every project started from scratch. Each engagement meant re-implementing the same core systems: authentication, product catalogs, cart logic, checkout flows, admin dashboards, and media pipelines. This created three compounding problems:
Slow delivery cycles. Wiring up a database, auth layer, S3 bucket, and admin UI consumed the first 4–6 weeks of every project before any client-specific work could begin.
Inconsistent quality. Subtle differences between projects — different state patterns, validation approaches, or auth implementations — made context-switching error-prone and increased maintenance burden across the portfolio.
Scaling the business was impossible. I couldn't take on parallel client work because each project demanded undivided, bespoke engineering effort.
I needed a single, opinionated, enterprise-grade foundation that could be forked, themed, and deployed for any e-commerce client — without sacrificing performance or type safety.
The Solution — Technical Deep Dive
Choosing the Stack
Every technology choice was deliberate, optimized for edge-readiness, type safety, and developer velocity:
| Layer | Technology | Why |
|---|---|---|
| Framework | Next.js 15 (App Router + Turbopack) | React Server Components for SEO-optimal SSR; Turbopack for sub-second local HMR |
| Database | Neon Serverless Postgres | Edge-compatible serverless driver — queries execute in the same edge runtime as Next.js middleware, eliminating cold-start latency |
| ORM | Drizzle ORM | Zero-codegen, native TypeScript inference — a schema change surfaces type errors in downstream components instantly, no build step needed |
| Storage | AWS S3 + Imgix CDN | Pre-signed URL uploads bypass the server for large media; Imgix handles on-the-fly image transformations |
| Auth | bcryptjs + jose | Full control over session logic — edge-compatible JWT verification with zero per-user SaaS costs across all client deployments |
| Styling | Tailwind CSS v4 + Radix UI | Utility-first CSS with accessible headless primitives for rapid, consistent UI development |
| State | Zustand + SWR | Lightweight global state for cart/checkout with stale-while-revalidate data fetching |
| Validation | Zod + drizzle-zod + React Hook Form | Single schema definition shared from database to form — one source of truth |
Core Architecture Decisions
Authentication without third-party lock-in
Rather than depending on Auth0 or Clerk, I implemented a custom auth system using bcryptjs for password hashing and jose for JWT management. The trade-off was more upfront engineering, but the payoff was full control over session logic, edge-compatible token verification, and zero recurring per-user costs across all client deployments.
End-to-end schema validation
I unified the validation layer using Zod schemas shared between the Drizzle database definitions (via drizzle-zod), React Hook Form resolvers, and Next.js server actions. A single source of truth — one schema change propagates type errors from database column to checkout form field.
Media optimization with ThumbHash
Implemented ThumbHash to generate ultra-compact image placeholders at build time, delivering a perceived-instant loading experience without the bandwidth cost of blurred base64 previews that plagued earlier projects.
Key Modules Built
Storefront Engine
Dynamic product routing, Zustand-powered cart with schema-validated state, and a multi-step checkout flow with server-side order finalization.
Admin Dashboard
Role-protected routes with Recharts-powered sales analytics, @dnd-kit drag-and-drop for category/image reordering, and TanStack Table for paginated data management.
Seeding Pipeline
Authored db:seed scripts using Faker.js to provision realistic product, order, and user data — enabling instant demo environments for client pitches.
Transactional Email System
Component-driven email templates with React Email and Resend, ensuring order confirmations and auth flows render consistently across email clients.
My Role & Workflow
Co-founder & CTO — I designed, built, and maintain this template end-to-end as the technical foundation of Curious Packet's service offering.
Results & Impact
The template enabled Curious Packet to take on parallel engagements — turning what was sequential, bespoke work into a scalable product-led service model.
Key Learnings
Invest in foundations early.
The upfront cost of building a reusable template was significant, but it paid for itself by the second client project. Every subsequent engagement started weeks ahead.
Edge-first architecture is non-negotiable for e-commerce.
Choosing edge-compatible tools (Neon, jose, Next.js middleware) from the start avoided painful migrations later when performance became a competitive differentiator.
Type safety is a force multiplier for small teams.
With Drizzle + Zod + TypeScript, I catch the vast majority of bugs at the type level before running the app. Critical when maintaining multiple client forks simultaneously.
Own your auth when you own the platform.
Third-party auth simplifies individual projects but becomes a cost and flexibility bottleneck when deploying the same system for many clients.