A full-stack web application for managing email campaigns with profile and list management capabilities.
- Backend: Flask (Python) with SQLAlchemy ORM
- Frontend: React with PWA support
- Database: SQLite (development) / PostgreSQL (production)
- Email Service: Postmark (planned integration)
emailWeb/
├── backend/ # Flask backend application
│ ├── app.py # Main Flask application
│ ├── models.py # Database models
│ ├── migrations/ # Database migrations
│ └── email_campaign.db # SQLite database
├── emailweb/ # Python virtual environment
│ ├── bin/
│ ├── lib/
│ └── include/
└── frontend/ # React frontend application
├── src/
├── public/
└── package.json
- Python 3.8+
- Node.js 16+
- npm or yarn
-
Create and Activate virtual environment:
-
Install dependencies:
pip install -r ../requirements.txt
-
Navigate to backend directory:
cd backend -
Initialize database:
export FLASK_APP=app.py flask db init flask db migrate -m "Initial migration" flask db upgrade
-
Start backend server:
flask run --host=0.0.0.0 --port=5001
-
Navigate to frontend directory:
cd frontend -
Install dependencies:
npm install
-
Start development server:
npm start
-
Open application:
- Backend: http://localhost:5001
- Frontend: http://localhost:3000
-
Profile Management
- Create, list, and delete profiles
- Store email, name, and custom fields
- JSON-based custom field storage
-
List Management
- Create, list, and delete lists
- Many-to-many relationship with profiles
- Description and metadata support
-
Campaign Management
- Create campaigns with HTML content
- Associate campaigns with target lists
- Campaign status tracking (draft, scheduled, sending, sent, failed)
- Scheduled sending support
-
Database Integration
- SQLite database with proper relationships
- UTC timestamp handling
- Migration system for schema changes
-
Email Integration
- Postmark API integration
- Email delivery tracking
- Webhook handling for delivery status
-
Advanced Features
- Flow automation
- Event tracking
- Analytics and reporting
- User authentication
GET /api/health- Backend health status
GET /api/profiles- List all profilesPOST /api/profiles- Create new profileDELETE /api/profiles/{id}- Delete profile
GET /api/lists- List all listsPOST /api/lists- Create new listDELETE /api/lists/{id}- Delete list
GET /api/campaigns- List all campaignsPOST /api/campaigns- Create new campaignDELETE /api/campaigns/{id}- Delete campaign
id(Primary Key)email(Unique, indexed)namecustom_fields(JSON string)created_at,updated_at(UTC timestamps)
id(Primary Key)namedescriptioncreated_at,updated_at(UTC timestamps)
id(Primary Key)name,subject,content_htmlstatus(draft, scheduled, sending, sent, failed)scheduled_time(UTC datetime)target_list_id(Foreign Key to Lists)created_at,updated_at(UTC timestamps)
id(Primary Key)campaign_id,profile_id(Foreign Keys)postmark_message_idstatus(sent, delivered, opened, clicked, bounced, failed)timestamp,event_details(JSON)
-
Database Migrations:
flask db migrate -m "Description of changes" flask db upgrade -
Running Tests:
# Add test files and run with pytest pytest
-
Adding Dependencies:
npm install package-name
-
Building for Production:
npm run build
-
Database Migration:
- Switch from SQLite to PostgreSQL
- Update database URI in configuration
-
Environment Variables:
- Set
FLASK_ENV=production - Configure Postmark API keys
- Set up proper CORS origins
- Set
-
Scaling:
- Use multiple Flask instances behind load balancer
- Implement Celery for async task processing
- Add Redis for caching
For questions or issues, please open an issue in the repository.