Haude Tea — Full-Stack E-Commerce Platform
Tech Stack Versions
Precise technology versions used in this project
Screenshots
Main feature screens of the project
Homepage Hero — Brand identity & call-to-action
Full Homepage — Farm features, news, responsive design
Login Page — JWT + Google OAuth dual authentication
Farm Experience — Tour booking & seasonal events
Product Catalog — Search, category filter, sorting, sale badges
Admin Dashboard — 14-module management panel, KPI overview, revenue trends
Admin Login — Google OAuth admin-only authentication
System Architecture
3-tier caching strategy and data flow architecture
Performance Metrics
Lighthouse scores and Core Web Vitals measurements
Lighthouse Scores
Core Web Vitals
Capabilities Demonstrated
Technical and business capabilities demonstrated through this project
- ECPay Taiwan-Native Payments — Credit card, ATM virtual account, and convenience store code payments with SHA256 MAC signature verification (built on the API, not yet enabled in the live store)
- 4-Tier Membership Loyalty — NORMAL → BRONZE → SILVER → GOLD auto-progression with purchase-based points and tier multipliers
- JWT Token Rotation Security — Auth0-inspired refresh token rotation with reuse detection, crypto-random tokens stored in database
Challenges Faced
Main technical challenges encountered during development
- Taiwan ECPay has no official TypeScript SDK — community packages are unmaintained with opaque MAC verification logic
- Complex order lifecycle management (7 states × multiple actors × inventory / discount / points coordination)
- JWT token security: refresh token rotation with reuse detection mechanism design
- Monorepo build orchestration across 3 heterogeneous apps (Next.js + Vite + NestJS) with type synchronization
- Passing 3 independent security audit rounds covering TOCTOU, console leaks, plaintext passwords, and 12 security practices
Solutions
Technical solutions and implementation strategies adopted
- Built custom Payment Module split into 5 sub-services (checkout / callback / virtual-account / cvs / webatm) with fully auditable SHA256 MAC verification
- Applied Facade Pattern to split orders into 7 single-responsibility sub-services (each < 200 lines), independently testable and extensible
- Implemented Auth0-inspired token rotation: crypto-random refresh tokens in database with reuse detection that revokes all user tokens on compromise
- Built @haude/types shared package with Turborepo smart cache, 33 error codes catch inconsistencies at compile time
- Pattern-first security approach: grep entire codebase → fix pattern-wide → verify with round-by-round matrix
Code Snippets
Key implementation code from the project
// modules/payments/services/payment-callback.service.ts
private verifyCheckMacValue(
data: Record<string, string>,
receivedMac: string,
): boolean {
// 1. Sort params by key per ECPay spec
const sorted = Object.keys(data)
.sort()
.map((key) => `${key}=${data[key]}`)
.join('&');
// 2. Prepend HashKey / append HashIV
const raw = `HashKey=${this.hashKey}&${sorted}&HashIV=${this.hashIV}`;
// 3. URL encode → lowercase → SHA256
const encoded = encodeURIComponent(raw).toLowerCase();
const hash = createHash('sha256')
.update(encoded)
.digest('hex')
.toUpperCase();
return hash === receivedMac;
}Architecture Decisions
Key architectural and technical decisions made during development
Context
Need to maintain storefront (Next.js), admin dashboard (Vite SPA), and backend API (NestJS) simultaneously, with shared type definitions and error codes.
Options Compared
- Independent team deployment
- CI pipelines don't affect each other
- Type synchronization is difficult
- Requires additional private npm package management
- Cross-project refactoring is costly
- Shared types sync instantly
- Unified build and CI pipeline
- Turborepo smart cache accelerates builds
- More complex initial setup
- Monorepo feels heavy for solo development
Decision
Chose Monorepo: @haude/types shared package propagates type changes instantly across 3 apps, 33 error codes catch inconsistencies at compile time
Outcome
Zero missed type changes, unified pnpm dev starts all 3 services, CI validates in dependency order
Technical Highlights
In-depth technical implementation details and architecture design
pnpm + Turborepo Unified 3-App Management
- @haude/types shared package — tsup dual output (ESM+CJS)
- 33 standardized error codes shared across apps, compile-time inconsistency detection
- Turborepo smart build cache with dependency-ordered validation
Next.js 15 App Router + Server Components
- 63% Server Components — SSR optimized initial load
- 4-page Suspense Streaming — Progressive loading experience
- 94 React components + 21 custom Hooks + 4 Zustand Stores
NestJS 11 Modular Enterprise Backend
- 20 business modules, 39 Services — Facade Pattern for complex logic
- 5 Guards (JWT / OAuth / Roles / CSRF / Throttler) security pipeline
- Swagger auto-generates docs for 160 REST API endpoints
Prisma 7 + PostgreSQL Relational Models
- 29 Prisma Models — Full relations with cascade deletes
- Order 7-state flow (pending → delivered / cancelled → refunded)
- Membership level history tracking + points transaction records
Key Takeaways
Important lessons and reflections from this project
NestJS Decorator + Interceptor pattern adds cross-cutting concerns (audit, caching, performance monitoring) declaratively, keeping controllers focused on business logic
Real Impact: Adding @AuditLog or @Cacheable requires just one decorator line without modifying business code, drastically reducing maintenance cost
Monorepo's real value isn't code sharing but type sharing — @haude/types keeps 33 error codes and DTOs consistent across 3 apps at compile time, with type changes auto-propagating
Real Impact: Zero missed type changes across 3 apps, greatly boosted refactoring confidence, cross-app inconsistencies caught before deployment
Security audit success depends on Pattern-First fixes — when finding one vulnerability, immediately grep the entire codebase for all instances of that pattern and fix them all at once
Real Impact: Completed all security fixes within 3 rounds achieving 5/5 security score, avoiding the inefficiency of repeated audit cycles
Interested in this project?
Feel free to reach out to discuss similar technical solutions or how I can help with your project.
Contact Me