Skip to content

✉️ AI-powered email reply generator Chrome Extension. Generates smart, concise replies with Google Gemini — works on web UI or directly inside Gmail.

Notifications You must be signed in to change notification settings

sanketzope/Email-Assistance-Chrome-Extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

✉️ Email Writer — AI‑Powered Email Reply Generator

Build fast, reply faster. Generate concise, context‑aware email replies using Google Gemini.

Java Spring Boot React Vite Chrome Extension

🧭 Monorepo layout

  • email-writer-sb/ — Spring Boot backend API
  • email-writer-react/ — React UI (Vite)
  • email-writer-extension/ — Gmail content‑script extension
  • hello-world-ext/ — Minimal example extension

🧰 Tech stack

  • Java 21, Spring Boot Web + WebFlux
  • Node.js (Vite, React, MUI)
  • Chrome Extension (Manifest v3)

⚡ Quick start

✅ Prerequisites

  • Java 21
  • Maven (or use the included Maven Wrapper mvnw/mvnw.cmd)
  • Node.js 18+ and npm
  • Google Chrome (for the extension)
  • A Google Gemini API key

1) 🖥️ Backend API (Spring Boot)

Location: email-writer-sb/

Configure environment variables for Gemini before running:

  • GEMINI_URL should be the base endpoint including the ?key= suffix, e.g. https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=
  • GEMINI_KEY is your API key

On Windows PowerShell:

setx GEMINI_URL "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key="
setx GEMINI_KEY "<YOUR_API_KEY>"
# Open a new terminal after setx, or for the current session:
$Env:GEMINI_URL = "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key="
$Env:GEMINI_KEY = "<YOUR_API_KEY>"

On macOS/Linux (bash/zsh):

export GEMINI_URL="https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key="
export GEMINI_KEY="<YOUR_API_KEY>"

Run the API:

cd email-writer-sb
# macOS/Linux
./mvnw spring-boot:run
# Windows
mvnw.cmd spring-boot:run

By default the server starts at http://localhost:8080.

🔌 API

  • POST /api/email/generate
    • Request headers: Content-Type: application/json
    • Request body:
      {
        "emailContent": "<paste the original email text>",
        "tone": "professional"  // optional: professional | friendly | casual | formal
      }
    • Response: text/plain — generated reply body only (no subject/greetings/sign-off)

Example cURL:

curl -s -X POST http://localhost:8080/api/email/generate \
  -H "Content-Type: application/json" \
  -d '{
    "emailContent": "Thanks for your update on the project timeline...",
    "tone": "professional"
  }'

2) 🧑‍💻 Frontend (React + Vite)

Location: email-writer-react/

Start the UI:

cd email-writer-react
npm install
npm run dev

The app runs on Vite’s dev server (e.g., http://localhost:5173) and calls the backend at http://localhost:8080.

3) 🧩 Chrome Extension (Gmail)

Location: email-writer-extension/

Load the extension locally:

  1. Open chrome://extensions in Chrome
  2. Enable “Developer mode” (top right)
  3. Click “Load unpacked” and select the email-writer-extension/ folder
  4. Open Gmail; when the compose window appears, an “AI Reply” button should be injected in the toolbar. Clicking it calls the backend and inserts the generated reply into the compose box

Tip: Ensure the backend is running at http://localhost:8080 when testing the extension.

4) 🧪 Hello World Extension (optional)

Location: hello-world-ext/

This is a minimal MV3 extension example. Load it via “Load unpacked” the same way as above.

🏗️ Project internals

Backend highlights

  • Controller: EmailGeneratorController exposes POST /api/email/generate
  • Request model: EmailRequest with fields emailContent and tone
  • Service: EmailGeneratorService builds a prompt and posts to Gemini using WebClient
  • Config: application.properties maps gemini.api.url and gemini.api.key to the environment variables GEMINI_URL and GEMINI_KEY

Troubleshooting

  • Gemini 401/403 or 404: Double-check GEMINI_URL includes the ?key= suffix and that GEMINI_KEY is correct. Ensure your model name and path are valid for your key/region.
  • CORS errors in the React app: The backend enables CORS for all origins on the controller. Make sure the API is reachable at http://localhost:8080.
  • Gmail button not appearing: Gmail’s DOM changes often. Try opening a new compose window, or refresh Gmail. Open DevTools Console to see logs from content.js.
  • Extension host permissions: If network calls are blocked, verify the extension manifest has correct host_permissions for http://localhost:8080/* and Gmail.

Scripts and builds

  • Backend: mvnw spring-boot:run, mvnw clean package
  • Frontend: npm run dev, npm run build, npm run preview

🔐 Security

  • Do not commit API keys. Use environment variables (GEMINI_URL, GEMINI_KEY).
  • In production, restrict CORS and place the API behind proper authentication and rate limits.

📄 License

No license specified yet.

About

✉️ AI-powered email reply generator Chrome Extension. Generates smart, concise replies with Google Gemini — works on web UI or directly inside Gmail.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published