Skip to content

Repository files navigation

πŸš€ IntelliMail - AI-Powered Email Client

Normal Human Banner

Next.js TypeScript Tailwind CSS OpenAI Stripe

A minimalistic, AI-powered email client that revolutionizes email management

🌟 Live Demo β€’ πŸ“– Documentation β€’ πŸ› Report Bug β€’ πŸ’‘ Request Feature


🎯 Project Overview

I developed IntelliMail as a cutting-edge AI-powered email client that transforms how users interact with their email. This full-stack application combines modern web technologies with advanced AI capabilities to create an intelligent, efficient, and user-friendly email management experience.

✨ What Makes This Special

πŸ€– AI-Driven Intelligence - Built-in AI assistant powered by OpenAI GPT models for smart email composition, summarization, and responses

πŸ” Advanced RAG Search - Sophisticated Retrieval Augmented Generation using Orama for lightning-fast, context-aware email search

πŸ“§ Universal Integration - Seamless connectivity with Gmail, Office365, and other major email providers via Aurinko API

⚑ Real-time Sync - Live email synchronization with intelligent threading and organization

πŸ’³ Premium Subscriptions - Integrated Stripe payment system for advanced features and premium tiers

🎨 Modern UI/UX - Sleek, responsive interface with dark mode support and keyboard-first navigation


🌟 Key Features

πŸ€– AI-Powered Capabilities

  • Smart Email Composition - AI-assisted writing with auto-completion and suggestions
  • Intelligent Summarization - Automatically generate concise summaries of long email threads
  • Context-Aware Responses - AI-generated reply suggestions based on email content and history
  • Advanced Search - Natural language search queries powered by embeddings and RAG technology

πŸ“¨ Email Management

  • Multi-Provider Support - Gmail, Office365, and other IMAP/SMTP providers
  • Real-time Synchronization - Instant email updates across all devices
  • Smart Threading - Intelligent conversation grouping and organization
  • Advanced Filtering - Custom labels, categories, and automated sorting
  • Attachment Handling - Secure file management and preview capabilities

πŸ” Security & Authentication

  • Clerk Integration - Secure user authentication and session management
  • OAuth 2.0 - Safe email provider connections without storing passwords
  • Data Encryption - End-to-end encryption for sensitive email data
  • Privacy Controls - Granular permissions and data access controls

πŸ’Ό Premium Features

  • Subscription Management - Stripe-powered payment processing
  • Usage Analytics - Detailed insights into email patterns and productivity
  • Priority Support - Enhanced customer service for premium users
  • Advanced AI Models - Access to latest GPT models and features

πŸ› οΈ Tech Stack

Frontend

Backend & Database

  • Prisma - Type-safe database ORM
  • PostgreSQL - Robust relational database
  • tRPC - End-to-end typesafe APIs
  • Zod - Schema validation

AI & Search

External Services

  • Aurinko API - Email provider integration
  • Clerk - Authentication and user management
  • Stripe - Payment processing
  • Vercel - Deployment and hosting

Development Tools


πŸ—οΈ Architecture Overview

graph TB
    A[Next.js Frontend] --> B[tRPC API Layer]
    B --> C[Prisma ORM]
    C --> D[PostgreSQL Database]
    B --> E[OpenAI API]
    B --> F[Aurinko Email API]
    B --> G[Stripe API]
    B --> H[Orama Search Engine]
    A --> I[Clerk Auth]
    J[Email Providers] --> F
    K[Vector Embeddings] --> H
    E --> K
Loading

Core Components

  1. Frontend Layer - Next.js app with server-side rendering and client-side interactions
  2. API Layer - tRPC endpoints for type-safe client-server communication
  3. Database Layer - Prisma ORM with PostgreSQL for data persistence
  4. AI Layer - OpenAI integration for intelligent features
  5. Email Integration - Aurinko API for multi-provider email access
  6. Search Engine - Orama with vector embeddings for semantic search
  7. Authentication - Clerk for secure user management
  8. Payment Processing - Stripe for subscription management

πŸ“¦ Installation & Setup

Prerequisites

  • Node.js 18.0 or higher
  • PostgreSQL database
  • Git for version control

1. Clone the Repository

git clone https://github.com/insertfahim/intellimail.git
cd intellimail

2. Install Dependencies

npm install
# or
yarn install
# or
pnpm install

3. Environment Configuration

Create a .env.local file in the root directory:

# Database
DATABASE_URL="postgresql://username:password@localhost:5432/intellimail"

# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_test_..."
CLERK_SECRET_KEY="sk_test_..."
NEXT_PUBLIC_CLERK_SIGN_IN_URL="/sign-in"
NEXT_PUBLIC_CLERK_SIGN_UP_URL="/sign-up"

# OpenAI
OPENAI_API_KEY="sk-..."

# Aurinko Email API
AURINKO_CLIENT_ID="your_aurinko_client_id"
AURINKO_CLIENT_SECRET="your_aurinko_client_secret"
AURINKO_SIGNING_SECRET="your_aurinko_signing_secret"

# Nylas
NYLAS_CLIENT_ID="your_nylas_client_id"
NYLAS_API_KEY="your_nylas_api_key"
GRAVATAR_API_KEY="your_gravatar_api_key"

