Skip to content

lloydrichards/base_bevr-stack

Repository files navigation

bEvr Stack

A modern full-stack TypeScript monorepo with end-to-end type safety, using Bun, Effect, Vite, and React. Heavily inspired by the bhvr stack but the addition of Effect and Turborepo. Includes a Model Context Protocol (MCP) server for AI assistant integrations.

Features

  • End-to-end TypeScript: Full type safety from client to server
  • Shared Domain: Common types and utilities across all apps
  • Effect Integration: Built for composable, functional programming with Effect
  • MCP Server: Model Context Protocol server for AI assistant tools and resources
  • Modern Tooling: Turborepo, Bun, Vite, and React
  • Zero Config: Pre-configured Ultracite for linting and formatting with Biome
  • Flexible Deployment: Deploy anywhere without vendor lock-in

Quick Start

# Install dependencies
bun install

# Start development
bun dev

# Build for production
bun build

Formatting and Linting

Format and lint the codebase using Ultracite:

# Format code
bun format

# Lint code
bun lint

# Type check
bun type-check

Testing

Run tests across the monorepo:

# Run all unit tests
bun run test

# Run tests for specific apps
bun run test --filter=client
bun run test --filter=server

# Run E2E and visual regression tests
bun run test:e2e

# Update visual regression baselines
bun run test:e2e -- --update-snapshots

Test Stack

  • Client: Vitest 4.x with Browser Mode (Playwright), vitest-browser-react
  • Server: Vitest 4.x with Node environment, @effect/vitest
  • E2E: Playwright with visual regression testing

CI/CD Workflows

Workflow Trigger Purpose
check-client PR + main Fast: lint, types, unit tests
check-server PR + main Fast: lint, types, unit tests
post-merge main only Slow: E2E, visual regression

Visual regression baselines are stored in e2e/smoke.spec.ts-snapshots/ and should be committed to git. Update them when UI changes are intentional.

Project Structure

.
├── apps/
│   ├── client/             # React frontend (Vite + React)
│   ├── server/             # Bun + Effect backend API
│   └── server-mcp/         # Model Context Protocol server
├── packages/
│   ├── config-typescript/  # TypeScript configurations
│   └── domain/             # Shared Schema definitions
├── docker-compose.yaml     # Docker Compose configuration for deployment
├── package.json            # Root package.json with workspaces
└── turbo.json              # Turborepo configuration

Apps

App Description
client A React app built with Vite
server A Effect Platform backend API
server-mcp A Model Context Protocol server built with Effect

Packages

Package Description
@repo/config-typescript TypeScript configurations used throughout the monorepo
@repo/domain Shared Schema definitions using Effect Schema used by both client and server

Development

# Start development server
bun dev
# Run specific app
bun dev --filter=client
bun dev --filter=server
bun dev --filter=server-mcp

# Build all apps
bun run build

# Test MCP server functionality
bun inspector --filter=server-mcp

Deployment

To run the application using Docker, you can use the provided docker-compose.yaml file.

First, ensure you have Docker and Docker Compose installed on your system.

Then, run the following command to build and start the services in the background:

docker-compose up -d --build

This will start all three services: client, server, and server-mcp.

Environment Variables

You can configure the deployment using environment variables:

# Example .env file
CLIENT_PORT=3000
SERVER_PORT=8000
MCP_PORT=9009

Type Safety

Import shared types from the domain package:

import { ApiResponse } from "@repo/domain";

Learn More

About

An evolution of the bvhr stack to include turborepo and effect for making end to end experiance more robust.

Resources

Stars

Watchers

Forks

Releases

No releases published