Skip to content

YS0meone/mailmind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

68 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

MailMind

Overview

MailMind is an AI-powered email client that combines intelligent email organization with a conversational assistant. It lets you triage faster, ask natural-language questions over your mailbox (RAG), and draft/send emails with AI assistance.

UI Demo

Light Mode

image

Dark Mode

image

Chatbot

image

🌟 Features

  • Smart email management: Inbox, threads, search, and compose/reply flows
  • AI-powered chat (RAG): Ask questions and get citation-backed answers
  • Real-time sync: Incremental sync via Aurinko; background workers keep data fresh
  • Modern UI: Next.js App Router, shadcn/Radix UI, Tailwind CSS, streaming chat

πŸ—οΈ Tech Stack

Frontend

  • Framework: Next.js 15 with TypeScript (App Router)
  • UI: shadcn/ui + Radix UI primitives
  • Styling: Tailwind CSS
  • Data fetching: SWR
  • Deployment: Vercel

Backend

  • Framework: FastAPI (Python)
  • Database: PostgreSQL (e.g., Neon)
  • ORM: SQLAlchemy 2.0 + Alembic
  • Auth: Cookie-based auth (JWT token in cookie), CORS configured for Vercel
  • Workers/Queue: ARQ + Redis for background sync/indexing
  • AI/RAG: LangChain/LangGraph + Chroma vector store
  • Email Integration: Aurinko API
  • Deployment: Cloud Run

Tooling

  • Package manager: npm (frontend), pip (backend)
  • Code quality: ESLint, TypeScript

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • Python 3.10+
  • PostgreSQL database (or Neon account)
  • Redis (for ARQ workers)
  • Aurinko API credentials
  • OpenAI API key (optional, for AI features)

Backend Setup

  1. Navigate to backend and create venv

    cd backend
    python -m venv venv
    # Windows
    venv\Scripts\activate
    # macOS/Linux
    # source venv/bin/activate
  2. Install dependencies

    pip install -r requirement.txt
  3. Environment configuration

    Create a new .env file based on the .env.example file.

  4. Migrations and init

    alembic upgrade head
    # optional
    # python -m app.init_db
  5. Start API (dev)

    uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

Frontend Setup

  1. Navigate to frontend

    cd frontend
  2. Install dependencies

    npm install
  3. Environment configuration

    NEXT_PUBLIC_API_BASE_URL=http://localhost:8000
    NEXT_PUBLIC_AURINKO_CLIENT_ID=your_aurinko_client_id
  4. Start dev server

    npm run dev

The application will be available at:

πŸ“ Project Structure

mailmind/
β”œβ”€β”€ backend/                    # FastAPI backend
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/               # API routes
β”‚   β”‚   β”‚   └── routes/        # Route handlers
β”‚   β”‚   β”œβ”€β”€ core/              # Config
β”‚   β”‚   β”œβ”€β”€ services/          # Business logic (RAG, etc.)
β”‚   β”‚   β”œβ”€β”€ models.py          # SQLAlchemy models
β”‚   β”‚   β”œβ”€β”€ crud.py            # DB operations
β”‚   β”‚   └── main.py            # FastAPI app
β”‚   β”œβ”€β”€ alembic/               # DB migrations
β”‚   └── requirement.txt        # Python deps
β”œβ”€β”€ frontend/                   # Next.js frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/               # App Router
β”‚   β”‚   β”œβ”€β”€ components/        # UI components
β”‚   β”‚   β”œβ”€β”€ hooks/             # React hooks
β”‚   β”‚   └── lib/               # Utilities
β”‚   └── package.json           # Node deps
└── public/                    # Static assets

πŸ”§ API Documentation

Visit http://localhost:8000/docs for the FastAPI OpenAPI UI.

Key Endpoints (high level)

  • POST /auth/login – User authentication
  • GET /mail/threads – Fetch paginated threads
  • POST /chat/stream – Streaming chat over emails (RAG)
  • POST /mail/thread/{id}/reply – Send a reply

πŸ€– AI Features

MailMind includes a RAG service for question answering, summarization, and semantic retrieval over your email history. Answers include citations back to source messages.

πŸ”’ Security

  • Cookie-based auth (JWT), CORS restricted to your frontend
  • Environment-based configuration

πŸ§ͺ Development

Migrations

cd backend
alembic revision --autogenerate -m "Description of changes"
alembic upgrade head

πŸ“ License

This project is licensed under the terms specified in the LICENSE file.

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

Built with ❀️ using FastAPI, Next.js, and modern web technologies.

About

An AI email client

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •