Skip to content
Return to Projects
Case Study

Brewhaus

An AI-driven specialty coffee marketplace for home enthusiasts.

The Problem

Home coffee enthusiasts struggle to find beans matched to their taste. Brewhaus profiles flavor with AI and recommends roasts that fit each palate — turning discovery into an interactive experience.

My Role

Built solo with AI-assisted development — SSR storefront, vector search, AI integration, and Dockerized deployment.

Highlights

  • Next.js 15 SSR storefront with gamification and subscription billing
  • pgvector semantic search powering AI-driven flavor profiling
  • Claude AI integration for personalized recommendations
  • Containerized with Docker and served via Cloudflare Tunnels

Stack

Next.js 15TypeScriptPostgreSQLpgvectorClaude AIDocker

Constraints

  • Self-hosted on a home server — no cloud bill, but also no auto-scaling.
  • Solo build, so the stack had to favour boring, well-documented pieces over novelty.
  • AI cost must stay bounded — recommendations had to use embeddings, not a per-request LLM call.

System Architecture

Edge
Cloudflare Tunnel
Application
Next.js 15 SSR
Subscriptions
Gamification
Intelligence
Claude AI
Flavor Profiler
Data
PostgreSQL
pgvector (semantic search)
Runtime
Docker

Key Trade-offs

The decisions worth defending — what I chose, what I turned down, and why.

Recommendation engine

Chose

pgvector similarity on cached embeddings

Rejected

LLM call per recommendation

Vector search is millisecond-fast and effectively free once embeddings are computed; LLMs would have added cost and latency per page view.

Public ingress

Chose

Cloudflare Tunnel

Rejected

Public VPS with open ports

No exposed origin IP, free TLS, and DDoS protection inherited from Cloudflare — much smaller attack surface for a self-hosted box.

Rendering model

Chose

Next.js 15 SSR

Rejected

Pure client-rendered SPA

Product pages need to be indexable and shareable; SSR gives fast first paint and clean OG cards without a separate prerender step.

What I'd Do Differently

An honest retrospective — the stuff I'd change with more time, more users, or a second pass.

  1. 1Move embedding generation to a background queue — synchronous calls during admin product writes briefly blocked the UI.
  2. 2Add a staging container that mirrors prod data shape so AI tuning doesn't happen against the live DB.
  3. 3Track recommendation quality with a click-through metric instead of relying on subjective spot-checks.

Technical Deep-Dive

Architecture, specifications, and implementation details.

01 · Executive Summary

Project: Brewhaus — Specialty Coffee Marketplace
Owner: Ice Legends Enterprises
Domain: brewhaus.icelegends.cloud
Stack: Next.js 15 · Docker · Cloudflare Tunnel · PostgreSQL + pgvector · Claude AI


#What Is Brewhaus

Brewhaus is a premium, fully interactive specialty coffee marketplace targeting Romanian home coffee enthusiasts. It is designed to stand apart from every existing competitor through three core differentiators:

  1. AI-powered discovery — A 5-question adaptive quiz powered by Claude Haiku builds a taste profile vector, which is matched against the product catalog using cosine similarity search via pgvector.

  2. Gamification — A Brew XP system with 5 levels (Bronze → Black), 9 badge types, and exclusive tier-based reward unlocks drives retention without discounts.

  3. Ice Cave aesthetic — A completely unique dark navy and glacial blue design language, with stalactite motifs, crystalline card borders, and Orbitron typography — unlike any coffee or e-commerce site in Romania.


#Business Goals

GoalTargetMeasure
Launch MVPQ3 2026Site live on icelegends.cloud
Monthly Active Users1,000 by month 3Analytics
Subscription conversion8% of visitorsStripe dashboard
AI quiz completion rate> 60%Event tracking
Average order valueRON 140+Order analytics
Page load (LCP)< 200msCore Web Vitals
Uptime99.9%Cloudflare Health Checks

#Platform Scope — 7 Pages

PageRouteKey Feature
Homepage/Hero + AI quiz widget + products
Shop/shopFull catalog, filters, search
Product Detail/shop/[slug]3D viewer, specs, brew guide
AI Recommender/quiz5-question Claude-powered quiz
Origins Map/originsInteractive SVG world map
Brew Guides/guides6 guides, XP rewards on completion
User Profile/profileXP dashboard, orders, badges

#Technology Decisions

##Why Docker + Cloudflare Tunnel?

The project runs fully containerised with no exposed server ports. All traffic enters via a Cloudflare outbound QUIC tunnel. This means:

  • No public IP required
  • No port forwarding on the router
  • DDoS protection via Cloudflare edge built in
  • TLS 1.3 enforced automatically
  • Works on any server (VPS, home lab, office machine)

##Why PostgreSQL + pgvector?

Storing taste profile embeddings and product embeddings in the same database as the product catalog eliminates the need for a separate vector database service. pgvector's <=> cosine distance operator handles similarity search with millisecond latency at our scale.

##Why Claude (Haiku + Sonnet)?

  • Haiku for the quiz: low latency, low cost, structured JSON output
  • Sonnet for brew guide generation: richer language, better recipe quality

#Key Performance Requirements

Page Load (LCP):          < 200ms
API Response (p95):       < 500ms
AI Quiz Response:         < 2 seconds
Vector Search:            < 50ms
Concurrent Users:         50,000 peak
Database Connections:     100 pooled via PgBouncer
Cache Hit Rate Target:    > 80% on product catalog
Uptime SLA:               99.9% (< 8.7 hours downtime/year)

#Team

RoleResponsible
ArchitectureIce Legends Enterprises
FrontendIce Legends Enterprises
Backend + APIIce Legends Enterprises
AI IntegrationIce Legends Enterprises
DevOps / DockerIce Legends Enterprises
Design SystemIce Legends Enterprises

Next: 02 — System Architecture →

~ End of Document ~