Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Invoicing, Time tracking, File reconciliation, Storage, Financial Overview & your own Assistant made for Freelancers

License

Notifications You must be signed in to change notification settings

Nicholas0350/nicholas

 
 

Repository files navigation

hero

Midday

Run your business smarters

Discord · Website · Issues

Supabase

About Midday

Midday is an all-in-one tool designed to help freelancers, contractors, consultants, and solo entrepreneurs manage their business operations more efficiently. It integrates various functions typically scattered across multiple platforms into a single, cohesive system.

Features

Time Tracking: Allows for live time tracking of projects to boost productivity and collaboration, providing insightful project overviews.
Invoicing: Create web-based invoices with a visual editor, real-time collaboration, PDF generation, tax override system, and invoice search capabilities.
Magic Inbox: Automatically matches incoming invoices or receipts to the correct transactions, simplifying financial tracking and organization. Includes Gmail integration for seamless email processing.
Vault: Secure storage for important files like contracts and agreements, keeping everything in one place for easy access. Includes file deletion safety warnings.
Transaction Management: Advanced filtering system, inline editing, transaction categorization, and bulk export to CSV/XLSX with customizable settings and email delivery to accountants.
Invoice Products: Full-featured product catalog with autocomplete, reusable templates, and usage tracking for efficient invoice creation.
Bank Connections: Multi-provider support including GoCardLess (EU), Plaid (Canada/US), Teller (US), and Enable Banking (EU) for comprehensive account aggregation.
Assistant: Provides tailored insights into financial situations, helping users understand spending patterns, cut costs, and find documents.

Recent Updates (October 2025)

New Features

  1. Transaction Filtering System - Advanced filter capabilities for transaction management with improved search and filtering UI
  2. Transaction Inline Editing - Edit transactions directly from the transaction list without opening a modal
  3. Invoice Search - Search functionality to quickly find invoices by various criteria
  4. Gmail Integration - Connect Gmail account for automated invoice and receipt processing through Magic Inbox
  5. Tax Override Feature - Manual VAT/tax calculation overrides for invoices with automatic tax rate resolution
  6. Export Settings & Transaction Export - Enhanced export capabilities with CSV/XLSX formats, configurable delimiters, and optional email delivery to accountants
  7. Enable Banking Integration - Complete integration with Enable Banking provider for European bank connections with JWT-based security
  8. Invoice Products Management - Full product catalog system with autocomplete, reusable templates, and usage tracking
  9. Bulk Invoice Operations - Download multiple invoices at once and perform bulk actions on invoice lists
  10. Category Management Refactor - Modernized category management with improved forms, parent category selection, and better UX
  11. Invoice Summary & Multi-Currency Support - Enhanced invoice summary calculations with automatic multi-currency totals
  12. Vault File Deletion Safety - Warning dialogs when deleting vault files to prevent accidental deletions
  13. Teams API Endpoint - New REST API endpoint for team management operations

Infrastructure & Improvements

  • CASA Implementation - Enhanced middleware architecture with advanced routing rules and improved security headers
  • SEO Optimization - Blog URL migration (/blog/ → /updates/) and metadata enhancements
  • Country Selector UX - Improved popover z-index and portal support
  • Middleware Stability - Locale cookie handling and edge case fixes
  • Realtime Data Synchronization - Improved realtime data updates across the application
  • Global Sheets Management - Centralized sheet management system for better state handling
  • Search Query Improvements - Enhanced search functionality across the application

Get started

We are working on the documentation to get started with Midday for local development: https://docs.midday.ai

Local Development Setup

Prerequisites

  • Bun installed
  • Node.js v22+ (for tsx)
  • A Supabase project (free tier works)

1. Clone and Install

git clone [email protected]:Nicholas0350/nicholas.git midday
cd midday
bun install

2. Supabase Setup

Create a new Supabase project at https://supabase.com/dashboard

Enable Required Extensions

Run in Supabase SQL Editor:

CREATE EXTENSION IF NOT EXISTS vector;
CREATE EXTENSION IF NOT EXISTS pg_trgm;

Create Required Functions

Run in Supabase SQL Editor:

-- nanoid function
CREATE OR REPLACE FUNCTION nanoid(size int DEFAULT 21)
RETURNS text AS $$
DECLARE
  id text := '';
  i int := 0;
  alphabet char(64) := '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_';
  bytes bytea := gen_random_bytes(size);
  byte int;
