Skip to content

MusfiqDehan/Agentic-Email-Campaign-Management-Platform

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

326 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“§ Agentic Email Campaign Management Platform

A comprehensive, modern email marketing platform with AI-powered features for managing email campaigns, contact lists, and email templates. Built with Django REST API backend and Next.js frontend with full dark/light theme support.

License Python Django Next.js React TypeScript

Homepage of website


πŸ“‘ Table of Contents


✨ Features

🎯 Campaign Management

  • Create, edit, and launch email campaigns
  • Multi-step campaign wizard with live preview
  • Campaign analytics and tracking
  • Schedule campaigns for later

πŸ‘₯ Contact Management

  • Import contacts from CSV
  • Create and manage contact lists
  • Contact segmentation
  • Unsubscribe management

πŸ“ Template Builder

  • Rich text email editor with HTML support
  • AI-powered content generation
  • Template categories and tags
  • Preview before sending

πŸ€– AI Agent

  • Voice-enabled AI assistant
  • Natural language contact management
  • Smart suggestions and automation

🎨 Modern UI/UX

  • Responsive design for all devices
  • Dark/Light theme with system preference detection
  • Smooth animations and transitions
  • Custom styled dialogs and notifications

πŸ” Security

  • JWT-based authentication
  • Email verification
  • Secure password reset
  • Role-based permissions

πŸ›  Tech Stack

Backend

Technology Purpose
Python 3.11+ Core programming language
Django 5.2 Web framework
Django REST Framework 3.15 REST API development
PostgreSQL Primary database
Redis Caching & Celery broker
Celery 5.3 Async task queue (email sending)
Celery Beat Scheduled tasks
SimpleJWT JWT authentication
drf-spectacular OpenAPI documentation
Gunicorn/Daphne Production WSGI/ASGI servers
Sentry Error tracking

Frontend

Technology Purpose
Next.js 16 React framework with App Router
React 19 UI library
TypeScript 5 Type-safe JavaScript
Tailwind CSS 4 Utility-first CSS framework
Radix UI Accessible UI primitives
React Hook Form + Zod Form handling & validation
next-themes Dark/Light theme management
Lucide React Icon library
Sonner Toast notifications
Axios HTTP client
React Quill Rich text editor

DevOps & Tooling

Technology Purpose
Docker & Docker Compose Containerization
Nginx Reverse proxy (production)
GitHub Actions CI/CD pipelines
ESLint JavaScript/TypeScript linting
Black & isort Python code formatting
Pytest Python testing

πŸ— Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         CLIENT LAYER                            β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Next.js 16 (React 19 + TypeScript)                            β”‚
β”‚  β”œβ”€β”€ App Router (Server & Client Components)                   β”‚
β”‚  β”œβ”€β”€ Tailwind CSS + Radix UI                                   β”‚
β”‚  β”œβ”€β”€ Theme Provider (Dark/Light)                               β”‚
β”‚  └── Axios HTTP Client                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό REST API (JSON)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         API LAYER                               β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Django REST Framework                                          β”‚
β”‚  β”œβ”€β”€ JWT Authentication (SimpleJWT)                             β”‚
β”‚  β”œβ”€β”€ ViewSets & Serializers                                     β”‚
β”‚  β”œβ”€β”€ Permission Classes                                         β”‚
β”‚  └── API Versioning                                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      APPLICATION LAYER                          β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  Django 5.2                                                     β”‚
β”‚  β”œβ”€β”€ Authentication App (Users, JWT, Email Verification)       β”‚
β”‚  β”œβ”€β”€ Campaigns App (Campaigns, Templates, Contacts, Providers) β”‚
β”‚  └── Utils App (Common utilities, Base models)                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β–Ό               β–Ό               β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   PostgreSQL     β”‚ β”‚    Redis     β”‚ β”‚     Celery       β”‚
β”‚   (Database)     β”‚ β”‚   (Cache)    β”‚ β”‚  (Task Queue)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                              β”‚
                                              β–Ό
                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                    β”‚  Email Services  β”‚
                                    β”‚  (SMTP/SES/etc)  β”‚
                                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ“ Project Structure

Root Directory

Email-Campaign-Management-Platform/
β”œβ”€β”€ πŸ“„ README.md                 # This documentation
β”œβ”€β”€ πŸ“„ LICENSE                   # MIT License
β”œβ”€β”€ πŸ“„ .gitignore               # Git ignore rules
β”œβ”€β”€ πŸ“ backend/                 # Django REST API
β”œβ”€β”€ πŸ“ frontend/                # Next.js Application
└── πŸ“ frontend-newsletter/     # Static newsletter widget

