initial
This commit is contained in:
236
README.md
Normal file
236
README.md
Normal file
@@ -0,0 +1,236 @@
|
||||
# Email Configuration Manager
|
||||
|
||||
A modern, professional web application for managing email rules including out-of-office auto-replies and email forwarding. Built with React, Express, and AWS DynamoDB.
|
||||
|
||||
## Features
|
||||
|
||||
- **Out of Office Management**: Configure auto-reply messages with HTML or plain text formatting
|
||||
- **Email Forwarding**: Set up multiple forward addresses for any email
|
||||
- **Modern UI/UX**: Clean, professional interface built with React and Tailwind CSS
|
||||
- **Real-time Updates**: Instant feedback with toast notifications
|
||||
- **AWS DynamoDB**: Reliable cloud storage for email rules
|
||||
|
||||
## Tech Stack
|
||||
|
||||
### Frontend
|
||||
- **React 18** - Modern UI library
|
||||
- **Vite** - Fast build tool and dev server
|
||||
- **Tailwind CSS** - Utility-first CSS framework
|
||||
- **Axios** - HTTP client for API calls
|
||||
- **React Icons** - Beautiful icon library
|
||||
|
||||
### Backend
|
||||
- **Node.js & Express** - REST API server
|
||||
- **AWS SDK v3** - DynamoDB client
|
||||
- **Express Validator** - Request validation
|
||||
- **Helmet** - Security headers
|
||||
- **Morgan** - HTTP request logger
|
||||
|
||||
## Project Structure
|
||||
|
||||
```
|
||||
config-email/
|
||||
├── backend/ # Express API server
|
||||
│ ├── server.js # Main server file
|
||||
│ ├── package.json # Backend dependencies
|
||||
│ └── .env # Environment variables
|
||||
├── frontend/ # React application
|
||||
│ ├── src/
|
||||
│ │ ├── components/ # React components
|
||||
│ │ ├── services/ # API service layer
|
||||
│ │ ├── App.jsx # Main app component
|
||||
│ │ ├── main.jsx # Entry point
|
||||
│ │ └── index.css # Global styles
|
||||
│ ├── index.html # HTML template
|
||||
│ ├── package.json # Frontend dependencies
|
||||
│ └── vite.config.js # Vite configuration
|
||||
└── README.md # This file
|
||||
```
|
||||
|
||||
## Setup Instructions
|
||||
|
||||
### Prerequisites
|
||||
|
||||
- Node.js 18+ installed
|
||||
- AWS Account with DynamoDB access
|
||||
- AWS credentials (Access Key ID and Secret Access Key)
|
||||
|
||||
### 1. Install Dependencies
|
||||
|
||||
```bash
|
||||
# Install backend dependencies
|
||||
cd backend
|
||||
npm install
|
||||
|
||||
# Install frontend dependencies
|
||||
cd ../frontend
|
||||
npm install
|
||||
```
|
||||
|
||||
### 2. Configure Environment Variables
|
||||
|
||||
Backend environment variables are already configured in `backend/.env`:
|
||||
- AWS credentials
|
||||
- DynamoDB table name: `email-rules`
|
||||
- Region: `us-east-2`
|
||||
|
||||
Frontend environment variables are set in `frontend/.env`:
|
||||
- API URL: `http://localhost:3001`
|
||||
|
||||
### 3. Start the Application
|
||||
|
||||
**Terminal 1 - Start Backend API:**
|
||||
```bash
|
||||
cd backend
|
||||
npm start
|
||||
```
|
||||
|
||||
The API will start on `http://localhost:3001`
|
||||
|
||||
**Terminal 2 - Start Frontend:**
|
||||
```bash
|
||||
cd frontend
|
||||
npm run dev
|
||||
```
|
||||
|
||||
The UI will start on `http://localhost:3000`
|
||||
|
||||
### 4. Access the Application
|
||||
|
||||
Open your browser and navigate to:
|
||||
```
|
||||
http://localhost:3000
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Managing Email Rules
|
||||
|
||||
1. **Search for an Email**: Enter an email address in the search box and click "Search"
|
||||
2. **Configure Out of Office**:
|
||||
- Toggle the OOO status on/off
|
||||
- Choose between Plain Text or HTML format
|
||||
- Enter your auto-reply message
|
||||
- Preview the message before saving
|
||||
3. **Set Up Forwarding**:
|
||||
- Add email addresses to forward incoming messages
|
||||
- Remove addresses as needed
|
||||
4. **Save Changes**: Click "Save Changes" to update the rules
|
||||
5. **View All Rules**: Click "All Rules" to see all configured email addresses
|
||||
|
||||
## API Endpoints
|
||||
|
||||
### GET /api/rules
|
||||
Get all email rules
|
||||
```bash
|
||||
curl http://localhost:3001/api/rules
|
||||
```
|
||||
|
||||
### GET /api/rules/:email
|
||||
Get rule for specific email
|
||||
```bash
|
||||
curl http://localhost:3001/api/rules/user@example.com
|
||||
```
|
||||
|
||||
### POST /api/rules
|
||||
Create or update a rule
|
||||
```bash
|
||||
curl -X POST http://localhost:3001/api/rules \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"email_address": "user@example.com",
|
||||
"ooo_active": true,
|
||||
"ooo_message": "I am out of office",
|
||||
"ooo_content_type": "text",
|
||||
"forwards": ["forward@example.com"]
|
||||
}'
|
||||
```
|
||||
|
||||
### PUT /api/rules/:email
|
||||
Update existing rule
|
||||
```bash
|
||||
curl -X PUT http://localhost:3001/api/rules/user@example.com \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"ooo_active": false,
|
||||
"forwards": []
|
||||
}'
|
||||
```
|
||||
|
||||
### DELETE /api/rules/:email
|
||||
Delete a rule
|
||||
```bash
|
||||
curl -X DELETE http://localhost:3001/api/rules/user@example.com
|
||||
```
|
||||
|
||||
## DynamoDB Schema
|
||||
|
||||
The `email-rules` table uses the following structure:
|
||||
|
||||
```javascript
|
||||
{
|
||||
email_address: "user@example.com", // Partition Key (String)
|
||||
ooo_active: true, // Boolean
|
||||
ooo_message: "Out of office message", // String
|
||||
ooo_content_type: "text", // String ("text" or "html")
|
||||
forwards: ["email1@example.com"], // List of Strings
|
||||
last_updated: "2025-12-26T12:00:00Z" // ISO 8601 timestamp
|
||||
}
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Backend Development
|
||||
```bash
|
||||
cd backend
|
||||
npm run dev # Uses nodemon for auto-reload
|
||||
```
|
||||
|
||||
### Frontend Development
|
||||
```bash
|
||||
cd frontend
|
||||
npm run dev # Vite hot-reload enabled
|
||||
```
|
||||
|
||||
### Build for Production
|
||||
|
||||
**Frontend:**
|
||||
```bash
|
||||
cd frontend
|
||||
npm run build
|
||||
```
|
||||
|
||||
The production build will be in `frontend/dist/`
|
||||
|
||||
## Security Features
|
||||
|
||||
- **Helmet.js**: Security headers
|
||||
- **CORS**: Configured for cross-origin requests
|
||||
- **Input Validation**: All API endpoints validate input
|
||||
- **AWS Credentials**: Never exposed to frontend
|
||||
- **Environment Variables**: Sensitive data in .env files
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Backend won't start
|
||||
- Check if port 3001 is available
|
||||
- Verify AWS credentials are correct
|
||||
- Ensure DynamoDB table `email-rules` exists
|
||||
|
||||
### Frontend won't connect to API
|
||||
- Verify backend is running on port 3001
|
||||
- Check `VITE_API_URL` in `frontend/.env`
|
||||
- Check browser console for CORS errors
|
||||
|
||||
### DynamoDB errors
|
||||
- Verify AWS credentials have DynamoDB permissions
|
||||
- Ensure table `email-rules` exists in `us-east-2` region
|
||||
- Check AWS credentials are not expired
|
||||
|
||||
## License
|
||||
|
||||
MIT License
|
||||
|
||||
## Support
|
||||
|
||||
For issues and questions, please check the application logs or contact your system administrator.
|
||||
Reference in New Issue
Block a user