Skip to main content
Effect Coffee Shop is a reference application that demonstrates how to build a well-structured, full-stack TypeScript application using Effect v4 and Onion Architecture. It models a coffee ordering system — placing orders, tracking their status, and managing a menu — while keeping domain logic completely isolated from infrastructure concerns. The project runs as a REST HTTP API, a CLI tool, and an MCP (Model Context Protocol) server — all sharing the same core business logic through clean layer boundaries. A React frontend rounds out the experience with a live order dashboard and an on-device AI assistant.

Quickstart

Get the app running locally in minutes with Bun and Turborepo.

Architecture overview

Understand the Onion Architecture layers and how Effect powers them.

REST API reference

Explore every HTTP endpoint with request and response schemas.

MCP server

Connect AI agents to the coffee shop via the Model Context Protocol.

What’s inside

The project is organized as a Bun monorepo with two workspaces: a backend/ that implements the full server-side logic, and a ui/ that contains the React frontend.

HTTP API

Effect-typed REST endpoints with auto-generated OpenAPI spec.

CLI

Place orders, manage the menu, and run barista workflows from the terminal.

Frontend

React + TanStack Query UI with Storybook for component development.

Domain model

Menu items, coffee orders, and validated status transitions.

Key features

  • Onion Architecture — Domain, service, external, and presentation layers with explicit boundaries enforced by TypeScript path imports.
  • Effect v4 — Functional, composable error handling with typed failures across every layer.
  • Three presentation layers — HTTP (Effect HttpApi), CLI (Effect Command), and MCP server — all backed by the same application service.
  • Dual persistence — In-memory repositories for fast tests; SQLite-backed repositories for real runs.
  • On-device AI assistant — Hugging Face Transformers running in the browser, no API key required.
  • Cloudflare Workers — MCP server deployable to Workers via a Miniflare-tested Worker entrypoint.
This project is a learning reference and demo application, not a production SaaS. All architectural patterns and code examples are real — taken directly from the source.

Build docs developers (and LLMs) love