- Monorepo with
/backend(Express + TypeScript) and/frontend(Vite + React)
- Node.js (v18 or later)
- Docker and Docker Compose
- npm or yarn
- Git
-
Clone the repository
git clone https://github.com/sahil-009/reachinbox.git cd reachinbox-main -
Set up environment variables
cd backend cp .env.local .envUpdate the
.envfile with your configuration:# Server PORT=3000 NODE_ENV=development # IMAP Configuration IMAP_HOST=ethereal.email IMAP_PORT=993 IMAP_SECURE=true IMAP_USER=your-email@ethereal.email IMAP_PASSWORD=your-ethereal-password # Elasticsearch ELASTICSEARCH_NODE=http://localhost:9200 -
Start Elasticsearch using Docker
docker compose up -d
-
Install dependencies
npm install # or yarn install -
Start Elasticsearch using Docker
docker compose up -d
-
Run the backend server
npm run dev # or yarn dev
-
Navigate to frontend directory
cd ../frontend -
Install dependencies
npm install
-
Start the development server
npm run dev
┌─────────────────┐ ┌───────────────────┐ ┌──────────────────┐
│ │ │ │ │ │
│ Email Service │<--->│ Backend Server │<--->│ Elasticsearch │
│ (IMAP/IDLE) │ │ (Node.js/TS) │ │ │
│ │ │ │ │ │
└─────────────────┘ └────────┬──────────┘ └──────────────────┘
│
│
┌───────▼───────┐
│ │
│ Frontend │
│ (React/TS) │
│ │
└───────────────┘
-
Email Service
- Handles IMAP connections using
imapflow - Implements IDLE mode for real-time email notifications
- Parses incoming emails using
mailparser
- Handles IMAP connections using
-
Backend Server
- API Layer: RESTful endpoints for client communication
- Service Layer: Business logic for email processing
- Data Access Layer: Handles Elasticsearch operations
- Worker Processes: Background jobs for email syncing
-
Elasticsearch
- Stores and indexes all emails
- Enables fast full-text search and filtering
- Handles large volumes of email data efficiently
-
Frontend
- Built with React and TypeScript
- State management with React Query
- Real-time updates via WebSockets
- Express server with TypeScript
- Health check endpoint at
/health - Environment variables managed with
.env
- Uses
imapflowfor persistent IMAP (IDLE mode) connections - Connects to Ethereal Email IMAP test account
- Fetches last 30 days of emails on startup
- Listens for new emails in real-time
- Parses emails using
mailparser
- Elasticsearch set up via Docker Compose (local, single-node)
- Backend connects to Elasticsearch using official Node.js client
- Every fetched/received email is indexed into Elasticsearch with fields:
- subject, from, to, date, text, html, messageId, folder, account
- Type/linter issues fixed for robust, type-safe indexing
- Build backend API endpoints for searching/filtering emails
- Add AI categorization (Gemini API)
- Integrate Slack/webhook notifications
- Build frontend to display/search emails
- Install dependencies in
/backendand/frontend - Add
.envfile in/backendwith IMAP and Elasticsearch config - Start Elasticsearch:
docker compose up -d - Start backend:
npm run devin/backend - Backend will sync and index emails automatically