Backend Structure

backend/
β”œβ”€β”€ πŸ“„ manage.py                 # Django management script
β”œβ”€β”€ πŸ“„ requirements.txt          # Python dependencies
β”œβ”€β”€ πŸ“„ Dockerfile               # Backend Docker image
β”œβ”€β”€ πŸ“„ docker-compose.yml       # Backend services composition
β”œβ”€β”€ πŸ“„ docker_entrypoint.sh     # Container startup script
β”œβ”€β”€ πŸ“„ core.py                  # Core utilities
β”‚
β”œβ”€β”€ πŸ“ config/          # Django Project Configuration
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ settings.py             # Django settings
β”‚   β”œβ”€β”€ urls.py                 # Root URL configuration
β”‚   β”œβ”€β”€ wsgi.py                 # WSGI application
β”‚   β”œβ”€β”€ asgi.py                 # ASGI application
β”‚   └── celery.py               # Celery configuration
β”‚
β”œβ”€β”€ πŸ“ apps/                    # Django Applications
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ“ authentication/      # User Authentication
β”‚   β”‚   β”œβ”€β”€ models.py           # User, Organization models
β”‚   β”‚   β”œβ”€β”€ views.py            # Auth API views
β”‚   β”‚   β”œβ”€β”€ serializers.py      # DRF serializers
β”‚   β”‚   β”œβ”€β”€ urls.py             # Auth endpoints
β”‚   β”‚   β”œβ”€β”€ permissions.py      # Custom permissions
β”‚   β”‚   β”œβ”€β”€ signals.py          # Django signals
β”‚   β”‚   β”œβ”€β”€ services/           # Business logic services
β”‚   β”‚   └── migrations/         # Database migrations
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ“ campaigns/           # Campaign Management
β”‚   β”‚   β”œβ”€β”€ models/             # Campaign, Template, Contact models
β”‚   β”‚   β”œβ”€β”€ views/              # Campaign API views
β”‚   β”‚   β”œβ”€β”€ serializers/        # DRF serializers
β”‚   β”‚   β”œβ”€β”€ urls.py             # Campaign endpoints
β”‚   β”‚   β”œβ”€β”€ tasks.py            # Celery tasks
β”‚   β”‚   β”œβ”€β”€ signals.py          # Django signals
β”‚   β”‚   β”œβ”€β”€ constants.py        # App constants
β”‚   β”‚   β”œβ”€β”€ exceptions.py       # Custom exceptions
β”‚   β”‚   β”œβ”€β”€ backends.py         # Email backends
β”‚   β”‚   β”œβ”€β”€ utils/              # Helper utilities
β”‚   β”‚   └── migrations/         # Database migrations
β”‚   β”‚
β”‚   └── πŸ“ utils/               # Shared Utilities
β”‚       β”œβ”€β”€ base_models.py      # Abstract base models
β”‚       β”œβ”€β”€ pagination.py       # Custom pagination
β”‚       β”œβ”€β”€ filters.py          # Query filters
β”‚       β”œβ”€β”€ responses.py        # Response helpers
β”‚       β”œβ”€β”€ throttles.py        # Rate limiting
β”‚       β”œβ”€β”€ mixins.py           # View mixins
β”‚       └── exceptions.py       # Base exceptions
β”‚
β”œβ”€β”€ πŸ“ core/                    # Core Module
β”‚   β”œβ”€β”€ utils.py                # Utility functions
β”‚   β”œβ”€β”€ mixins.py               # Model mixins
β”‚   └── exceptions.py           # Core exceptions
β”‚
β”œβ”€β”€ πŸ“ static/                  # Static files
β”œβ”€β”€ πŸ“ media/                   # User uploads
└── πŸ“ media_files/             # Media storage
    β”œβ”€β”€ logos/                  # Organization logos
    └── profiles/               # Profile images

Frontend Structure