# Stripe
STRIPE_SECRET_KEY="sk_test_..."
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY="pk_test_..."
STRIPE_PRICE_ID="price_..."
STRIPE_WEBHOOK_SECRET="whsec_..."

# App Configuration
NEXT_PUBLIC_URL="http://localhost:3001"

4. Database Setup

# Generate Prisma client
npx prisma generate

# Run database migrations
npx prisma db push

# (Optional) Open Prisma Studio
npx prisma studio

5. Start Development Server

npm run dev

Visit http://localhost:3001 to see the application.


πŸš€ Usage Examples

Basic Email Management

  1. Sign Up/Sign In - Create an account or log in with existing credentials
  2. Connect Email Account - Link your Gmail or Office365 account via OAuth
  3. Browse Emails - Navigate through your inbox with threaded conversations
  4. Use AI Features - Ask the AI assistant to help compose emails or summarize threads

AI Assistant Commands

# Email composition
"Help me write a professional email to decline a meeting"

# Email search
"Find all emails from John about the project proposal"

# Email summarization
"Summarize this email thread for me"

Keyboard Shortcuts

  • Cmd/Ctrl + K - Open command palette
  • G + I - Go to inbox
  • G + S - Go to sent emails
  • C - Compose new email
  • R - Reply to email
  • / - Search emails

πŸ“‚ Project Structure

intellimail/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                    # Next.js app directory
β”‚   β”‚   β”œβ”€β”€ (auth)/            # Authentication routes
β”‚   β”‚   β”œβ”€β”€ api/               # API routes
β”‚   β”‚   β”œβ”€β”€ mail/              # Main email interface
β”‚   β”‚   └── components/        # Shared components
β”‚   β”œβ”€β”€ components/            # UI components
β”‚   β”‚   └── ui/               # Reusable UI primitives
β”‚   β”œβ”€β”€ hooks/                # Custom React hooks
β”‚   β”œβ”€β”€ lib/                  # Utility functions
β”‚   β”‚   β”œβ”€β”€ aurinko.ts        # Email API integration
β”‚   β”‚   β”œβ”€β”€ embeddings.ts     # AI embeddings
β”‚   β”‚   β”œβ”€β”€ orama.ts          # Search engine
β”‚   β”‚   └── stripe.ts         # Payment processing
β”‚   β”œβ”€β”€ server/               # Server-side code
β”‚   β”‚   └── api/              # tRPC routers
β”‚   └── styles/               # Global styles
β”œβ”€β”€ prisma/                   # Database schema
β”œβ”€β”€ public/                   # Static assets
└── package.json             # Dependencies

🌐 Deployment

Vercel Deployment (Recommended)

  1. Connect Repository

    vercel --prod
  2. Environment Variables

    • Add all environment variables in Vercel dashboard
    • Update URLs to production domains
  3. Database

    • Use Vercel Postgres or external PostgreSQL provider
    • Run migrations on production database

Docker Deployment

# Dockerfile included in repository
docker build -t intellimail .
docker run -p 3000:3000 intellimail

Manual Deployment

# Build the application
npm run build

# Start production server
npm run start

πŸ§ͺ Development Guidelines

Code Style

  • TypeScript - Use strict typing throughout
  • ESLint - Follow configured linting rules
  • Prettier - Maintain consistent code formatting
  • Component Structure - Use functional components with hooks

Testing

# Run type checking
npm run type-check

# Run linting
npm run lint

# Format code
npm run format

Database Changes

# Create migration
npx prisma migrate dev --name migration_name

# Reset database
npx prisma migrate reset

# Deploy migrations
npx prisma migrate deploy

🀝 Contributing

I welcome contributions to make IntelliMail even better! Here's how you can help:

Getting Started

  1. Fork the repository
  2. Create a feature branch - git checkout -b feature/amazing-feature
  3. Make your changes - Follow the development guidelines
  4. Test thoroughly - Ensure everything works as expected
  5. Commit changes - git commit -m 'Add amazing feature'
  6. Push to branch - git push origin feature/amazing-feature
  7. Open a Pull Request

Contribution Guidelines

  • πŸ“ Clear descriptions - Explain what your changes do
  • πŸ§ͺ Test coverage - Include tests for new features
  • πŸ“š Documentation - Update docs for significant changes
  • 🎨 Code style - Follow existing patterns and conventions
  • πŸ› Bug reports - Include reproduction steps and environment details

Development Setup

# Install dependencies
npm install

# Start development server
npm run dev

# Run in turbo mode
npm run dev --turbo

πŸ™ Acknowledgments

I built IntelliMail using these excellent tools and services:

  • Next.js - The React framework for production
  • OpenAI - AI models and API
  • Clerk - Authentication infrastructure
  • Stripe - Payment processing platform
  • Aurinko - Email API integration
  • Vercel - Deployment and hosting
  • Radix UI - Unstyled, accessible components
  • Tailwind CSS - Utility-first CSS framework

πŸ“ž Contact & Support

I'd love to hear from you! Whether you have questions, feedback, or just want to connect:


πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Built with ❀️ by Fahim

If you found this project helpful, please consider giving it a ⭐️!

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages