This repository contains the backend API for an AI-powered Email Writer that generates smart, professional email replies using Google Gemini and Spring Boot.
The backend exposes clean REST endpoints that your React frontend can call to send email context, tone, and subject, and receive an AI‑crafted reply in real time. [attached_file:1][web:32]
-
AI‑generated email replies
Sends email context and tone to the Gemini API and returns a refined, human‑like reply suitable for real communication. [web:25][web:31] -
RESTful Spring Boot API
Well‑structured controllers, services, and DTOs to keep the codebase clean and easy to extend. [attached_file:1][web:32] -
Config‑driven Gemini integration
Uses environment / properties configuration for Gemini base URL and API key, keeping secrets out of the code and ready for production deployment. [web:28][web:32] -
Frontend‑friendly responses
JSON‑based request/response schema designed to plug directly into a React/Next.js UI without heavy transformation. [attached_file:1][web:27] -
Deployable backend
Architected to run on cloud platforms like Render or similar PaaS providers, making it easy to host as a standalone microservice used by multiple clients. [attached_file:1][web:32]
-
Client (separate repo): React / Next.js app where the user writes prompts and selects tone.
-
This Backend (Spring Boot):
- Exposes endpoints like
POST /api/v1/email/generate - Validates and normalizes input (subject, body, tone, extra instructions)
- Calls Gemini with a well‑designed prompt
- Returns a structured reply ready to render in the UI [web:28][web:31]
- Exposes endpoints like
-
External Service: Google Gemini API for natural language generation. [web:32]
This separation clearly showcases your backend specialization and makes the project easier to reason about for recruiters or collaborators.
Update paths/names to match your exact implementation.
Endpoint
POST /api/email/generate Content-Type: application/json
Sample Request Body
{ "emailContent" : "Hi how are u shubham what are u doing", "tone" : "frindly" }
Sample Response
Subject: Re: Hope you're well!
Hi [Sender's Name, if you know it, otherwise use "Hi there"],
Thanks for checking in! I'm doing well, thank you for asking.
I'm currently focused on a few projects here at work, keeping busy! What about you? How have things been on your end?
Hope you're having a great week!
All the best,
Shubham [Your Title/Role, if applicable] [Your Company, if applicable]
tonecan be values likeprofessional,friendly,casual, etc., which are passed into the Gemini prompt. [web:28][web:30]- Response is designed to be pasted directly into an email composer in the frontend.
If you support multiple endpoints (like health checks, ping, or version), list them briefly here.
Create an application.properties or application.yml in src/main/resources and configure:
server.port=8080
gemini.api.url=<GEMINI_ENDPOINT_URL> gemini.api.key=${GEMINI_API_KEY}
Recommended:
- Use environment variables or a
.env‑style approach when deploying (Render, Railway, etc.). - Never commit your actual Gemini API key to Git. [web:28][web:32]
-
Clone the repository git clone https://github.com/mustaalikanchwala/Ai-EmailWriter-Backend.git cd Ai-EmailWriter-Backend
-
Configure Gemini credentials
- Add your Gemini URL and API key in
application.propertiesor as environment variables. [web:28][web:32]
- Build & run (Maven) mvn spring-boot:run
- Language: Java
- Framework: Spring Boot
- AI Integration: Google Gemini (via HTTP client / REST template / WebClient) [web:31][web:32]
- Build Tool: Maven
- Deployment Target: Render or any Java‑friendly PaaS (Heroku alternatives, etc.) [attached_file:1]
This stack clearly demonstrates your skills in modern Java backend + LLM integration, which is very attractive for backend and AI‑adjacent roles. [web:28][web:31]
- Ability to design and implement a real backend service used by a production‑style frontend.
- Hands‑on experience integrating large language models (LLMs) into a Spring Boot application. [web:25][web:31][web:32]
- Understanding of API design, configuration management, and deployment‑ready structure.
- Curiosity and initiative to go beyond basic CRUD and build something that genuinely improves productivity.
If you plan to extend the backend later, you can mention ideas like:
- Multiple tones/presets (formal, friendly, assertive, empathetic).
- Email thread awareness (providing previous messages for more contextual replies). [web:31]
- Rate limiting and authentication for multi‑user usage.
- Logging and observability for monitoring usage and performance.
This backend is part of a larger AI Email Writer system, demonstrating how to connect a modern Spring Boot API with Google Gemini to solve a real, everyday problem: writing better emails, faster.