frontend/
β”œβ”€β”€ πŸ“„ package.json              # Node.js dependencies
β”œβ”€β”€ πŸ“„ tsconfig.json            # TypeScript configuration
β”œβ”€β”€ πŸ“„ next.config.ts           # Next.js configuration
β”œβ”€β”€ πŸ“„ postcss.config.mjs       # PostCSS configuration
β”œβ”€β”€ πŸ“„ eslint.config.mjs        # ESLint configuration
β”œβ”€β”€ πŸ“„ Dockerfile               # Frontend Docker image
β”œβ”€β”€ πŸ“„ docker-compose.yml       # Frontend services composition
β”‚
β”œβ”€β”€ πŸ“ app/                     # Next.js App Router
β”‚   β”œβ”€β”€ πŸ“„ layout.tsx           # Root layout
β”‚   β”œβ”€β”€ πŸ“„ page.tsx             # Landing page
β”‚   β”œβ”€β”€ πŸ“„ globals.css          # Global styles & theme
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ“ login/               # Login page
β”‚   β”‚   └── page.tsx
β”‚   β”œβ”€β”€ πŸ“ signup/              # Signup page
β”‚   β”‚   └── page.tsx
β”‚   β”œβ”€β”€ πŸ“ verify-email/        # Email verification
β”‚   β”‚   └── page.tsx
β”‚   β”‚
β”‚   └── πŸ“ dashboard/           # Protected Dashboard
β”‚       β”œβ”€β”€ layout.tsx          # Dashboard layout
β”‚       β”œβ”€β”€ page.tsx            # Dashboard home
β”‚       β”‚
β”‚       β”œβ”€β”€ πŸ“ campaigns/       # Campaign Management
β”‚       β”‚   β”œβ”€β”€ page.tsx        # Campaign list
β”‚       β”‚   β”œβ”€β”€ πŸ“ new/         # Create campaign
β”‚       β”‚   └── πŸ“ [id]/        # Campaign details
β”‚       β”‚
β”‚       β”œβ”€β”€ πŸ“ contacts/        # Contact Management
β”‚       β”‚   β”œβ”€β”€ page.tsx        # Contact list
β”‚       β”‚   β”œβ”€β”€ πŸ“ new/         # Add contact
β”‚       β”‚   β”œβ”€β”€ πŸ“ import/      # Import contacts
β”‚       β”‚   └── πŸ“ [id]/        # Contact details
β”‚       β”‚
β”‚       β”œβ”€β”€ πŸ“ templates/       # Template Management
β”‚       β”‚   β”œβ”€β”€ page.tsx        # Template list
β”‚       β”‚   └── πŸ“ new/         # Create template
β”‚       β”‚
β”‚       β”œβ”€β”€ πŸ“ settings/        # Settings
β”‚       β”‚   └── πŸ“ providers/   # Email provider config
β”‚       β”‚       β”œβ”€β”€ page.tsx
β”‚       β”‚       └── πŸ“ new/
β”‚       β”‚
β”‚       └── πŸ“ profile/         # User profile
β”‚           └── page.tsx
β”‚
β”œβ”€β”€ πŸ“ components/              # React Components
β”‚   β”œβ”€β”€ πŸ“„ editor.tsx           # Rich text editor
β”‚   β”œβ”€β”€ πŸ“„ providers.tsx        # App providers
β”‚   β”‚
β”‚   β”œβ”€β”€ πŸ“ dashboard/           # Dashboard Components
β”‚   β”‚   β”œβ”€β”€ sidebar.tsx         # Navigation sidebar
β”‚   β”‚   β”œβ”€β”€ header.tsx          # Top header bar
β”‚   β”‚   └── FloatingAgentInput.tsx  # AI agent input
β”‚   β”‚
β”‚   └── πŸ“ ui/                  # UI Components (Radix-based)
β”‚       β”œβ”€β”€ alert-dialog.tsx    # Alert dialogs
β”‚       β”œβ”€β”€ alert.tsx           # Alert messages
β”‚       β”œβ”€β”€ avatar.tsx          # User avatars
β”‚       β”œβ”€β”€ badge.tsx           # Status badges
β”‚       β”œβ”€β”€ button.tsx          # Buttons
β”‚       β”œβ”€β”€ card.tsx            # Card containers
β”‚       β”œβ”€β”€ checkbox.tsx        # Checkboxes
β”‚       β”œβ”€β”€ dialog.tsx          # Modal dialogs
β”‚       β”œβ”€β”€ dropdown-menu.tsx   # Dropdown menus
β”‚       β”œβ”€β”€ form.tsx            # Form components
β”‚       β”œβ”€β”€ input.tsx           # Text inputs
β”‚       β”œβ”€β”€ label.tsx           # Form labels
β”‚       β”œβ”€β”€ select.tsx          # Select dropdowns
β”‚       β”œβ”€β”€ table.tsx           # Data tables
β”‚       β”œβ”€β”€ tabs.tsx            # Tab navigation
β”‚       β”œβ”€β”€ textarea.tsx        # Text areas
β”‚       β”œβ”€β”€ theme-toggle.tsx    # Theme switcher
β”‚       β”œβ”€β”€ toast.tsx           # Toast notifications
β”‚       └── toaster.tsx         # Toast container
β”‚
β”œβ”€β”€ πŸ“ contexts/                # React Contexts
β”‚   └── AuthContext.tsx         # Authentication context
β”‚
β”œβ”€β”€ πŸ“ lib/                     # Utility Libraries
β”‚   β”œβ”€β”€ axios.ts                # Axios HTTP client
β”‚   └── utils.ts                # Helper functions
β”‚
└── πŸ“ public/                  # Static Assets

