Skip to main content

Overview

Midday is built as a modern monorepo using cutting-edge technologies designed for scalability, performance, and developer experience. The architecture follows a modular approach with multiple apps and shared packages.

Technology Stack

Core Technologies

  • Bun - Fast JavaScript runtime and package manager
  • Turbo - High-performance build system and monorepo tool
  • TypeScript - Type-safe JavaScript development
  • React 19 - UI library with latest features
  • Next.js 16 - Full-stack React framework
  • Supabase - Backend-as-a-service (database, auth, storage, realtime)

Key Libraries

  • Drizzle ORM - Type-safe database queries
  • tRPC - End-to-end typesafe APIs
  • Hono - Lightweight web framework for APIs
  • Zod - Schema validation
  • TailwindCSS - Utility-first CSS framework
  • Shadcn/ui - Accessible component library
  • AI SDK - AI integration (OpenAI, Google Gemini)

Applications

Midday consists of 5 main applications:
Main Application (apps/dashboard)The primary user-facing application built with Next.js 16.Key Features:
  • Time tracking and invoicing
  • Magic inbox for receipt matching
  • Vault for document storage
  • AI assistant for insights
  • Real-time collaboration
Tech Stack:
  • Next.js 16 with App Router
  • tRPC for API calls
  • React 19
  • Zustand for state management
  • TanStack Query for data fetching
Development:
bun dev:dashboard
# Runs on http://localhost:3001

Packages

Midday has 29+ shared packages organized in packages/:

Database & Storage

@midday/db

Database client, schema, and queries using Drizzle ORM

@midday/supabase

Supabase client utilities for auth, storage, and realtime

@midday/cache

Caching utilities and strategies

Business Logic

@midday/banking

Bank connection and transaction handling

@midday/invoice

Invoice generation and management

@midday/accounting

Accounting integration (Xero, QuickBooks, Fortnox)

@midday/documents

Document processing and storage

@midday/inbox

Receipt matching and processing

@midday/insights

Financial insights and analytics

Infrastructure

@midday/jobs

Background job definitions

@midday/job-client

Job client for Trigger.dev

@midday/logger

Structured logging with Pino

@midday/events

Event tracking and analytics

@midday/notifications

Notification system

Utilities

@midday/utils

Shared utility functions

@midday/encryption

Encryption utilities

@midday/location

Geolocation services

@midday/categories

Transaction categorization

UI & Components

@midday/ui

Shared UI components (Shadcn-based)

@midday/email

Email templates with React Email

Hosting & Infrastructure

1

Supabase

Services: Database (PostgreSQL), Storage, Realtime, AuthAll data is stored in Supabase with Row Level Security (RLS) policies for multi-tenancy.
2

Railway

Deployment: API, Worker, DashboardRegional replicas for low-latency database access.
3

Vercel

Deployment: Marketing websiteEdge deployment for optimal performance.
4

Cloudflare

Services: CDN, Proxy, Edge functions

External Services

Trigger.dev

Background job orchestration and scheduling

Resend

Transactional and marketing emails

GoCardless

Bank connections in EU

Plaid

Bank connections in US/Canada

Teller

Additional US bank connections

OpenPanel

Event tracking and analytics

Polar

Payment processing

Typesense

Full-text search

OpenAI & Gemini

AI capabilities

Architecture Patterns

Monorepo Structure

midday/
├── apps/
│   ├── dashboard/      # Next.js app
│   ├── api/            # Hono API
│   ├── website/        # Marketing site
│   ├── desktop/        # Tauri app
│   └── worker/         # Background jobs
├── packages/
│   ├── db/             # Database layer
│   ├── ui/             # Shared components
│   ├── banking/        # Banking logic
│   └── .../            # 25+ more packages
├── turbo.json          # Turbo config
└── package.json        # Workspace config

Data Flow

1

Client Request

User interacts with Dashboard (Next.js)
2

tRPC Call

Dashboard makes type-safe tRPC call to API
3

Business Logic

API executes business logic using shared packages
4

Database Query

Query Supabase using Drizzle ORM with RLS
5

Background Jobs

Heavy tasks queued to Worker via Trigger.dev
All applications share the same TypeScript packages, ensuring consistency and reducing duplication.

Development Workflow

Running All Apps

# Start all apps in parallel
bun dev

Running Specific Apps

# Dashboard only
bun dev:dashboard

# API only
bun dev:api

# Website only
bun dev:website

Building for Production

# Build all apps
bun build

# Build specific app
bun build:dashboard

Code Quality

# Lint all code
bun lint

# Format code
bun format

# Type check
bun typecheck

# Run tests
bun test
Use Turbo’s caching to speed up builds. Turbo automatically caches outputs and skips redundant work.

Next Steps

Database

Learn about the database schema and queries

Monorepo

Understand the monorepo structure

Contributing

Start contributing to Midday

Build docs developers (and LLMs) love