A modern, full-stack bulk email sender application built with SvelteKit (frontend) and Hono (backend) using MongoDB Atlas for data persistence.
All assignment objectives have been successfully completed!
git clone <repository-url>
cd assignment-main/assignment-main
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your MongoDB Atlas credentials
cd frontend
npm install
Backend (.env):
# MongoDB Atlas
MONGODB_URI=mongodb+srv://<username>:<password>@<cluster>.mongodb.net/?appName=Email
MONGODB_DB_NAME=bulk_email_sender
# Server
PORT=3000
SESSION_SECRET=your-secure-random-string
# SMTP (Optional - users can configure their own)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
[email protected]
SMTP_PASS=your-app-password
Frontend (frontend/.env):
VITE_API_URL=http://localhost:3000
npm run dev
Backend runs on: http://localhost:3000
cd frontend
npm run dev
Frontend runs on: http://localhost:5173
users
{
_id: ObjectId,
email: String (unique),
name: String,
passwordHash: String,
createdAt: Date,
lastLogin: Date,
isActive: Boolean
}
sessions
{
_id: ObjectId,
userId: ObjectId,
token: String (unique),
expiresAt: Date,
createdAt: Date
}
smtpConfigs
{
_id: ObjectId,
userId: ObjectId,
name: String,
host: String,
port: Number,
secure: Boolean,
user: String,
pass: String,
fromEmail: String,
fromName: String,
isDefault: Boolean,
createdAt: Date,
updatedAt: Date
}
emailLogs
{
_id: ObjectId,
userId: ObjectId,
email: String,
status: String,
message: String,
timestamp: Date,
subject: String
}
POST /auth/register - Register new userPOST /auth/login - Login userPOST /auth/logout - Logout userGET /auth/me - Get current userGET /config/smtp - Get all user SMTP configsPOST /config/smtp - Create new SMTP configPUT /config/smtp/:id - Update SMTP configDELETE /config/smtp/:id - Delete SMTP configPOST /config/smtp/:id/default - Set as defaultPOST /send - Send bulk emails with Excel fileGET /send/batch-status - Get batch statusGET /report - Get email logs and statsDELETE /report/clear - Clear all logsGET /dashboard/poll-status - Check polling statusGET /dashboard/stats - Get dashboard statisticsGET /api-docs - Swagger UI for interactive API testingGET /swagger.json - OpenAPI specificationassignment-main/
āāā src/ # Backend
ā āāā app.ts # Main app entry
ā āāā types.ts # TypeScript types
ā āāā middleware/
ā ā āāā auth.ts # Auth middleware
ā āāā routes/
ā ā āāā auth.ts # Auth routes
ā ā āāā config.ts # SMTP config routes
ā ā āāā send.ts # Email sending routes
ā ā āāā report.ts # Reports routes
ā ā āāā dashboard.ts # Dashboard routes
ā āāā services/
ā āāā mongoDatabase.ts # MongoDB service
āāā frontend/ # SvelteKit Frontend
ā āāā src/
ā ā āāā routes/
ā ā ā āāā +layout.svelte
ā ā ā āāā +page.svelte
ā ā ā āāā login/
ā ā ā āāā register/
ā ā ā āāā dashboard/
ā ā ā āāā send/
ā ā ā āāā config/
ā ā ā āāā reports/
ā ā āāā lib/
ā ā āāā api/ # API client
ā ā āāā stores/ # Svelte stores
ā ā āāā components/ # UI components
ā āāā static/
āāā uploads/ # Uploaded files
āāā logs/ # Email logs
āāā .env # Environment variables
āāā package.json
# Kill process on port 3000
netstat -ano | findstr :3000
taskkill /F /PID <PID>
ā Backend running on Node.js with MongoDB Atlas ā Frontend running on SvelteKit ā User authentication working ā SMTP configuration management working ā Email sending with Excel upload working ā Rich text editor (Quill) integrated ā Variable replacement working ā Reports displaying correctly ā Responsive design ā No old frontend code (public/ folder removed) ā All API endpoints functional ā Swagger UI available at /api-docs for API testing
MIT License
Built with ā¤ļø using SvelteKit, Hono, and MongoDB Atlas