System Architecture
Arre is built as a modern single-page application (SPA) with a serverless backend. The architecture follows a clear separation between client-side React application and Firebase backend services.Arre uses Firebase emulators for local development, allowing full offline development without touching production resources.
High-Level Architecture
Frontend Architecture
React Application Structure
The frontend is built with React 19 and follows a feature-based organization pattern:- Routing
- State Management
- Component Architecture
Arre uses React Router for client-side routing with protected routes:All routes except
/login are wrapped in ProtectedRoute which verifies authentication status before rendering.Backend Architecture
Firebase Services
Arre leverages Firebase as a Backend-as-a-Service (BaaS) platform:Firebase Authentication
Firebase Authentication
Handles user identity with multiple sign-in methods:
- Google OAuth: Primary sign-in method
- Anonymous Auth: Allows users to try the app without creating an account
- Account Linking: Anonymous users can upgrade to Google accounts while preserving data
Cloud Firestore
Cloud Firestore
NoSQL document database for real-time data storage:Data Model:Security: All data is scoped per user with Firestore Security Rules (
firestore.rules:34-53)Cloud Functions
Cloud Functions
Serverless backend logic running on Node.js 22 (
functions/package.json:12):processMagicImport: AI-powered task extraction from documents (PDF, CSV, text)generateBriefing: Creates personalized daily briefings using Gemini AIgetGoogleTaskLists: Fetches Google Tasks lists for integrationgetGoogleTasks: Retrieves tasks from Google Tasks APIupdateGoogleTask: Syncs task status back to Google Tasks
Cloud Storage
Cloud Storage
Used for storing document uploads for the Magic Import feature. Files are temporarily stored, processed by Cloud Functions, then tasks are extracted.
Data Flow & Real-time Synchronization
Task Management Flow
Real-time Sync Model
Arre uses Firestore’s real-time listeners for instant data synchronization:- Zero polling required
- Instant updates across devices
- Offline support with local cache
- Automatic conflict resolution
AI Integration Flow
functions/index.js:50-112):
- Client uploads file to Cloud Function
- Function parses content based on MIME type (PDF, CSV, or text)
- Sends content to Gemini 2.5 Flash with structured prompt
- AI returns JSON array of actionable tasks
- Client receives tasks and adds them to Firestore
Key Design Decisions
1. Firebase-First Architecture
Why: Eliminates need for custom backend infrastructure. Firebase provides auth, database, functions, and hosting in one integrated platform. Trade-offs:- ✅ Fast development, built-in scaling, real-time sync
- ❌ Vendor lock-in, limited query flexibility
2. Feature-Based Code Organization
Instead of grouping by file type (components/, hooks/, utils/), Arre groups by feature:3. CSS Modules + CSS Variables
Styling uses CSS Modules for scoping with global CSS variables for theming:4. TypeScript Throughout
All source code is TypeScript with strict typing (tsconfig.json).
Why: Catch errors at compile time, better IDE support, self-documenting code through types.
5. Emulator-First Development
Development uses Firebase emulators for all services (src/lib/firebase.ts:27-33):
6. Optimistic UI Updates
While not explicitly shown in the code, Firestore’s client SDK includes built-in optimistic updates. When you calladdDoc() or updateDoc(), the UI updates immediately from the local cache before server confirmation.
Why: Better perceived performance, users don’t wait for network round-trips.
Performance Considerations
- Code Splitting: Vite automatically splits code by route
- Lazy Loading: Components load on-demand
- Firestore Indexes: Custom indexes defined in
firestore.indexes.jsonfor complex queries - Real-time Query Optimization: Queries are scoped by user ID and filtered by view to minimize data transfer
Next Steps
Tech Stack
Detailed breakdown of all technologies and their versions
Project Structure
Deep dive into directory organization and file conventions