BEGIN
  WHILE i < size LOOP
    byte := get_byte(bytes, i);
    id := id || substr(alphabet, (byte & 63) + 1, 1);
    i := i + 1;
  END LOOP;
  RETURN id;
END
$$ LANGUAGE plpgsql VOLATILE;

-- generate_inbox function
CREATE OR REPLACE FUNCTION generate_inbox(size int DEFAULT 10)
RETURNS text AS $$
BEGIN
  RETURN nanoid(size);
END
$$ LANGUAGE plpgsql VOLATILE;

-- extract_product_names function
CREATE OR REPLACE FUNCTION extract_product_names(products json)
RETURNS text AS $$
DECLARE
  result text := '';
BEGIN
  IF products IS NOT NULL THEN
    SELECT string_agg(p->>'name', ' ') INTO result
    FROM json_array_elements(products) AS p;
  END IF;
  RETURN COALESCE(result, '');
END
$$ LANGUAGE plpgsql IMMUTABLE;

-- generate_inbox_fts function
CREATE OR REPLACE FUNCTION generate_inbox_fts(display_name text, product_names text)
RETURNS tsvector AS $$
BEGIN
  RETURN to_tsvector('english', COALESCE(display_name, '') || ' ' || COALESCE(product_names, ''));
END
$$ LANGUAGE plpgsql IMMUTABLE;

-- Create private schema and auth function
CREATE SCHEMA IF NOT EXISTS private;

CREATE OR REPLACE FUNCTION private.get_teams_for_authenticated_user()
RETURNS SETOF uuid AS $$
BEGIN
  RETURN QUERY
  SELECT team_id FROM users_on_team WHERE user_id = auth.uid();
END
$$ LANGUAGE plpgsql SECURITY DEFINER STABLE;

Push Database Schema

cd packages/db
DATABASE_SESSION_POOLER="postgresql://postgres:[PASSWORD]@db.[PROJECT_ID].supabase.co:5432/postgres" npx drizzle-kit push --force

If drizzle-kit has connection issues, run the migration SQL directly in Supabase SQL Editor:

  1. Copy contents of apps/api/migrations/0000_bumpy_chat.sql
  2. Remove the first 3 comment lines and --> markers
  3. Run in SQL Editor

3. Environment Variables

API (apps/api/.env.local)

# Supabase
SUPABASE_URL=https://[PROJECT_ID].supabase.co
NEXT_PUBLIC_SUPABASE_URL=https://[PROJECT_ID].supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=[ANON_KEY]
SUPABASE_SERVICE_KEY=[SERVICE_ROLE_KEY]
SUPABASE_JWT_SECRET=[JWT_SECRET]

# Database
DATABASE_PRIMARY_URL=postgresql://postgres:[PASSWORD]@db.[PROJECT_ID].supabase.co:5432/postgres

# Local Development
PORT=3003
NEXT_PUBLIC_URL=http://localhost:3001
NEXT_PUBLIC_API_URL=http://localhost:3003
ALLOWED_API_ORIGINS=http://localhost:3001,http://localhost:3000

# Engine
ENGINE_API_KEY=secret
ENGINE_API_URL=http://localhost:3002

# Invoice
INVOICE_JWT_SECRET=secret

# Webhook
WEBHOOK_SECRET_KEY=[RANDOM_UUID]

Dashboard (apps/dashboard/.env.local)

# Supabase
NEXT_PUBLIC_SUPABASE_URL=https://[PROJECT_ID].supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=[ANON_KEY]
SUPABASE_SERVICE_KEY=[SERVICE_ROLE_KEY]
SUPABASE_URL=https://[PROJECT_ID].supabase.co

# Local Development
NEXT_PUBLIC_URL=http://localhost:3001
NEXT_PUBLIC_API_URL=http://localhost:3003

# Engine
ENGINE_API_KEY=secret
ENGINE_API_URL=http://localhost:3002

# Invoice
INVOICE_JWT_SECRET=secret

# Webhook
WEBHOOK_SECRET_KEY=[RANDOM_UUID]

4. Get Supabase Credentials

