Skip to content

DRAZY/email-draft-assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Email Draft Assistant

Compare AI-powered email rewrites side-by-side across multiple models and pick the best one. Supports OpenAI, Anthropic Claude, Google Gemini, and Meta Llama (via Groq).

Features

  • Multi-model comparison — Rewrite with up to 4 AI providers in parallel and compare results side-by-side
  • Pick the best — Select your favorite rewrite with one click, auto-copied to clipboard
  • Three tones — Professional, Friendly, or Concise
  • Bring your own keys — Enter API keys in the browser (stored in sessionStorage, never saved on the server)
  • Server keys fallback — Admins can configure shared keys via .env
  • Web frontend option — Copy the prompt to use directly in ChatGPT, Claude, Gemini, or Meta AI
  • Dark mode — Toggle or auto-detect from system preference
  • Mobile responsive — Works on desktop, tablet, and phone

Supported Providers

Provider Models API Key Source
OpenAI gpt-4o-mini, gpt-4o, gpt-4.1-mini, gpt-4.1 platform.openai.com
Anthropic claude-haiku-4-5, claude-sonnet-4, claude-opus-4 console.anthropic.com
Google Gemini gemini-2.0-flash, gemini-2.5-flash, gemini-2.5-pro aistudio.google.com
Meta Llama llama-3.3-70b-versatile, llama-3.1-8b-instant console.groq.com

Quick Start

Prerequisites

  • Node.js 18+ (Download)
  • At least one API key from the providers above

Installation

git clone git@github.com:DRAZY/email-draft-assistant.git
cd email-draft-assistant
npm install

Configuration (optional)

Server-side keys are optional. Users can enter their own keys in the browser UI.

cp env-example.txt .env
# Edit .env and add any keys you want available server-side

Run

npm start

Open http://localhost:3000 in your browser.

How to Use

  1. Paste your email draft into the text area
  2. Select a tone — Professional, Friendly, or Concise
  3. Check which models to compare (all four enabled by default)
  4. Click Rewrite Email — results appear side-by-side
  5. Pick the best one — click "Pick This" to highlight and copy it

Web Frontend Mode

If you don't want to use API keys:

  1. Click Copy Prompt in the web section at the bottom
  2. Open any AI chat (ChatGPT, Claude, Gemini, Meta AI)
  3. Paste the prompt and get your rewrite
  4. Paste the result back into the app to compare alongside API results

Project Structure

email-draft-assistant/
├── server.js               # Express server, API routing, rate limiting
├── providers/
│   ├── index.js            # Provider registry
│   ├── openai.js           # OpenAI SDK integration
│   ├── anthropic.js        # Anthropic SDK integration
│   ├── gemini.js           # Google GenAI SDK integration
│   └── llama.js            # Meta Llama via Groq (OpenAI-compatible)
├── public/
│   ├── index.html          # App markup
│   ├── styles.css          # Glassmorphism UI with dark mode
│   └── script.js           # Frontend logic (safe DOM construction)
├── package.json
├── env-example.txt         # Example environment variables
└── README.md

Security

  • API keys in browser are stored in sessionStorage (cleared when the tab closes)
  • Keys sent via headers (X-openai-Key, etc.), not in request bodies
  • Server never logs or stores user-provided API keys
  • Static files isolated in public/ — server code is not accessible via the web
  • Rate limited — 10 requests per minute per IP
  • Input validated — 10,000 character max, tone allowlist

Tech Stack

  • Express 5 — HTTP server and static file serving
  • OpenAI SDK v6 — OpenAI and Groq (Llama) integration
  • Anthropic SDK — Claude integration
  • Google GenAI SDK — Gemini integration
  • Vanilla JS — No frontend framework, safe DOM construction (no innerHTML)
  • CSS custom properties — Design system with light/dark theme

Troubleshooting

"No API key configured" — Open the API Key Settings panel and enter a key, or add one to .env and restart the server.

"Too many requests" — Rate limit is 10 requests/minute per IP. Wait a moment.

"Failed to get response from this provider" — Check that your API key is valid and has credits/quota.

License

MIT

About

My vibe coded AI-powered email draft assistant using OpenAI API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors