SubtleMail is an AI-powered web application that generates professional, strategically crafted email responses for delicate workplace situations. Perfect for those moments when you need to communicate assertively while maintaining professionalism and diplomacy.
- Smart Email Generation: AI-powered responses that strike the perfect balance between assertiveness and professionalism
- Tone Customization: Choose from multiple professional tones (Professional but firm, Diplomatic, Assertive but respectful, Polite but direct)
- Quick Templates: Pre-built examples for common workplace scenarios
- Saved Templates Page: View all your saved templates on a dedicated /templates page
- Copy from Templates: One-click copy of subject and body from any saved template
- Modern UI: Clean, dark-themed interface with responsive design
- Copy to Clipboard: One-click copying of generated emails
- Toast Notifications: User-friendly error handling and feedback
- Next.js 15 - React framework with App Router
- React 19 - UI library
- TypeScript - Type safety
- Tailwind CSS - Styling
- React Hot Toast - Toast notifications
- React Icons - Icon library
- Node.js - Runtime environment
- Express.js - Web framework
- TypeScript - Type safety
- Prisma - Database ORM
- PostgreSQL - Database
- CORS - Cross-origin resource sharing
- dotenv - Environment variable management
- Node.js (v18 or higher)
- npm or yarn
-
Clone the repository
git clone https://github.com/mo-renike/subtleMail cd subtleMail -
Install dependencies
# Install client dependencies cd client npm install # Install server dependencies cd ../server npm install
-
Set up environment variables
# In the server directory, create a .env file cd server touch .env
Add the following to your
.envfile:PORT=3000 DATABASE_URL="postgresql://username:password@localhost:5432/subtlemail" # Add your OpenAI API key when implementing AI features # OPENAI_API_KEY=your_api_key_here
-
Set up the database
# Install Prisma CLI globally (if not already installed) npm install -g prisma # Generate Prisma client npx prisma generate # Run database migrations npx prisma migrate dev --name init # (Optional) Open Prisma Studio to view your data npx prisma studio
-
Start the development servers
# Start the backend server (from server directory) npm run dev # In a new terminal, start the frontend (from client directory) cd client npm run dev
-
Fill out the form with your situation details:
- Title: Brief description of the issue
- Situation: Detailed explanation of what happened
- Recipient: Who you're writing to
- Tone: Choose the appropriate professional tone
-
Use Quick Examples or create your own scenario
-
Generate Response - Click the button to get your AI-crafted email
-
Save Template - After generating a response, click 'Save Template' to store it for future use (requires login)
-
View Saved Templates
- Click the 'Saved Templates' button at the top of the home page, or go to
/templates - Browse all your saved templates, including their generated subject and body
- Use the copy button to quickly copy the subject and body to your clipboard
- Click the 'Saved Templates' button at the top of the home page, or go to
-
Copy and Use - Copy the generated or saved email to your clipboard and use it in your email client
- Clean, dark-themed interface
- Responsive design for all devices
- Form validation and error handling
- Professional email preview
- Subject line and body display
- One-click copy functionality
- Success feedback with checkmark
- Pre-built templates for common scenarios
- Easy one-click form population
- Visual indicators and hover effects
- Dedicated
/templatespage for all your saved templates - Displays template details, generated subject, and body
- One-click copy for any saved template
- Consistent UI and feedback as the home page
subtleMail/
βββ client/ # Next.js frontend
β βββ app/ # App Router (pages, API routes, components, data)
β β βββ api/ # API routes (auth, etc.)
β β βββ components/ # React components
β β βββ data/ # Static/data files
β β βββ home/ # Home page
β β βββ layout.tsx # App layout
β β βββ page.tsx # Main page
β βββ public/ # Static assets
β βββ middleware.ts # Next.js middleware
β βββ package.json # Frontend dependencies & scripts
β βββ ...
βββ server/ # Express.js backend
β βββ src/ # Source code
β β βββ controllers/ # Route controllers (auth, email)
β β βββ middleware/ # Express middleware
β β βββ routes/ # Express routes (auth, email)
β β βββ index.ts # Main server file
β βββ prisma/ # Database schema and migrations
β β βββ migrations/ # Prisma migrations
β β βββ schema.prisma # Prisma schema
β βββ app/ # Generated Prisma client
β βββ package.json # Backend dependencies & scripts
β βββ ...
βββ README.md
The application uses PostgreSQL with Prisma ORM and includes the following models:
- User: Stores user information (id, email, name, timestamps)
- EmailTemplate: Stores email templates with situation details and tone preferences
- GeneratedResponse: Stores AI-generated email responses linked to templates and users
Relationships:
- Users can have multiple email templates and generated responses
- Email templates belong to users and can have multiple generated responses
- Generated responses are linked to both users and email templates
Client (Next.js)
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLintServer (Express.js)
npm run dev # Start development server with nodemon & ts-node
npm run build # Compile TypeScript to JavaScript (output in dist/)
npm run start # Start production server (runs dist/index.js)
npm run lint # Run ESLint
npm run postinstall # Generate Prisma client after install
npx prisma generate # Generate Prisma client
npx prisma migrate dev # Run database migrations
npx prisma studio # Open Prisma Studio- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Next.js and Express.js
- Styled with Tailwind CSS
- Icons from React Icons
- Toast notifications with React Hot Toast