Skip to content

Architecture

System Overview

┌─────────────────────────────────────────────────────────────┐
│                     Client Layer                             │
│                  Next.js Web Application                     │
└─────────────────────────┬───────────────────────────────────┘


┌─────────────────────────────────────────────────────────────┐
│                  FastAPI Backend                             │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────┐  │
│  │ Auth Module │  │ Email Sync  │  │ AI Classification   │  │
│  └─────────────┘  └─────────────┘  └─────────────────────┘  │
└─────────────────────────┬───────────────────────────────────┘


┌─────────────────────────────────────────────────────────────┐
│                    Data Layer                                │
│  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────┐  │
│  │ Supabase    │  │ Redis       │  │ Vector DB           │  │
│  │ (PostgreSQL)│  │ (Cache)     │  │ (AI Memory)         │  │
│  └─────────────┘  └─────────────┘  └─────────────────────┘  │
└─────────────────────────────────────────────────────────────┘

Components

Frontend (Next.js)

The web application handles user authentication, email display, and chat interface.

Key Technologies

  • Next.js 14 with App Router
  • Shadcn/UI components
  • Zustand for state management
  • SWR for data fetching

Backend (FastAPI)

Handles business logic, email synchronization, and AI processing.

python
from fastapi import FastAPI

app = FastAPI(title="Zenlym API")

@app.get("/health")
def health_check():
    return {"status": "healthy"}

Background Workers (Celery)

Processes email sync and AI classification asynchronously.

Data Flow

  1. Email Received → Gmail webhook triggers sync
  2. Sync Worker → Fetches and stores email
  3. AI Worker → Classifies email using GPT-4o-mini
  4. Notification → User notified if email is important

Released under the MIT License.