🐳 Quick Start with Docker

Prerequisites

  • Docker Engine 20.10+
  • Docker Compose 2.0+

Option 1: Run Full Stack (Recommended)

# Clone the repository
git clone https://github.com/MusfiqDehan/Agentic-Email-Campaign-Management-Platform.git
cd Agentic-Email-Campaign-Management-Platform

# Create environment files
cp backend/.env.example backend/.env.local

# Start all services from root
docker-compose -f backend/docker-compose.yml up -d
docker-compose -f frontend/docker-compose.yml up -d

# Access applications
# Backend API: http://localhost:8001
# Frontend:    http://localhost:3001

Option 2: Run Backend Only

cd backend

# Create environment file
cp .env.example .env.local

# Start backend services (Django, PostgreSQL, Redis, Celery)
docker-compose up -d

# View logs
docker-compose logs -f web

# Run migrations
docker-compose exec web python manage.py migrate

# Create superuser
docker-compose exec web python manage.py createsuperuser

# Stop services
docker-compose down

Option 3: Run Frontend Only

cd frontend

# Start frontend service
docker-compose up -d

# View logs
docker-compose logs -f frontend

# Stop service
docker-compose down

Docker Commands Reference

# Backend commands
docker-compose -f backend/docker-compose.yml exec web python manage.py migrate
docker-compose -f backend/docker-compose.yml exec web python manage.py createsuperuser
docker-compose -f backend/docker-compose.yml exec web python manage.py shell

# View logs
docker-compose -f backend/docker-compose.yml logs -f web
docker-compose -f frontend/docker-compose.yml logs -f frontend

# Rebuild images
docker-compose -f backend/docker-compose.yml build --no-cache
docker-compose -f frontend/docker-compose.yml build --no-cache

# Stop all
docker-compose -f backend/docker-compose.yml down
docker-compose -f frontend/docker-compose.yml down

πŸ”§ Manual Development Setup

Backend Setup

cd backend

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # Linux/Mac
# .venv\Scripts\activate   # Windows

# Install dependencies
pip install -r requirements.txt

# Setup environment
cp .env.example .env.local
# Edit .env.local with your settings

# Run migrations
python manage.py migrate

# Create superuser
python manage.py createsuperuser

# Start development server
python manage.py runserver

# Start Celery worker (in another terminal)
celery -A config worker -l info

# Start Celery beat (in another terminal)
celery -A config beat -l info

Frontend Setup

cd frontend

# Install dependencies
npm install

# Start development server
npm run dev

# Build for production
npm run build

# Start production server
npm start

πŸ“š API Documentation

Once the backend is running, access the API documentation at:

Main API Endpoints

Endpoint Method Description
/api/auth/register/ POST User registration
/api/auth/login/ POST User login (JWT)
/api/auth/token/refresh/ POST Refresh JWT token
/campaigns/ GET, POST List/Create campaigns
/campaigns/{id}/ GET, PUT, DELETE Campaign CRUD
/campaigns/{id}/launch/ POST Launch campaign
/campaigns/templates/ GET, POST Email templates
/campaigns/contact-lists/ GET, POST Contact lists
/campaigns/contacts/ GET, POST Contacts
/campaigns/org/providers/ GET, POST Email providers

🎨 Theme Support

The application supports both dark and light themes with:

  • System preference detection
  • Manual toggle switch
  • Persistent preference storage
  • Smooth transitions

Toggle the theme using the sun/moon icon in the header.


🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/your-feature-name
  3. Make your changes
  4. Run tests and linting
  5. Commit your changes: git commit -m 'Add some feature'
  6. Push to the branch: git push origin feature/your-feature-name
  7. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ‘€ Author

Musfiq Dehan


Made with ❀️ for email marketers everywhere

About

πŸ“§ A comprehensive, modern email marketing platform with AI-powered features for managing email campaigns, contact lists, and email templates. Built with Django REST API backend and Next.js frontend

Resources

License

Stars

Watchers

Forks

Contributors