From Supabase Dashboard:

  • Project URL: Settings → General → Project URL
  • Anon Key: Settings → API Keys → Legacy anon, service_role API keys → anon key
  • Service Role Key: Settings → API Keys → Legacy anon, service_role API keys → service_role key
  • JWT Secret: Settings → JWT Keys → Legacy JWT Secret
  • Database Password: Settings → Database → Connection string (click Connect button)

5. Configure Authentication

For email/password auth (simplest):

  • Go to Authentication → Providers → Email
  • Enable email provider

For Google OAuth:

  • Go to Authentication → Providers → Google
  • Add Google OAuth credentials
  • Set redirect URL to http://localhost:3001

6. Run Development Servers

Option A: Run all services

bun run dev

Option B: Run services separately

API (uses tsx/Node.js to avoid Bun DNS issues):

cd apps/api
npx tsx src/index.ts
# Runs on http://localhost:3003

Dashboard:

cd apps/dashboard
bun run dev
# Runs on http://localhost:3001

Engine (if needed for bank connections):

cd apps/engine
bun run dev
# Runs on http://localhost:3002

7. Login & Authentication

Development Login (Recommended for Local Dev)

The dashboard includes a dev-only password bypass for quick local testing:

  1. Go to http://localhost:3001
  2. You'll see a dev login form with pre-filled credentials:
  3. Click "Sign in" - this bypasses email verification for local development

Note: This dev login only works in NODE_ENV=development and is automatically disabled in production.

Production Login Methods

For production-like testing, use one of these methods:

Email/Password:

  1. Go to http://localhost:3001
  2. Enter your email
  3. Check your email for the magic link
  4. Click the link to sign in

Google OAuth (if configured):

  1. Click "Sign in with Google"
  2. Authorize with your Google account
  3. You'll be redirected back to the dashboard

First-Time Setup

After logging in:

  1. You'll be prompted to create a team (or you'll be added to an existing one)
  2. Complete your profile information
  3. Start using the dashboard at http://localhost:3001

Seeding Test Data

To populate your local database with test data for development:

# Connect to your Supabase database
psql -h localhost -U postgres -d midday < supabase/seed.sql

# Or run the seed script directly
cd supabase
psql -h db.[PROJECT_ID].supabase.co -U postgres -d postgres < seed.sql

The seed script creates:

  • Test user account
  • Sample team ("Test Company")
  • Transaction categories (income, expenses, etc.)
  • Bank connection and accounts
  • 12 months of sample transactions for charts

After seeding, the dashboard charts (Revenue, Profit, Burn Rate, Expense) will display with realistic data.

Troubleshooting

Bun DNS errors: Use npx tsx instead of bun to run the API:

cd apps/api && npx tsx src/index.ts

CORS errors: Ensure ALLOWED_API_ORIGINS in API .env.local includes your dashboard URL.

Auth errors: Make sure you're using the Legacy JWT-format keys from Supabase, not the new sb_publishable_* format.

Database schema missing: Run the SQL functions above, then push the schema with drizzle-kit or run the migration SQL directly.

App Architecture

  • Monorepo
  • Bun
  • React
  • TypeScript
  • Nextjs
  • Supabase
  • Shadcn
  • Tauri
  • Expo
  • TailwindCSS

Hosting

  • Supabase (database, storage, realtime, auth)
  • Vercel (Website, Dashboard)
  • Fly.io (API/tRPC)

Services

  • Trigger.dev (background jobs)
  • Resend (Transactional & Marketing)
  • Github Actions (CI/CD)
  • GoCardLess (Bank connection EU)
  • Plaid (Bank connection in Canada and US)
  • Teller (Bank connection in the US)
  • Enable Banking (Bank connection EU)
  • OpenPanel (Events and Analytics)
  • Polar (Payment processing)
  • Typesense (Search)
  • Mistral
  • Gemini
  • OpenAI

Repo Activity

Alt

License

This project is licensed under the AGPL-3.0 for non-commercial use.

Commercial Use

For commercial use or deployments requiring a setup fee, please contact us for a commercial license at [email protected].

By using this software, you agree to the terms of the license.

About

Invoicing, Time tracking, File reconciliation, Storage, Financial Overview & your own Assistant made for Freelancers

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 97.2%
  • MDX 1.9%
  • Rust 0.6%
  • CSS 0.2%
  • JavaScript 0.1%
  • PLpgSQL 0.0%