Archicise
Exercise

Design a tRPC API for SaaS Dashboard

Design a tRPC API for a SaaS analytics dashboard with real-time data, user management, and reporting.

Functional Requirements

  • User authentication and team management
  • Dashboard widgets and customization
  • Real-time analytics data
  • Report generation and export
  • Webhook integrations
  • API key management

Non-Functional Requirements

  • End-to-end type safety
  • Real-time data streaming
  • Efficient data aggregations
  • Multi-tenant isolation
  • Rate limiting per tenant

Questions to Consider

  • How do you structure routers for a complex application?
  • What patterns work best for real-time data in tRPC?
  • How do you handle file uploads and downloads?
Your Solution

Router Architecture

Design the tRPC router structure and procedure organization. Consider nested routers, middleware chains, and code splitting.