How midday-ai/midday works
Main Components
• Frontend Applications:
– Dashboard (a Next.js React app with a heavy UI focus using shadcn, TailwindCSS, and a rich set of React components)
– Website (public-facing Next.js site with marketing and content functionality)
– Mobile (built using Expo + ToDesktop integration)
• Backend Services:
– API (handles environment variables, Supabase functions, and custom endpoints)
– Engine (deals with provider integrations, routing for bank connections, messaging, and transformations)
• Shared Packages/Libraries:
– App-store, Documents, Email, Events, Import, Inbox, Invoice, Kv, Location, Notification, Supabase, UI, and Utils.
These components serve as the foundational libraries and business logic shared across apps.
• Infrastructure and External Services:
– Database & Storage: Supabase (database, storage, realtime, auth)
– Deployment & Edge: Vercel (edge-config and metrics)
– Cache & Messaging: Upstash (redis)
– Background Jobs: Trigger.dev
– Email and Notifications: Resend, Novu
– Bank Connection Providers: GoCardLess, Plaid, Teller
– Other Integrations: OpenPanel (events/analytics), Dub (short URLs), Polar (payment processing), Typesense (search)
• CI/CD and DevOps:
– GitHub Actions for various deployment pipelines and workflows (seen in the workflows folder).
Relationships and Interactions
• Frontend-to-Backend Communication:
– The Dashboard, Website, and Mobile apps interact with the API endpoints as well as the Engine. APIs might also handle authentication which connects with Supabase.
• Package and Shared Library Usage:
– Common libraries (from packages folder) are imported by multiple apps to handle functionalities like invoicing, document processing, and notifications.
– The Engine leverages provider-specific packages (for GoCardless, Plaid, Teller, etc.) to perform bank connection tasks.
• External Service Integration:
– Database operations and storage are managed via Supabase.
– External APIs and integrations connect via API connectors residing in the Engine and shared packages (e.g., for financial calculations, bank feeds).
• CI/CD Integration:
– GitHub Actions pipelines ensure that pushes, previews, and production deployments are handled consistently across different apps in the monorepo.
• Communication between Microcomponents:
– Trigger.dev runs background jobs (such as importing transactions, synchronizing bank feeds) that communicate with the API and Dashboard.
– Use of shared packages ensures modularity: for example, the UI package provides consistent components across all React apps.
Architectural Patterns and Design Principles
• Monorepo Structure:
– Clear separation by creating dedicated folders for apps and packages, promoting code sharing and reusability.
• Frontend-Backend Separation:
– Multiple frontend applications are clearly separated from backend services, but communicate through clearly defined APIs.
• Provider Abstraction:
– The Engine and its provider subdirectories (enablebanking, gocardless, plaid, teller) abstract away integration logic, making it easier to manage multiple bank connection types.
• Modular and Reusable Components:
– Extensive use of a shared UI library and other utility packages helps reduce duplication.
• Dependency Injection & Configuration Files:
• Partition into layers or sections:
– A Top Layer for Frontend Applications, a Middle Layer for Business Logic / Backend Services (API and Engine), and a Bottom Layer for Data & External Integrations.
• CI/CD and Development Tools as auxiliary components interacting with the codebase and deployment pipelines.
• Out specific flows (e.g., how a bank connection request flows from the Dashboard to the API and then to the appropriate provider module in the Engine).