A comprehensive AI-powered email assistant that helps users generate professional email replies using Google's Gemini API. The project consists of three main components: a Spring Boot backend, a React frontend, and a Chrome extension.
- Features
- Architecture
- Project Structure
- Prerequisites
- Setup and Installation
- Usage
- API Endpoints
- Environment Variables
- Technologies Used
- Contributing
- License
- AI-Powered Email Generation: Uses Google's Gemini API to generate professional email replies
- Tone Selection: Choose from different tones (Professional, Casual, Friendly, Formal) for email replies
- Web Interface: Clean React-based web application for generating email replies
- Chrome Extension: Directly generate email replies within Gmail interface
- Copy to Clipboard: Easily copy generated emails to clipboard
The project follows a client-server architecture:
- Backend: Spring Boot application that serves as the API layer, communicating with Google's Gemini API
- Frontend: React web application providing a user-friendly interface for email generation
- Chrome Extension: Browser extension that integrates directly with Gmail's compose window
.
├── Backend/ # Spring Boot application
│ ├── src/
│ │ ├── main/java/com/email_writer/app/
│ │ │ ├── EmailGeneratorController.java
│ │ │ ├── EmailGeneratorService.java
│ │ │ └── EmailRequest.java
│ │ └── resources/
│ │ └── application.properties
│ └── pom.xml
├── Frontend/ # React web application
│ ├── src/
│ │ ├── App.jsx
│ │ └── main.jsx
│ └── package.json
└── chrome-extension/ # Chrome extension
├── content.js
└── manifest.json
- Java 21+
- Maven 3.8+
- Node.js 16+
- npm 8+
- Google Gemini API Key
-
Navigate to the Backend directory:
cd Backend -
Set up environment variables: Create a .env file in the Backend directory or set system environment variables:
GEMINI_URL=https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key= GEMINI_KEY=your_gemini_api_key_here -
Build the project:
./mvnw clean install
-
Run the application:
./mvnw spring-boot:run
The backend will start on port 8080.
-
Navigate to the Frontend directory:
cd Frontend -
Install dependencies:
npm install
-
Run the development server:
npm run dev
The frontend will start on port 5173.
-
Open Chrome and navigate to
chrome://extensions/ -
Enable "Developer mode" in the top right corner
-
Click "Load unpacked" and select the
chrome-extensiondirectory -
The extension will be installed and visible in the Chrome toolbar when visiting Gmail
- Start both the backend and frontend servers
- Open your browser and navigate to
http://localhost:5173 - Enter the email content you want to reply to
- Optionally select a tone for the reply
- Click "Generate Reply"
- Copy the generated reply to your clipboard using the "Copy to Clipboard" button
- Navigate to Gmail and open a conversation
- Click "Reply" to open the compose window
- Select the desired tone from the dropdown
- Click the "AI Reply" button
- The generated reply will automatically appear in the compose box
| Endpoint | Method | Description |
|---|---|---|
| /api/email/generate | POST | Generates an email reply based on provided content and tone |
Request Body:
{
"emailContent": "string",
"tone": "string" // Optional: professional, casual, friendly, formal
}Response:
Generated email reply as plain text
| Variable | Description | Required |
|---|---|---|
| GEMINI_URL | Gemini API endpoint URL | Yes |
| GEMINI_KEY | Your Gemini API key | Yes |
- Java 21
- Spring Boot 3.5.7
- Spring Web
- Spring WebFlux
- Maven
- React 19
- Vite
- Material UI
- Axios
- JavaScript
- Chrome Extension APIs
Contributions are welcome! Please feel free to submit a Pull Request.