Tech Stack

Status: Accepted Owner: @bilal Last Updated: 2026-02-24

Overview

LayerTechnology
FrameworkNext.js 16 (App Router)
FrontendReact 19, Tailwind CSS 4, shadcn/ui, Apollo Client 4
BackendPrisma 6, Pothos (GraphQL schema), GraphQL Yoga 5
DatabaseSupabase PostgreSQL 16 + pgvector
AuthSupabase Auth (SSR, JWT)
StorageSupabase Storage
HostingCloudflare Workers (via @opennextjs/cloudflare)
Connection PoolCloudflare Hyperdrive
Auth Gate (ZTNA)Cloudflare Access (email OTP)
DNSCloudflare
AI (primary)Claude (Anthropic)
AI (fallback)OpenAI, Kimi, GLM
AI (embeddings)OpenAI text-embedding-3-small (1536 dim)
WhatsAppTwilio + Meta WhatsApp Cloud API
VoiceVAPI / Retell
SMSTwilio
EmailSendGrid
TestingVitest
CI/CDGitHub Actions
IaCTerraform Cloud + Cloudflare provider
Package managerpnpm

LLM Providers

ProviderModelRole
Claude (Anthropic)claude-sonnet-4Primary generation + tool use
OpenAIgpt-4oFallback generation
OpenAItext-embedding-3-smallEmbeddings (1536 dim)
Kimi (Moonshot)moonshot-v1-8kExperimental
GLM (Zhipu)glm-4-flashExperimental

Automatic fallback chain: Claude OpenAI Kimi GLM raw chunks.

Hosting & Infrastructure

ComponentServiceDomain
Marketing SiteCloudflare Pages (Astro + React)ehq.tech
DashboardCloudflare Workersapp.ehq.tech
Knowledge BaseCloudflare Pagesbrain.ehq.tech
DatabaseSupabase Cloud
AnalyticsPostHog Cloud EU (cookieless)
IaC stateTerraform Cloud

The dashboard runs on Cloudflare Workers via @opennextjs/cloudflare, which compiles the Next.js app to run on the workerd runtime. Database connections go through Cloudflare Hyperdrive for connection pooling using @prisma/adapter-pg.

The marketing site (envo-marketing/) is a separate Astro 5 static site with React islands (client:visible for lazy hydration) and Tailwind CSS 4. It deploys to Cloudflare Pages as pre-built static HTML. Analytics are handled by PostHog Cloud EU in cookieless mode — no cookies, no device storage, PECR-exempt.

Access is gated by Cloudflare Access (Zero Trust) using email OTP until the app goes public.

Development Principles

  • Data model first — Schema before implementation
  • Modular monolith — Single Next.js app, structured by domain
  • GraphQL over REST — Flexible queries, end-to-end type safety
  • Minimal DevOpsdev prod, no staging initially

Non-Functional Requirements

CategoryRequirement
PerformanceDashboard load < 1.5s, API < 500ms
ReliabilityZero dropped issues, retry queue for notifications
SecurityJWT auth, full RLS, prompt injection protection
Scalability3,000+ properties
Availability99.5% uptime target

Future Considerations

  • Multi-region (Supabase supports regional deployment)
  • Mobile app (React Native + Apollo Client)
  • GraphQL Federation (if monolith needs extraction)
  • Vector store migration (abstraction ready for Qdrant/Pinecone)
  • Remove ZTNA when going public (Terraform destroys Access app + policy)

See also: System Design, RAG Pipeline