A repository for the pidi.email app. A fast local first web based email client. Made as a Graduation project at SSPŠ.
- TypeScript 62.5%
- Rust 32.4%
- HTML 2.4%
- CSS 2.1%
- Dockerfile 0.4%
- Other 0.1%
|
|
||
|---|---|---|
| .assets | ||
| assets | ||
| ci | ||
| public | ||
| src | ||
| .gitignore | ||
| AGENTS.md | ||
| biome.json | ||
| bun.lock | ||
| components.json | ||
| lefthook.yml | ||
| LICENSE | ||
| next.config.ts | ||
| open-next.config.ts | ||
| package.json | ||
| postcss.config.mjs | ||
| README.md | ||
| tsconfig.json | ||
| wrangler.jsonc | ||
Pidi Email
A high-performance, local-first email client built with Next.js, React Router, and a Rust backend.
🚀 Quick Start
Prerequisites
- Bun: For frontend and coordination
- Rust: For the backend service
- Docker: For the PostgreSQL database
- Nix (Optional): For a reproducible development environment
Installation
bun install
Development
- Start the database:
cd src/backend docker-compose up -d - Run the backend:
bun run backend:dev - Run the frontend:
bun dev
🏗️ Architecture
Pidi Email uses a "Local-First" architecture designed for speed and offline capability:
- Next.js Shell: Next.js 15 acts as the entry point and delivery mechanism, redirecting all application routes to a single-page
/shell. - React Router SPA: The entire UI logic lives inside the shell, handled by React Router 7 for instant client-side navigation.
- Dexie.js (IndexedDB): Email metadata and bodies are stored locally in the browser's IndexedDB, allowing for near-instant search and offline access.
- Rust Backend: A high-concurrency Axum server handles synchronization with email providers (Gmail), authentication, and attachment proxying.
🎨 Features
- 📧 Local-First Sync: Blazing fast email interactions by reading from local IndexedDB.
- 📎 Attachment Support: Integrated attachment synchronization and secure download proxy.
- 🔑 OAuth2 Integration: Secure Google/Gmail authentication with automatic token management.
- ⚡ Real-time Updates: WebSocket integration for live sync progress and new message notifications.
- 🌙 Modern UI: Built with Tailwind CSS 4 and shadcn/ui components.
- 🛠️ Type Safety: Automatic TypeScript binding generation from Rust structs.
🛠️ Tech Stack
- Frontend: Next.js 15, React Router 7, Dexie.js, TanStack Query, Tailwind CSS 4
- Backend: Rust (Axum, SQLx), PostgreSQL, Google Gmail API
- Deployment: Configured for Cloudflare Workers via OpenNext
📁 Key Files
src/frontend/app.tsx- Main React Router application logicsrc/backend/src/main.rs- Axum server and route registrationsrc/backend/src/providers/google/populate_db.rs- Gmail sync enginesrc/backend/src/routes/attachments.rs- Attachment download handlersrc/lib/db.ts- Dexie.js database schema and initializationsrc/backend/bindings/- Auto-generated TypeScript types from Rust
🔧 Useful Commands
bun run gen:types-dev: Regenerate TypeScript bindings from Rust models (requires Nix).bun run backend:check: Run Rust type checking and linting.bun run format: Format the frontend code using Biome.
