From 0bac014e4302f8c6cd8d99869745756fb4af3ba6 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 22 Sep 2025 00:05:45 +0000
Subject: [PATCH 1/4] Initial plan
From 95cb39ce1b9f8f777186bc25eec293349e6b9ac3 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 22 Sep 2025 00:17:10 +0000
Subject: [PATCH 2/4] Implement complete email notification system for
executive hiring
Co-authored-by: TommyOh0428 <101218671+TommyOh0428@users.noreply.github.com>
---
.env.example | 13 +
.gitignore | 33 +
README.md | 222 ++++++-
data/applications.json | 34 +
data/teams.json | 51 ++
index.js | 68 ++
models/Application.js | 50 ++
models/Team.js | 53 ++
package-lock.json | 1320 ++++++++++++++++++++++++++++++++++++++
package.json | 25 +
routes/applications.js | 201 ++++++
routes/teams.js | 239 +++++++
services/dataService.js | 176 +++++
services/emailService.js | 170 +++++
14 files changed, 2654 insertions(+), 1 deletion(-)
create mode 100644 .env.example
create mode 100644 .gitignore
create mode 100644 data/applications.json
create mode 100644 data/teams.json
create mode 100644 index.js
create mode 100644 models/Application.js
create mode 100644 models/Team.js
create mode 100644 package-lock.json
create mode 100644 package.json
create mode 100644 routes/applications.js
create mode 100644 routes/teams.js
create mode 100644 services/dataService.js
create mode 100644 services/emailService.js
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..ab981f1
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,13 @@
+# Server Configuration
+PORT=3000
+NODE_ENV=development
+
+# Email Configuration
+EMAIL_HOST=smtp.gmail.com
+EMAIL_PORT=587
+EMAIL_USER=your-email@gmail.com
+EMAIL_PASS=your-app-password
+EMAIL_FROM=noreply@yourcompany.com
+
+# Application Configuration
+APP_NAME=Executive Hiring Notification System
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..35e8174
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,33 @@
+# Dependencies
+node_modules/
+
+# Environment variables
+.env
+
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Coverage directory used by tools like istanbul
+coverage/
+
+# Temporary folders
+tmp/
+temp/
+
+# IDE
+.vscode/
+.idea/
+
+# OS
+.DS_Store
+Thumbs.db
\ No newline at end of file
diff --git a/README.md b/README.md
index 7fedc7e..323719a 100644
--- a/README.md
+++ b/README.md
@@ -1,2 +1,222 @@
# Email-Backend
-Backend server to receive notification via email for any applicants applying
+
+Backend server to receive notification via email for any applicants applying for executive and project lead positions.
+
+## Features
+
+- 📧 **Automated Email Notifications**: Sends email notifications to executives and project leads when new applications are submitted
+- 🏢 **Team Management**: Organize teams with their respective executives and project leads
+- 📊 **Application Tracking**: Track application status and view statistics
+- 🔧 **Easy Configuration**: Simple environment-based configuration
+- 🚀 **RESTful API**: Clean REST API for integration with frontend applications
+
+## Quick Start
+
+### 1. Installation
+
+```bash
+npm install
+```
+
+### 2. Configuration
+
+Copy the example environment file and configure your settings:
+
+```bash
+cp .env.example .env
+```
+
+Edit `.env` with your email configuration:
+
+```env
+# Server Configuration
+PORT=3000
+NODE_ENV=development
+
+# Email Configuration (Gmail example)
+EMAIL_HOST=smtp.gmail.com
+EMAIL_PORT=587
+EMAIL_USER=your-email@gmail.com
+EMAIL_PASS=your-app-password
+EMAIL_FROM=noreply@yourcompany.com
+
+# Application Configuration
+APP_NAME=Executive Hiring Notification System
+```
+
+### 3. Start the Server
+
+```bash
+# Development mode with auto-reload
+npm run dev
+
+# Production mode
+npm start
+```
+
+The server will start on `http://localhost:3000` (or your configured PORT).
+
+## API Endpoints
+
+### Applications
+
+- `POST /api/applications` - Submit a new application
+- `GET /api/applications` - Get all applications (with optional filtering)
+- `GET /api/applications/:id` - Get specific application
+- `PATCH /api/applications/:id/status` - Update application status
+- `GET /api/applications/stats/summary` - Get application statistics
+
+### Teams
+
+- `GET /api/teams` - Get all teams
+- `GET /api/teams/:id` - Get specific team
+- `POST /api/teams` - Create new team
+- `PUT /api/teams/:id` - Update team
+- `DELETE /api/teams/:id` - Delete team
+- `POST /api/teams/:id/test-email` - Send test email notification
+- `GET /api/teams/email/status` - Check email service status
+
+### System
+
+- `GET /health` - Health check endpoint
+- `GET /` - API information
+
+## Usage Examples
+
+### Submit an Application
+
+```bash
+curl -X POST http://localhost:3000/api/applications \
+ -H "Content-Type: application/json" \
+ -d '{
+ "applicantName": "John Doe",
+ "applicantEmail": "john@example.com",
+ "position": "Senior Software Engineer",
+ "team": "Engineering",
+ "resumeUrl": "https://example.com/resume.pdf",
+ "coverLetter": "I am excited to apply for this position..."
+ }'
+```
+
+### Create a New Team
+
+```bash
+curl -X POST http://localhost:3000/api/teams \
+ -H "Content-Type: application/json" \
+ -d '{
+ "name": "Data Science",
+ "description": "Data science and analytics team",
+ "executives": ["cdo@company.com"],
+ "projectLeads": ["data-lead@company.com"]
+ }'
+```
+
+### Get All Applications for a Team
+
+```bash
+curl "http://localhost:3000/api/applications?team=Engineering"
+```
+
+## Data Models
+
+### Application
+
+```json
+{
+ "id": "unique-id",
+ "applicantName": "John Doe",
+ "applicantEmail": "john@example.com",
+ "position": "Senior Software Engineer",
+ "team": "Engineering",
+ "resumeUrl": "https://example.com/resume.pdf",
+ "coverLetter": "Cover letter text...",
+ "appliedAt": "2024-01-01T12:00:00.000Z",
+ "status": "pending"
+}
+```
+
+### Team
+
+```json
+{
+ "id": "unique-id",
+ "name": "Engineering",
+ "description": "Software development team",
+ "executives": ["cto@company.com"],
+ "projectLeads": ["eng-lead@company.com"],
+ "createdAt": "2024-01-01T12:00:00.000Z"
+}
+```
+
+## Email Configuration
+
+The system supports various email providers. Here are some common configurations:
+
+### Gmail
+
+```env
+EMAIL_HOST=smtp.gmail.com
+EMAIL_PORT=587
+EMAIL_USER=your-email@gmail.com
+EMAIL_PASS=your-app-password # Use App Password, not regular password
+```
+
+### Outlook/Hotmail
+
+```env
+EMAIL_HOST=smtp-mail.outlook.com
+EMAIL_PORT=587
+EMAIL_USER=your-email@outlook.com
+EMAIL_PASS=your-password
+```
+
+### Custom SMTP
+
+```env
+EMAIL_HOST=your-smtp-server.com
+EMAIL_PORT=587
+EMAIL_USER=your-email@domain.com
+EMAIL_PASS=your-password
+```
+
+## Development
+
+### Project Structure
+
+```
+├── index.js # Main server file
+├── models/ # Data models
+│ ├── Application.js
+│ └── Team.js
+├── routes/ # API routes
+│ ├── applications.js
+│ └── teams.js
+├── services/ # Business logic
+│ ├── emailService.js
+│ └── dataService.js
+└── data/ # JSON data storage
+ ├── applications.json
+ └── teams.json
+```
+
+### Default Teams
+
+The system comes with three pre-configured teams:
+
+1. **Engineering** - Software development and technical roles
+2. **Product** - Product management and design roles
+3. **Marketing** - Marketing and growth roles
+
+You can modify these or add new teams via the API.
+
+## Contributing
+
+1. Fork the repository
+2. Create a feature branch
+3. Make your changes
+4. Test thoroughly
+5. Submit a pull request
+
+## License
+
+MIT License
diff --git a/data/applications.json b/data/applications.json
new file mode 100644
index 0000000..82837e6
--- /dev/null
+++ b/data/applications.json
@@ -0,0 +1,34 @@
+[
+ {
+ "id": "mfudkrnfy4ouj7erm18",
+ "applicantName": "John Doe",
+ "applicantEmail": "john@example.com",
+ "position": "Senior Software Engineer",
+ "team": "Engineering",
+ "resumeUrl": "https://example.com/resume.pdf",
+ "coverLetter": "I am excited to apply for this position and believe my experience in full-stack development would be valuable to your team.",
+ "appliedAt": "2025-09-22T00:15:34.395Z",
+ "status": "pending"
+ },
+ {
+ "id": "mfudlgi4z6nn9ag2e2k",
+ "applicantName": "Jane Smith",
+ "applicantEmail": "jane@example.com",
+ "position": "Product Manager",
+ "team": "Product",
+ "coverLetter": "I have 5 years of experience in product management and am passionate about building user-centric products.",
+ "appliedAt": "2025-09-22T00:16:06.604Z",
+ "status": "pending"
+ },
+ {
+ "id": "mfudlzhcf4vmuzsq51",
+ "applicantName": "Alice Johnson",
+ "applicantEmail": "alice@example.com",
+ "position": "Senior Data Scientist",
+ "team": "Data Science",
+ "resumeUrl": "https://example.com/alice-resume.pdf",
+ "coverLetter": "I have extensive experience in machine learning and statistical analysis, with a PhD in Statistics and 3 years at a leading tech company.",
+ "appliedAt": "2025-09-22T00:16:31.200Z",
+ "status": "pending"
+ }
+]
\ No newline at end of file
diff --git a/data/teams.json b/data/teams.json
new file mode 100644
index 0000000..d57b644
--- /dev/null
+++ b/data/teams.json
@@ -0,0 +1,51 @@
+[
+ {
+ "id": "engineering",
+ "name": "Engineering",
+ "description": "Software development and technical roles",
+ "executives": [
+ "cto@company.com"
+ ],
+ "projectLeads": [
+ "eng-lead@company.com"
+ ],
+ "createdAt": "2025-09-22T00:11:57.322Z"
+ },
+ {
+ "id": "product",
+ "name": "Product",
+ "description": "Product management and design roles",
+ "executives": [
+ "cpo@company.com"
+ ],
+ "projectLeads": [
+ "product-lead@company.com"
+ ],
+ "createdAt": "2025-09-22T00:11:57.322Z"
+ },
+ {
+ "id": "marketing",
+ "name": "Marketing",
+ "description": "Marketing and growth roles",
+ "executives": [
+ "cmo@company.com"
+ ],
+ "projectLeads": [
+ "marketing-lead@company.com"
+ ],
+ "createdAt": "2025-09-22T00:11:57.322Z"
+ },
+ {
+ "id": "mfudlsejt3id23x2dym",
+ "name": "Data Science",
+ "description": "Data science and analytics team",
+ "executives": [
+ "cdo@company.com"
+ ],
+ "projectLeads": [
+ "data-lead@company.com",
+ "analytics-lead@company.com"
+ ],
+ "createdAt": "2025-09-22T00:16:22.027Z"
+ }
+]
\ No newline at end of file
diff --git a/index.js b/index.js
new file mode 100644
index 0000000..783ab9a
--- /dev/null
+++ b/index.js
@@ -0,0 +1,68 @@
+const express = require('express');
+const cors = require('cors');
+const helmet = require('helmet');
+const morgan = require('morgan');
+require('dotenv').config();
+
+const applicationRoutes = require('./routes/applications');
+const teamRoutes = require('./routes/teams');
+
+const app = express();
+const PORT = process.env.PORT || 3000;
+
+// Middleware
+app.use(helmet());
+app.use(cors());
+app.use(morgan('combined'));
+app.use(express.json({ limit: '10mb' }));
+app.use(express.urlencoded({ extended: true }));
+
+// Routes
+app.use('/api/applications', applicationRoutes);
+app.use('/api/teams', teamRoutes);
+
+// Health check endpoint
+app.get('/health', (req, res) => {
+ res.json({
+ status: 'healthy',
+ timestamp: new Date().toISOString(),
+ service: 'Email Backend'
+ });
+});
+
+// Root endpoint
+app.get('/', (req, res) => {
+ res.json({
+ message: 'Executive Hiring Email Notification System',
+ version: '1.0.0',
+ endpoints: {
+ health: '/health',
+ applications: '/api/applications',
+ teams: '/api/teams'
+ }
+ });
+});
+
+// Error handling middleware
+app.use((err, req, res, next) => {
+ console.error(err.stack);
+ res.status(500).json({
+ error: 'Something went wrong!',
+ message: process.env.NODE_ENV === 'development' ? err.message : 'Internal server error'
+ });
+});
+
+// 404 handler
+app.use((req, res) => {
+ res.status(404).json({
+ error: 'Route not found',
+ path: req.originalUrl
+ });
+});
+
+app.listen(PORT, () => {
+ console.log(`🚀 Email Backend server running on port ${PORT}`);
+ console.log(`📧 Environment: ${process.env.NODE_ENV || 'development'}`);
+});
+
+module.exports = app;
\ No newline at end of file
diff --git a/models/Application.js b/models/Application.js
new file mode 100644
index 0000000..8d0017d
--- /dev/null
+++ b/models/Application.js
@@ -0,0 +1,50 @@
+class Application {
+ constructor(data) {
+ this.id = data.id || this.generateId();
+ this.applicantName = data.applicantName;
+ this.applicantEmail = data.applicantEmail;
+ this.position = data.position;
+ this.team = data.team;
+ this.resumeUrl = data.resumeUrl;
+ this.coverLetter = data.coverLetter;
+ this.appliedAt = data.appliedAt || new Date().toISOString();
+ this.status = data.status || 'pending';
+ }
+
+ generateId() {
+ return Date.now().toString(36) + Math.random().toString(36).substr(2);
+ }
+
+ validate() {
+ const required = ['applicantName', 'applicantEmail', 'position', 'team'];
+ const missing = required.filter(field => !this[field]);
+
+ if (missing.length > 0) {
+ throw new Error(`Missing required fields: ${missing.join(', ')}`);
+ }
+
+ // Basic email validation
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+ if (!emailRegex.test(this.applicantEmail)) {
+ throw new Error('Invalid email format');
+ }
+
+ return true;
+ }
+
+ toJSON() {
+ return {
+ id: this.id,
+ applicantName: this.applicantName,
+ applicantEmail: this.applicantEmail,
+ position: this.position,
+ team: this.team,
+ resumeUrl: this.resumeUrl,
+ coverLetter: this.coverLetter,
+ appliedAt: this.appliedAt,
+ status: this.status
+ };
+ }
+}
+
+module.exports = Application;
\ No newline at end of file
diff --git a/models/Team.js b/models/Team.js
new file mode 100644
index 0000000..78c4247
--- /dev/null
+++ b/models/Team.js
@@ -0,0 +1,53 @@
+class Team {
+ constructor(data) {
+ this.id = data.id || this.generateId();
+ this.name = data.name;
+ this.description = data.description;
+ this.executives = data.executives || []; // Array of executive email addresses
+ this.projectLeads = data.projectLeads || []; // Array of project lead email addresses
+ this.createdAt = data.createdAt || new Date().toISOString();
+ }
+
+ generateId() {
+ return Date.now().toString(36) + Math.random().toString(36).substr(2);
+ }
+
+ validate() {
+ if (!this.name) {
+ throw new Error('Team name is required');
+ }
+
+ if (this.executives.length === 0 && this.projectLeads.length === 0) {
+ throw new Error('At least one executive or project lead email is required');
+ }
+
+ // Validate email formats
+ const allEmails = [...this.executives, ...this.projectLeads];
+ const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+
+ for (const email of allEmails) {
+ if (!emailRegex.test(email)) {
+ throw new Error(`Invalid email format: ${email}`);
+ }
+ }
+
+ return true;
+ }
+
+ getAllNotificationEmails() {
+ return [...this.executives, ...this.projectLeads];
+ }
+
+ toJSON() {
+ return {
+ id: this.id,
+ name: this.name,
+ description: this.description,
+ executives: this.executives,
+ projectLeads: this.projectLeads,
+ createdAt: this.createdAt
+ };
+ }
+}
+
+module.exports = Team;
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..5632d30
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,1320 @@
+{
+ "name": "email-backend",
+ "version": "1.0.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "email-backend",
+ "version": "1.0.0",
+ "license": "ISC",
+ "dependencies": {
+ "cors": "^2.8.5",
+ "dotenv": "^17.2.2",
+ "express": "^5.1.0",
+ "helmet": "^8.1.0",
+ "morgan": "^1.10.1",
+ "nodemailer": "^7.0.6"
+ },
+ "devDependencies": {
+ "nodemon": "^3.1.10"
+ }
+ },
+ "node_modules/accepts": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz",
+ "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-types": "^3.0.0",
+ "negotiator": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/anymatch": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/basic-auth": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/basic-auth/-/basic-auth-2.0.1.tgz",
+ "integrity": "sha512-NF+epuEdnUYVlGuhaxbbq+dvJttwLnGY+YixlXlME5KpQ5W3CnXA5cVTneY3SPbPDRkcjMbifrwmFYcClgOZeg==",
+ "license": "MIT",
+ "dependencies": {
+ "safe-buffer": "5.1.2"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/basic-auth/node_modules/safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
+ "license": "MIT"
+ },
+ "node_modules/binary-extensions": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
+ "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/body-parser": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.0.tgz",
+ "integrity": "sha512-02qvAaxv8tp7fBa/mw1ga98OGm+eCbqzJOKoRt70sLmfEEi+jyBYVTDGfCL/k06/4EMk/z01gCe7HoCH/f2LTg==",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "^3.1.2",
+ "content-type": "^1.0.5",
+ "debug": "^4.4.0",
+ "http-errors": "^2.0.0",
+ "iconv-lite": "^0.6.3",
+ "on-finished": "^2.4.1",
+ "qs": "^6.14.0",
+ "raw-body": "^3.0.0",
+ "type-is": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/brace-expansion": {
+ "version": "1.1.12",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz",
+ "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "node_modules/braces": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fill-range": "^7.1.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/bytes": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
+ "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/call-bind-apply-helpers": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/call-bound": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
+ "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "get-intrinsic": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/chokidar": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
+ "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "anymatch": "~3.1.2",
+ "braces": "~3.0.2",
+ "glob-parent": "~5.1.2",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.6.0"
+ },
+ "engines": {
+ "node": ">= 8.10.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/content-disposition": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.0.tgz",
+ "integrity": "sha512-Au9nRL8VNUut/XSzbQA38+M78dzP4D+eqg3gfJHMIHHYa3bg067xj1KxMUWj+VULbiZMowKngFFbKczUrNJ1mg==",
+ "license": "MIT",
+ "dependencies": {
+ "safe-buffer": "5.2.1"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/content-type": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
+ "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie": {
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/cookie-signature": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz",
+ "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.6.0"
+ }
+ },
+ "node_modules/cors": {
+ "version": "2.8.5",
+ "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
+ "integrity": "sha512-KIHbLJqu73RGr/hnbrO9uBeixNGuvSQjul/jdFvS/KFSIH1hWVd1ng7zOHx+YrEfInLG7q4n6GHQ9cDtxv/P6g==",
+ "license": "MIT",
+ "dependencies": {
+ "object-assign": "^4",
+ "vary": "^1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/depd": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
+ "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/dotenv": {
+ "version": "17.2.2",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.2.2.tgz",
+ "integrity": "sha512-Sf2LSQP+bOlhKWWyhFsn0UsfdK/kCWRv1iuA2gXAwt3dyNabr6QSj00I2V10pidqz69soatm9ZwZvpQMTIOd5Q==",
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://dotenvx.com"
+ }
+ },
+ "node_modules/dunder-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/ee-first": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
+ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
+ "license": "MIT"
+ },
+ "node_modules/encodeurl": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz",
+ "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/es-define-property": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-object-atoms": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz",
+ "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/escape-html": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
+ "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
+ "license": "MIT"
+ },
+ "node_modules/etag": {
+ "version": "1.8.1",
+ "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
+ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/express": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/express/-/express-5.1.0.tgz",
+ "integrity": "sha512-DT9ck5YIRU+8GYzzU5kT3eHGA5iL+1Zd0EutOmTE9Dtk+Tvuzd23VBU+ec7HPNSTxXYO55gPV/hq4pSBJDjFpA==",
+ "license": "MIT",
+ "dependencies": {
+ "accepts": "^2.0.0",
+ "body-parser": "^2.2.0",
+ "content-disposition": "^1.0.0",
+ "content-type": "^1.0.5",
+ "cookie": "^0.7.1",
+ "cookie-signature": "^1.2.1",
+ "debug": "^4.4.0",
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "etag": "^1.8.1",
+ "finalhandler": "^2.1.0",
+ "fresh": "^2.0.0",
+ "http-errors": "^2.0.0",
+ "merge-descriptors": "^2.0.0",
+ "mime-types": "^3.0.0",
+ "on-finished": "^2.4.1",
+ "once": "^1.4.0",
+ "parseurl": "^1.3.3",
+ "proxy-addr": "^2.0.7",
+ "qs": "^6.14.0",
+ "range-parser": "^1.2.1",
+ "router": "^2.2.0",
+ "send": "^1.1.0",
+ "serve-static": "^2.2.0",
+ "statuses": "^2.0.1",
+ "type-is": "^2.0.1",
+ "vary": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/fill-range": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "to-regex-range": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/finalhandler": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.0.tgz",
+ "integrity": "sha512-/t88Ty3d5JWQbWYgaOGCCYfXRwV1+be02WqYYlL6h0lEiUAMPM8o8qKGO01YIkOHzka2up08wvgYD0mDiI+q3Q==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.4.0",
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "on-finished": "^2.4.1",
+ "parseurl": "^1.3.3",
+ "statuses": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/forwarded": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
+ "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/fresh": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz",
+ "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-intrinsic": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "es-define-property": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
+ "function-bind": "^1.1.2",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-symbols": "^1.1.0",
+ "hasown": "^2.0.2",
+ "math-intrinsics": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/get-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
+ "license": "MIT",
+ "dependencies": {
+ "dunder-proto": "^1.0.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "is-glob": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/gopd": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/has-symbols": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/hasown": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
+ "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
+ "license": "MIT",
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/helmet": {
+ "version": "8.1.0",
+ "resolved": "https://registry.npmjs.org/helmet/-/helmet-8.1.0.tgz",
+ "integrity": "sha512-jOiHyAZsmnr8LqoPGmCjYAaiuWwjAPLgY8ZX2XrmHawt99/u1y6RgrZMTeoPfpUbV96HOalYgz1qzkRbw54Pmg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18.0.0"
+ }
+ },
+ "node_modules/http-errors": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.0.tgz",
+ "integrity": "sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ==",
+ "license": "MIT",
+ "dependencies": {
+ "depd": "2.0.0",
+ "inherits": "2.0.4",
+ "setprototypeof": "1.2.0",
+ "statuses": "2.0.1",
+ "toidentifier": "1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/http-errors/node_modules/statuses": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.1.tgz",
+ "integrity": "sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/iconv-lite": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
+ "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/ignore-by-default": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/ignore-by-default/-/ignore-by-default-1.0.1.tgz",
+ "integrity": "sha512-Ius2VYcGNk7T90CppJqcIkS5ooHUZyIQK+ClZfMfMNFEF9VSE73Fq+906u/CWu92x4gzZMWOwfFYckPObzdEbA==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "license": "ISC"
+ },
+ "node_modules/ipaddr.js": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
+ "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "binary-extensions": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-glob": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-extglob": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.12.0"
+ }
+ },
+ "node_modules/is-promise": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz",
+ "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==",
+ "license": "MIT"
+ },
+ "node_modules/math-intrinsics": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/media-typer": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz",
+ "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/merge-descriptors": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz",
+ "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/mime-db": {
+ "version": "1.54.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz",
+ "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.1.tgz",
+ "integrity": "sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "^1.54.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/minimatch": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
+ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/morgan": {
+ "version": "1.10.1",
+ "resolved": "https://registry.npmjs.org/morgan/-/morgan-1.10.1.tgz",
+ "integrity": "sha512-223dMRJtI/l25dJKWpgij2cMtywuG/WiUKXdvwfbhGKBhy1puASqXwFzmWZ7+K73vUPoR7SS2Qz2cI/g9MKw0A==",
+ "license": "MIT",
+ "dependencies": {
+ "basic-auth": "~2.0.1",
+ "debug": "2.6.9",
+ "depd": "~2.0.0",
+ "on-finished": "~2.3.0",
+ "on-headers": "~1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/morgan/node_modules/debug": {
+ "version": "2.6.9",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
+ "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
+ "license": "MIT",
+ "dependencies": {
+ "ms": "2.0.0"
+ }
+ },
+ "node_modules/morgan/node_modules/ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
+ "license": "MIT"
+ },
+ "node_modules/morgan/node_modules/on-finished": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
+ "integrity": "sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==",
+ "license": "MIT",
+ "dependencies": {
+ "ee-first": "1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "license": "MIT"
+ },
+ "node_modules/negotiator": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz",
+ "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/nodemailer": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-7.0.6.tgz",
+ "integrity": "sha512-F44uVzgwo49xboqbFgBGkRaiMgtoBrBEWCVincJPK9+S9Adkzt/wXCLKbf7dxucmxfTI5gHGB+bEmdyzN6QKjw==",
+ "license": "MIT-0",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/nodemon": {
+ "version": "3.1.10",
+ "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-3.1.10.tgz",
+ "integrity": "sha512-WDjw3pJ0/0jMFmyNDp3gvY2YizjLmmOUQo6DEBY+JgdvW/yQ9mEeSw6H5ythl5Ny2ytb7f9C2nIbjSxMNzbJXw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "chokidar": "^3.5.2",
+ "debug": "^4",
+ "ignore-by-default": "^1.0.1",
+ "minimatch": "^3.1.2",
+ "pstree.remy": "^1.1.8",
+ "semver": "^7.5.3",
+ "simple-update-notifier": "^2.0.0",
+ "supports-color": "^5.5.0",
+ "touch": "^3.1.0",
+ "undefsafe": "^2.0.5"
+ },
+ "bin": {
+ "nodemon": "bin/nodemon.js"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/nodemon"
+ }
+ },
+ "node_modules/normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/object-inspect": {
+ "version": "1.13.4",
+ "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
+ "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/on-finished": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz",
+ "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==",
+ "license": "MIT",
+ "dependencies": {
+ "ee-first": "1.1.1"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/on-headers": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/on-headers/-/on-headers-1.1.0.tgz",
+ "integrity": "sha512-737ZY3yNnXy37FHkQxPzt4UZ2UWPWiCZWLvFZ4fu5cueciegX0zGPnrlY6bwRg4FdQOe9YU8MkmJwGhoMybl8A==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
+ "license": "ISC",
+ "dependencies": {
+ "wrappy": "1"
+ }
+ },
+ "node_modules/parseurl": {
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
+ "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/path-to-regexp": {
+ "version": "8.3.0",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.3.0.tgz",
+ "integrity": "sha512-7jdwVIRtsP8MYpdXSwOS0YdD0Du+qOoF/AEPIt88PcCFrZCzx41oxku1jD88hZBwbNUIEfpqvuhjFaMAqMTWnA==",
+ "license": "MIT",
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/picomatch": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
+ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/proxy-addr": {
+ "version": "2.0.7",
+ "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
+ "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
+ "license": "MIT",
+ "dependencies": {
+ "forwarded": "0.2.0",
+ "ipaddr.js": "1.9.1"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/pstree.remy": {
+ "version": "1.1.8",
+ "resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
+ "integrity": "sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/qs": {
+ "version": "6.14.0",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz",
+ "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==",
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "side-channel": "^1.1.0"
+ },
+ "engines": {
+ "node": ">=0.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/range-parser": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
+ "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/raw-body": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.1.tgz",
+ "integrity": "sha512-9G8cA+tuMS75+6G/TzW8OtLzmBDMo8p1JRxN5AZ+LAp8uxGA8V8GZm4GQ4/N5QNQEnLmg6SS7wyuSmbKepiKqA==",
+ "license": "MIT",
+ "dependencies": {
+ "bytes": "3.1.2",
+ "http-errors": "2.0.0",
+ "iconv-lite": "0.7.0",
+ "unpipe": "1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.10"
+ }
+ },
+ "node_modules/raw-body/node_modules/iconv-lite": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz",
+ "integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==",
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/express"
+ }
+ },
+ "node_modules/readdirp": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "picomatch": "^2.2.1"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ }
+ },
+ "node_modules/router": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz",
+ "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.4.0",
+ "depd": "^2.0.0",
+ "is-promise": "^4.0.0",
+ "parseurl": "^1.3.3",
+ "path-to-regexp": "^8.0.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/safe-buffer": {
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
+ "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "license": "MIT"
+ },
+ "node_modules/semver": {
+ "version": "7.7.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz",
+ "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/send": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/send/-/send-1.2.0.tgz",
+ "integrity": "sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==",
+ "license": "MIT",
+ "dependencies": {
+ "debug": "^4.3.5",
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "etag": "^1.8.1",
+ "fresh": "^2.0.0",
+ "http-errors": "^2.0.0",
+ "mime-types": "^3.0.1",
+ "ms": "^2.1.3",
+ "on-finished": "^2.4.1",
+ "range-parser": "^1.2.1",
+ "statuses": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/serve-static": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.0.tgz",
+ "integrity": "sha512-61g9pCh0Vnh7IutZjtLGGpTA355+OPn2TyDv/6ivP2h/AdAVX9azsoxmg2/M6nZeQZNYBEwIcsne1mJd9oQItQ==",
+ "license": "MIT",
+ "dependencies": {
+ "encodeurl": "^2.0.0",
+ "escape-html": "^1.0.3",
+ "parseurl": "^1.3.3",
+ "send": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/setprototypeof": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
+ "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
+ "license": "ISC"
+ },
+ "node_modules/side-channel": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz",
+ "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.3",
+ "side-channel-list": "^1.0.0",
+ "side-channel-map": "^1.0.1",
+ "side-channel-weakmap": "^1.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-list": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz",
+ "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "object-inspect": "^1.13.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-map": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
+ "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/side-channel-weakmap": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
+ "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
+ "license": "MIT",
+ "dependencies": {
+ "call-bound": "^1.0.2",
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.5",
+ "object-inspect": "^1.13.3",
+ "side-channel-map": "^1.0.1"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/simple-update-notifier": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-2.0.0.tgz",
+ "integrity": "sha512-a2B9Y0KlNXl9u/vsW6sTIu9vGEpfKu2wRV6l1H3XEas/0gUIzGzBoP/IouTcUQbm9JWZLH3COxyn03TYlFax6w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "semver": "^7.5.3"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/statuses": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
+ "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-number": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=8.0"
+ }
+ },
+ "node_modules/toidentifier": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
+ "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.6"
+ }
+ },
+ "node_modules/touch": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/touch/-/touch-3.1.1.tgz",
+ "integrity": "sha512-r0eojU4bI8MnHr8c5bNo7lJDdI2qXlWWJk6a9EAFG7vbhTjElYhBVS3/miuE0uOuoLdb8Mc/rVfsmm6eo5o9GA==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "nodetouch": "bin/nodetouch.js"
+ }
+ },
+ "node_modules/type-is": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz",
+ "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==",
+ "license": "MIT",
+ "dependencies": {
+ "content-type": "^1.0.5",
+ "media-typer": "^1.1.0",
+ "mime-types": "^3.0.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/undefsafe": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/undefsafe/-/undefsafe-2.0.5.tgz",
+ "integrity": "sha512-WxONCrssBM8TSPRqN5EmsjVrsv4A8X12J4ArBiiayv3DyyG3ZlIg6yysuuSYdZsVz3TKcTg2fd//Ujd4CHV1iA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/unpipe": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
+ "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/vary": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
+ "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
+ "node_modules/wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
+ "license": "ISC"
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..73dcaf8
--- /dev/null
+++ b/package.json
@@ -0,0 +1,25 @@
+{
+ "name": "email-backend",
+ "version": "1.0.0",
+ "description": "Backend server to receive notification via email for any applicants applying",
+ "main": "index.js",
+ "scripts": {
+ "start": "node index.js",
+ "dev": "nodemon index.js",
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "dependencies": {
+ "cors": "^2.8.5",
+ "dotenv": "^17.2.2",
+ "express": "^5.1.0",
+ "helmet": "^8.1.0",
+ "morgan": "^1.10.1",
+ "nodemailer": "^7.0.6"
+ },
+ "devDependencies": {
+ "nodemon": "^3.1.10"
+ }
+}
diff --git a/routes/applications.js b/routes/applications.js
new file mode 100644
index 0000000..0bf542c
--- /dev/null
+++ b/routes/applications.js
@@ -0,0 +1,201 @@
+const express = require('express');
+const router = express.Router();
+const Application = require('../models/Application');
+const dataService = require('../services/dataService');
+const emailService = require('../services/emailService');
+
+// Submit a new application
+router.post('/', async (req, res) => {
+ try {
+ // Create new application instance
+ const application = new Application(req.body);
+
+ // Validate the application
+ application.validate();
+
+ // Check if the team exists
+ const team = await dataService.getTeamByName(application.team);
+ if (!team) {
+ return res.status(400).json({
+ error: 'Invalid team',
+ message: `Team "${application.team}" not found. Please use one of the existing teams.`,
+ availableTeams: (await dataService.getAllTeams()).map(t => t.name)
+ });
+ }
+
+ // Save the application
+ const savedApplication = await dataService.saveApplication(application);
+
+ // Get notification recipients from the team
+ const recipients = [...team.executives, ...team.projectLeads];
+
+ // Send email notifications
+ const emailResult = await emailService.sendApplicationNotification(
+ savedApplication,
+ recipients
+ );
+
+ // Log the notification attempt
+ console.log(`📧 Application notification sent for ${application.applicantName} (${application.position}) to team ${team.name}`);
+ console.log(`Recipients: ${recipients.join(', ')}`);
+
+ res.status(201).json({
+ success: true,
+ message: 'Application submitted successfully',
+ application: savedApplication.toJSON(),
+ notification: {
+ sent: emailResult.success,
+ recipients: recipients,
+ details: emailResult.message
+ }
+ });
+
+ } catch (error) {
+ console.error('Error submitting application:', error.message);
+ res.status(400).json({
+ error: 'Failed to submit application',
+ message: error.message
+ });
+ }
+});
+
+// Get all applications
+router.get('/', async (req, res) => {
+ try {
+ const applications = await dataService.getAllApplications();
+
+ // Optional filtering by team or status
+ let filteredApplications = applications;
+
+ if (req.query.team) {
+ filteredApplications = filteredApplications.filter(
+ app => app.team.toLowerCase() === req.query.team.toLowerCase()
+ );
+ }
+
+ if (req.query.status) {
+ filteredApplications = filteredApplications.filter(
+ app => app.status === req.query.status
+ );
+ }
+
+ res.json({
+ success: true,
+ count: filteredApplications.length,
+ applications: filteredApplications
+ });
+
+ } catch (error) {
+ console.error('Error getting applications:', error.message);
+ res.status(500).json({
+ error: 'Failed to retrieve applications',
+ message: error.message
+ });
+ }
+});
+
+// Get application by ID
+router.get('/:id', async (req, res) => {
+ try {
+ const application = await dataService.getApplicationById(req.params.id);
+
+ if (!application) {
+ return res.status(404).json({
+ error: 'Application not found',
+ message: `Application with ID "${req.params.id}" does not exist`
+ });
+ }
+
+ res.json({
+ success: true,
+ application: application
+ });
+
+ } catch (error) {
+ console.error('Error getting application:', error.message);
+ res.status(500).json({
+ error: 'Failed to retrieve application',
+ message: error.message
+ });
+ }
+});
+
+// Update application status
+router.patch('/:id/status', async (req, res) => {
+ try {
+ const { status } = req.body;
+
+ if (!status) {
+ return res.status(400).json({
+ error: 'Status is required',
+ message: 'Please provide a status value'
+ });
+ }
+
+ const validStatuses = ['pending', 'reviewing', 'interview', 'accepted', 'rejected'];
+ if (!validStatuses.includes(status)) {
+ return res.status(400).json({
+ error: 'Invalid status',
+ message: `Status must be one of: ${validStatuses.join(', ')}`
+ });
+ }
+
+ const updatedApplication = await dataService.updateApplicationStatus(req.params.id, status);
+
+ res.json({
+ success: true,
+ message: 'Application status updated successfully',
+ application: updatedApplication
+ });
+
+ } catch (error) {
+ console.error('Error updating application status:', error.message);
+ res.status(error.message.includes('not found') ? 404 : 500).json({
+ error: 'Failed to update application status',
+ message: error.message
+ });
+ }
+});
+
+// Get application statistics
+router.get('/stats/summary', async (req, res) => {
+ try {
+ const applications = await dataService.getAllApplications();
+
+ const stats = {
+ total: applications.length,
+ byStatus: {},
+ byTeam: {},
+ recent: applications.filter(app => {
+ const appDate = new Date(app.appliedAt);
+ const weekAgo = new Date();
+ weekAgo.setDate(weekAgo.getDate() - 7);
+ return appDate >= weekAgo;
+ }).length
+ };
+
+ // Count by status
+ applications.forEach(app => {
+ stats.byStatus[app.status] = (stats.byStatus[app.status] || 0) + 1;
+ });
+
+ // Count by team
+ applications.forEach(app => {
+ stats.byTeam[app.team] = (stats.byTeam[app.team] || 0) + 1;
+ });
+
+ res.json({
+ success: true,
+ stats: stats
+ });
+
+ } catch (error) {
+ console.error('Error getting application stats:', error.message);
+ res.status(500).json({
+ error: 'Failed to retrieve application statistics',
+ message: error.message
+ });
+ }
+});
+
+module.exports = router;
\ No newline at end of file
diff --git a/routes/teams.js b/routes/teams.js
new file mode 100644
index 0000000..b932849
--- /dev/null
+++ b/routes/teams.js
@@ -0,0 +1,239 @@
+const express = require('express');
+const router = express.Router();
+const Team = require('../models/Team');
+const dataService = require('../services/dataService');
+const emailService = require('../services/emailService');
+
+// Get all teams
+router.get('/', async (req, res) => {
+ try {
+ const teams = await dataService.getAllTeams();
+
+ res.json({
+ success: true,
+ count: teams.length,
+ teams: teams
+ });
+
+ } catch (error) {
+ console.error('Error getting teams:', error.message);
+ res.status(500).json({
+ error: 'Failed to retrieve teams',
+ message: error.message
+ });
+ }
+});
+
+// Get team by ID
+router.get('/:id', async (req, res) => {
+ try {
+ const team = await dataService.getTeamById(req.params.id);
+
+ if (!team) {
+ return res.status(404).json({
+ error: 'Team not found',
+ message: `Team with ID "${req.params.id}" does not exist`
+ });
+ }
+
+ res.json({
+ success: true,
+ team: team
+ });
+
+ } catch (error) {
+ console.error('Error getting team:', error.message);
+ res.status(500).json({
+ error: 'Failed to retrieve team',
+ message: error.message
+ });
+ }
+});
+
+// Create a new team
+router.post('/', async (req, res) => {
+ try {
+ // Create new team instance
+ const team = new Team(req.body);
+
+ // Validate the team
+ team.validate();
+
+ // Check if a team with the same name already exists
+ const existingTeam = await dataService.getTeamByName(team.name);
+ if (existingTeam) {
+ return res.status(400).json({
+ error: 'Team already exists',
+ message: `A team with the name "${team.name}" already exists`
+ });
+ }
+
+ // Save the team
+ const savedTeam = await dataService.saveTeam(team);
+
+ console.log(`✅ New team created: ${team.name}`);
+
+ res.status(201).json({
+ success: true,
+ message: 'Team created successfully',
+ team: savedTeam.toJSON()
+ });
+
+ } catch (error) {
+ console.error('Error creating team:', error.message);
+ res.status(400).json({
+ error: 'Failed to create team',
+ message: error.message
+ });
+ }
+});
+
+// Update a team
+router.put('/:id', async (req, res) => {
+ try {
+ // Check if team exists
+ const existingTeam = await dataService.getTeamById(req.params.id);
+ if (!existingTeam) {
+ return res.status(404).json({
+ error: 'Team not found',
+ message: `Team with ID "${req.params.id}" does not exist`
+ });
+ }
+
+ // Create updated team instance with existing ID
+ const updatedData = { ...req.body, id: req.params.id };
+ const team = new Team(updatedData);
+
+ // Validate the team
+ team.validate();
+
+ // Check if another team with the same name exists (excluding current team)
+ const teamWithSameName = await dataService.getTeamByName(team.name);
+ if (teamWithSameName && teamWithSameName.id !== req.params.id) {
+ return res.status(400).json({
+ error: 'Team name already exists',
+ message: `Another team with the name "${team.name}" already exists`
+ });
+ }
+
+ // Save the updated team
+ const savedTeam = await dataService.saveTeam(team);
+
+ console.log(`✅ Team updated: ${team.name}`);
+
+ res.json({
+ success: true,
+ message: 'Team updated successfully',
+ team: savedTeam.toJSON()
+ });
+
+ } catch (error) {
+ console.error('Error updating team:', error.message);
+ res.status(400).json({
+ error: 'Failed to update team',
+ message: error.message
+ });
+ }
+});
+
+// Delete a team
+router.delete('/:id', async (req, res) => {
+ try {
+ // Check if team exists
+ const existingTeam = await dataService.getTeamById(req.params.id);
+ if (!existingTeam) {
+ return res.status(404).json({
+ error: 'Team not found',
+ message: `Team with ID "${req.params.id}" does not exist`
+ });
+ }
+
+ // Delete the team
+ await dataService.deleteTeam(req.params.id);
+
+ console.log(`🗑️ Team deleted: ${existingTeam.name}`);
+
+ res.json({
+ success: true,
+ message: 'Team deleted successfully'
+ });
+
+ } catch (error) {
+ console.error('Error deleting team:', error.message);
+ res.status(500).json({
+ error: 'Failed to delete team',
+ message: error.message
+ });
+ }
+});
+
+// Test email notifications for a team
+router.post('/:id/test-email', async (req, res) => {
+ try {
+ const team = await dataService.getTeamById(req.params.id);
+
+ if (!team) {
+ return res.status(404).json({
+ error: 'Team not found',
+ message: `Team with ID "${req.params.id}" does not exist`
+ });
+ }
+
+ // Create a test application for email testing
+ const testApplication = {
+ applicantName: 'Test Applicant',
+ applicantEmail: 'test@example.com',
+ position: 'Test Position',
+ team: team.name,
+ appliedAt: new Date().toISOString(),
+ coverLetter: 'This is a test email notification to verify the email system is working correctly.',
+ resumeUrl: 'https://example.com/test-resume.pdf'
+ };
+
+ // Get notification recipients
+ const recipients = [...team.executives, ...team.projectLeads];
+
+ // Send test email
+ const emailResult = await emailService.sendApplicationNotification(
+ testApplication,
+ recipients
+ );
+
+ console.log(`📧 Test email sent for team ${team.name}`);
+
+ res.json({
+ success: true,
+ message: 'Test email sent successfully',
+ recipients: recipients,
+ emailResult: emailResult
+ });
+
+ } catch (error) {
+ console.error('Error sending test email:', error.message);
+ res.status(500).json({
+ error: 'Failed to send test email',
+ message: error.message
+ });
+ }
+});
+
+// Check email service status
+router.get('/email/status', async (req, res) => {
+ try {
+ const connectionTest = await emailService.testConnection();
+
+ res.json({
+ success: true,
+ emailService: connectionTest
+ });
+
+ } catch (error) {
+ console.error('Error checking email status:', error.message);
+ res.status(500).json({
+ error: 'Failed to check email service status',
+ message: error.message
+ });
+ }
+});
+
+module.exports = router;
\ No newline at end of file
diff --git a/services/dataService.js b/services/dataService.js
new file mode 100644
index 0000000..ee22e68
--- /dev/null
+++ b/services/dataService.js
@@ -0,0 +1,176 @@
+const fs = require('fs').promises;
+const path = require('path');
+
+class DataService {
+ constructor() {
+ this.dataDir = path.join(__dirname, '../data');
+ this.applicationsFile = path.join(this.dataDir, 'applications.json');
+ this.teamsFile = path.join(this.dataDir, 'teams.json');
+ this.initializeDataFiles();
+ }
+
+ async initializeDataFiles() {
+ try {
+ // Create data directory if it doesn't exist
+ await fs.mkdir(this.dataDir, { recursive: true });
+
+ // Initialize applications file
+ try {
+ await fs.access(this.applicationsFile);
+ } catch {
+ await fs.writeFile(this.applicationsFile, JSON.stringify([], null, 2));
+ }
+
+ // Initialize teams file with default teams
+ try {
+ await fs.access(this.teamsFile);
+ } catch {
+ const defaultTeams = [
+ {
+ id: 'engineering',
+ name: 'Engineering',
+ description: 'Software development and technical roles',
+ executives: ['cto@company.com'],
+ projectLeads: ['eng-lead@company.com'],
+ createdAt: new Date().toISOString()
+ },
+ {
+ id: 'product',
+ name: 'Product',
+ description: 'Product management and design roles',
+ executives: ['cpo@company.com'],
+ projectLeads: ['product-lead@company.com'],
+ createdAt: new Date().toISOString()
+ },
+ {
+ id: 'marketing',
+ name: 'Marketing',
+ description: 'Marketing and growth roles',
+ executives: ['cmo@company.com'],
+ projectLeads: ['marketing-lead@company.com'],
+ createdAt: new Date().toISOString()
+ }
+ ];
+ await fs.writeFile(this.teamsFile, JSON.stringify(defaultTeams, null, 2));
+ }
+
+ console.log('✅ Data service initialized successfully');
+ } catch (error) {
+ console.error('❌ Failed to initialize data service:', error.message);
+ }
+ }
+
+ // Applications methods
+ async saveApplication(application) {
+ try {
+ const applications = await this.getAllApplications();
+ applications.push(application.toJSON());
+ await fs.writeFile(this.applicationsFile, JSON.stringify(applications, null, 2));
+ return application;
+ } catch (error) {
+ throw new Error(`Failed to save application: ${error.message}`);
+ }
+ }
+
+ async getAllApplications() {
+ try {
+ const data = await fs.readFile(this.applicationsFile, 'utf8');
+ return JSON.parse(data);
+ } catch (error) {
+ console.error('Error reading applications:', error.message);
+ return [];
+ }
+ }
+
+ async getApplicationById(id) {
+ try {
+ const applications = await this.getAllApplications();
+ return applications.find(app => app.id === id);
+ } catch (error) {
+ throw new Error(`Failed to get application: ${error.message}`);
+ }
+ }
+
+ async updateApplicationStatus(id, status) {
+ try {
+ const applications = await this.getAllApplications();
+ const appIndex = applications.findIndex(app => app.id === id);
+
+ if (appIndex === -1) {
+ throw new Error('Application not found');
+ }
+
+ applications[appIndex].status = status;
+ await fs.writeFile(this.applicationsFile, JSON.stringify(applications, null, 2));
+
+ return applications[appIndex];
+ } catch (error) {
+ throw new Error(`Failed to update application status: ${error.message}`);
+ }
+ }
+
+ // Teams methods
+ async saveTeam(team) {
+ try {
+ const teams = await this.getAllTeams();
+ const existingIndex = teams.findIndex(t => t.id === team.id);
+
+ if (existingIndex !== -1) {
+ teams[existingIndex] = team.toJSON();
+ } else {
+ teams.push(team.toJSON());
+ }
+
+ await fs.writeFile(this.teamsFile, JSON.stringify(teams, null, 2));
+ return team;
+ } catch (error) {
+ throw new Error(`Failed to save team: ${error.message}`);
+ }
+ }
+
+ async getAllTeams() {
+ try {
+ const data = await fs.readFile(this.teamsFile, 'utf8');
+ return JSON.parse(data);
+ } catch (error) {
+ console.error('Error reading teams:', error.message);
+ return [];
+ }
+ }
+
+ async getTeamById(id) {
+ try {
+ const teams = await this.getAllTeams();
+ return teams.find(team => team.id === id);
+ } catch (error) {
+ throw new Error(`Failed to get team: ${error.message}`);
+ }
+ }
+
+ async getTeamByName(name) {
+ try {
+ const teams = await this.getAllTeams();
+ return teams.find(team => team.name.toLowerCase() === name.toLowerCase());
+ } catch (error) {
+ throw new Error(`Failed to get team by name: ${error.message}`);
+ }
+ }
+
+ async deleteTeam(id) {
+ try {
+ const teams = await this.getAllTeams();
+ const filteredTeams = teams.filter(team => team.id !== id);
+
+ if (teams.length === filteredTeams.length) {
+ throw new Error('Team not found');
+ }
+
+ await fs.writeFile(this.teamsFile, JSON.stringify(filteredTeams, null, 2));
+ return true;
+ } catch (error) {
+ throw new Error(`Failed to delete team: ${error.message}`);
+ }
+ }
+}
+
+module.exports = new DataService();
\ No newline at end of file
diff --git a/services/emailService.js b/services/emailService.js
new file mode 100644
index 0000000..391a7b3
--- /dev/null
+++ b/services/emailService.js
@@ -0,0 +1,170 @@
+const nodemailer = require('nodemailer');
+
+class EmailService {
+ constructor() {
+ this.transporter = null;
+ this.initializeTransporter();
+ }
+
+ initializeTransporter() {
+ // Check if email configuration is available
+ if (!process.env.EMAIL_HOST || !process.env.EMAIL_USER || !process.env.EMAIL_PASS) {
+ console.warn('⚠️ Email configuration not found. Email notifications will be logged only.');
+ return;
+ }
+
+ try {
+ this.transporter = nodemailer.createTransporter({
+ host: process.env.EMAIL_HOST,
+ port: parseInt(process.env.EMAIL_PORT) || 587,
+ secure: false, // true for 465, false for other ports
+ auth: {
+ user: process.env.EMAIL_USER,
+ pass: process.env.EMAIL_PASS,
+ },
+ });
+
+ console.log('✅ Email service initialized successfully');
+ } catch (error) {
+ console.error('❌ Failed to initialize email service:', error.message);
+ }
+ }
+
+ async sendApplicationNotification(application, recipients) {
+ const subject = `New Application: ${application.position} - ${application.applicantName}`;
+
+ const htmlContent = this.generateApplicationNotificationHTML(application);
+ const textContent = this.generateApplicationNotificationText(application);
+
+ const emailOptions = {
+ from: process.env.EMAIL_FROM || process.env.EMAIL_USER,
+ to: recipients.join(', '),
+ subject: subject,
+ text: textContent,
+ html: htmlContent,
+ };
+
+ return this.sendEmail(emailOptions);
+ }
+
+ generateApplicationNotificationHTML(application) {
+ return `
+
+
+ New Job Application Received
+
+
+
+
Applicant Information
+
Name: ${application.applicantName}
+
Email: ${application.applicantEmail}
+
Position: ${application.position}
+
Team: ${application.team}
+
Applied At: ${new Date(application.appliedAt).toLocaleString()}
+
+
+ ${application.coverLetter ? `
+
+
Cover Letter
+
${application.coverLetter}
+
+ ` : ''}
+
+ ${application.resumeUrl ? `
+
+ ` : ''}
+
+
+
+ This is an automated notification from the ${process.env.APP_NAME || 'Executive Hiring Notification System'}
+
+
+
+ `;
+ }
+
+ generateApplicationNotificationText(application) {
+ let text = `New Job Application Received\n\n`;
+ text += `Applicant Information:\n`;
+ text += `Name: ${application.applicantName}\n`;
+ text += `Email: ${application.applicantEmail}\n`;
+ text += `Position: ${application.position}\n`;
+ text += `Team: ${application.team}\n`;
+ text += `Applied At: ${new Date(application.appliedAt).toLocaleString()}\n\n`;
+
+ if (application.coverLetter) {
+ text += `Cover Letter:\n${application.coverLetter}\n\n`;
+ }
+
+ if (application.resumeUrl) {
+ text += `Resume: ${application.resumeUrl}\n\n`;
+ }
+
+ text += `---\nThis is an automated notification from the ${process.env.APP_NAME || 'Executive Hiring Notification System'}`;
+
+ return text;
+ }
+
+ async sendEmail(emailOptions) {
+ if (!this.transporter) {
+ // Log the email instead of sending it
+ console.log('📧 EMAIL NOTIFICATION (not sent - no transporter configured):');
+ console.log('To:', emailOptions.to);
+ console.log('Subject:', emailOptions.subject);
+ console.log('Content:', emailOptions.text);
+ console.log('---');
+
+ return {
+ success: true,
+ message: 'Email logged (transporter not configured)',
+ messageId: 'mock-' + Date.now()
+ };
+ }
+
+ try {
+ const info = await this.transporter.sendMail(emailOptions);
+ console.log('✅ Email sent successfully:', info.messageId);
+
+ return {
+ success: true,
+ message: 'Email sent successfully',
+ messageId: info.messageId
+ };
+ } catch (error) {
+ console.error('❌ Failed to send email:', error.message);
+
+ return {
+ success: false,
+ message: error.message,
+ error: error
+ };
+ }
+ }
+
+ async testConnection() {
+ if (!this.transporter) {
+ return {
+ success: false,
+ message: 'Email transporter not configured'
+ };
+ }
+
+ try {
+ await this.transporter.verify();
+ return {
+ success: true,
+ message: 'Email service connection successful'
+ };
+ } catch (error) {
+ return {
+ success: false,
+ message: error.message
+ };
+ }
+ }
+}
+
+module.exports = new EmailService();
\ No newline at end of file
From 52547bd41fbbd0d34be27e55a3d4d3de68b59734 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 22 Sep 2025 00:19:50 +0000
Subject: [PATCH 3/4] Add demo scripts and complete documentation
Co-authored-by: TommyOh0428 <101218671+TommyOh0428@users.noreply.github.com>
---
data/applications.json | 32 ++++++++++
data/teams.json | 13 ++++
examples/demo.js | 141 +++++++++++++++++++++++++++++++++++++++++
examples/test-api.sh | 97 ++++++++++++++++++++++++++++
package-lock.json | 132 ++++++++++++++++++++++++++++++++++++++
package.json | 2 +
6 files changed, 417 insertions(+)
create mode 100644 examples/demo.js
create mode 100755 examples/test-api.sh
diff --git a/data/applications.json b/data/applications.json
index 82837e6..0748951 100644
--- a/data/applications.json
+++ b/data/applications.json
@@ -30,5 +30,37 @@
"coverLetter": "I have extensive experience in machine learning and statistical analysis, with a PhD in Statistics and 3 years at a leading tech company.",
"appliedAt": "2025-09-22T00:16:31.200Z",
"status": "pending"
+ },
+ {
+ "id": "mfudpebmzfrn9fb0leq",
+ "applicantName": "Sarah Chen",
+ "applicantEmail": "sarah.chen@example.com",
+ "position": "Senior Full Stack Developer",
+ "team": "Engineering",
+ "resumeUrl": "https://example.com/sarah-resume.pdf",
+ "coverLetter": "I have 6 years of experience in React, Node.js, and cloud technologies. I am passionate about building scalable web applications and leading technical initiatives.",
+ "appliedAt": "2025-09-22T00:19:10.402Z",
+ "status": "pending"
+ },
+ {
+ "id": "mfudpec5dscpafxqtxi",
+ "applicantName": "Michael Rodriguez",
+ "applicantEmail": "michael.r@example.com",
+ "position": "Senior Product Manager",
+ "team": "Product",
+ "coverLetter": "With 8 years in product management at high-growth startups, I specialize in user research, roadmap planning, and cross-functional team leadership.",
+ "appliedAt": "2025-09-22T00:19:10.421Z",
+ "status": "pending"
+ },
+ {
+ "id": "mfudpecaqrsyn8vxdah",
+ "applicantName": "Jennifer Kim",
+ "applicantEmail": "jennifer.kim@example.com",
+ "position": "Digital Marketing Manager",
+ "team": "Marketing",
+ "resumeUrl": "https://example.com/jennifer-resume.pdf",
+ "coverLetter": "I have successfully led digital marketing campaigns that increased user acquisition by 300% and managed marketing budgets of $2M+.",
+ "appliedAt": "2025-09-22T00:19:10.426Z",
+ "status": "pending"
}
]
\ No newline at end of file
diff --git a/data/teams.json b/data/teams.json
index d57b644..abfcdae 100644
--- a/data/teams.json
+++ b/data/teams.json
@@ -47,5 +47,18 @@
"analytics-lead@company.com"
],
"createdAt": "2025-09-22T00:16:22.027Z"
+ },
+ {
+ "id": "mfudpech246lxameuwti",
+ "name": "DevOps",
+ "description": "Infrastructure and deployment team",
+ "executives": [
+ "cto@company.com"
+ ],
+ "projectLeads": [
+ "devops-lead@company.com",
+ "infrastructure-lead@company.com"
+ ],
+ "createdAt": "2025-09-22T00:19:10.433Z"
}
]
\ No newline at end of file
diff --git a/examples/demo.js b/examples/demo.js
new file mode 100644
index 0000000..5e247da
--- /dev/null
+++ b/examples/demo.js
@@ -0,0 +1,141 @@
+#!/usr/bin/env node
+
+/**
+ * Demo script for the Email Backend System
+ * This script demonstrates how to use the API endpoints
+ */
+
+const axios = require('axios');
+
+const BASE_URL = 'http://localhost:3000';
+
+async function demo() {
+ console.log('🚀 Email Backend Demo\n');
+
+ try {
+ // 1. Check system health
+ console.log('1. Checking system health...');
+ const health = await axios.get(`${BASE_URL}/health`);
+ console.log(`✅ System Status: ${health.data.status}\n`);
+
+ // 2. Get existing teams
+ console.log('2. Getting available teams...');
+ const teams = await axios.get(`${BASE_URL}/api/teams`);
+ console.log(`📋 Available Teams (${teams.data.count}):`);
+ teams.data.teams.forEach(team => {
+ console.log(` - ${team.name}: ${team.executives.length} executives, ${team.projectLeads.length} project leads`);
+ });
+ console.log();
+
+ // 3. Submit sample applications
+ console.log('3. Submitting sample applications...\n');
+
+ const applications = [
+ {
+ applicantName: 'Sarah Chen',
+ applicantEmail: 'sarah.chen@example.com',
+ position: 'Senior Full Stack Developer',
+ team: 'Engineering',
+ resumeUrl: 'https://example.com/sarah-resume.pdf',
+ coverLetter: 'I have 6 years of experience in React, Node.js, and cloud technologies. I am passionate about building scalable web applications and leading technical initiatives.'
+ },
+ {
+ applicantName: 'Michael Rodriguez',
+ applicantEmail: 'michael.r@example.com',
+ position: 'Senior Product Manager',
+ team: 'Product',
+ coverLetter: 'With 8 years in product management at high-growth startups, I specialize in user research, roadmap planning, and cross-functional team leadership.'
+ },
+ {
+ applicantName: 'Jennifer Kim',
+ applicantEmail: 'jennifer.kim@example.com',
+ position: 'Digital Marketing Manager',
+ team: 'Marketing',
+ resumeUrl: 'https://example.com/jennifer-resume.pdf',
+ coverLetter: 'I have successfully led digital marketing campaigns that increased user acquisition by 300% and managed marketing budgets of $2M+.'
+ }
+ ];
+
+ for (const app of applications) {
+ console.log(`📝 Submitting application from ${app.applicantName} for ${app.position}...`);
+ const response = await axios.post(`${BASE_URL}/api/applications`, app);
+
+ if (response.data.success) {
+ console.log(` ✅ Application submitted (ID: ${response.data.application.id})`);
+ console.log(` 📧 Email sent to: ${response.data.notification.recipients.join(', ')}`);
+ }
+ console.log();
+ }
+
+ // 4. View application statistics
+ console.log('4. Viewing application statistics...');
+ const stats = await axios.get(`${BASE_URL}/api/applications/stats/summary`);
+ console.log(`📊 Application Statistics:`);
+ console.log(` Total Applications: ${stats.data.stats.total}`);
+ console.log(` Recent (last 7 days): ${stats.data.stats.recent}`);
+ console.log(` By Status:`);
+ Object.entries(stats.data.stats.byStatus).forEach(([status, count]) => {
+ console.log(` - ${status}: ${count}`);
+ });
+ console.log(` By Team:`);
+ Object.entries(stats.data.stats.byTeam).forEach(([team, count]) => {
+ console.log(` - ${team}: ${count}`);
+ });
+ console.log();
+
+ // 5. Create a new team
+ console.log('5. Creating a new team...');
+ const newTeam = {
+ name: 'DevOps',
+ description: 'Infrastructure and deployment team',
+ executives: ['cto@company.com'],
+ projectLeads: ['devops-lead@company.com', 'infrastructure-lead@company.com']
+ };
+
+ const teamResponse = await axios.post(`${BASE_URL}/api/teams`, newTeam);
+ if (teamResponse.data.success) {
+ console.log(`✅ Created team: ${teamResponse.data.team.name}`);
+ console.log(` ID: ${teamResponse.data.team.id}`);
+ console.log(` Notification emails: ${[...teamResponse.data.team.executives, ...teamResponse.data.team.projectLeads].join(', ')}`);
+ }
+ console.log();
+
+ // 6. Test email notification for the new team
+ console.log('6. Testing email notification for new team...');
+ const emailTest = await axios.post(`${BASE_URL}/api/teams/${teamResponse.data.team.id}/test-email`);
+ if (emailTest.data.success) {
+ console.log(`✅ Test email sent to: ${emailTest.data.recipients.join(', ')}`);
+ }
+ console.log();
+
+ console.log('🎉 Demo completed successfully!');
+ console.log('\n📝 To configure real email sending:');
+ console.log(' 1. Copy .env.example to .env');
+ console.log(' 2. Configure your SMTP settings');
+ console.log(' 3. Restart the server');
+
+ } catch (error) {
+ console.error('❌ Demo failed:', error.response?.data || error.message);
+ console.log('\n💡 Make sure the server is running: npm start');
+ }
+}
+
+// Install axios if not already installed
+async function ensureAxios() {
+ try {
+ require('axios');
+ } catch (error) {
+ console.log('Installing axios for demo...');
+ const { execSync } = require('child_process');
+ execSync('npm install axios', { stdio: 'inherit' });
+ }
+}
+
+// Run the demo
+if (require.main === module) {
+ ensureAxios().then(() => {
+ demo();
+ });
+}
+
+module.exports = { demo };
\ No newline at end of file
diff --git a/examples/test-api.sh b/examples/test-api.sh
new file mode 100755
index 0000000..cf709df
--- /dev/null
+++ b/examples/test-api.sh
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+# Test script for Email Backend API
+# Make sure the server is running: npm start
+
+BASE_URL="http://localhost:3000"
+
+echo "🚀 Testing Email Backend API"
+echo "============================="
+echo
+
+# Test 1: Health check
+echo "1. Health Check"
+echo "curl -s $BASE_URL/health"
+curl -s $BASE_URL/health | jq .
+echo
+echo
+
+# Test 2: Get teams
+echo "2. Get Teams"
+echo "curl -s $BASE_URL/api/teams"
+curl -s $BASE_URL/api/teams | jq .
+echo
+echo
+
+# Test 3: Submit application
+echo "3. Submit Application"
+echo "curl -s -X POST $BASE_URL/api/applications \\"
+echo " -H 'Content-Type: application/json' \\"
+echo " -d '{ ... }'"
+
+curl -s -X POST $BASE_URL/api/applications \
+ -H "Content-Type: application/json" \
+ -d '{
+ "applicantName": "Test User",
+ "applicantEmail": "test@example.com",
+ "position": "Software Engineer",
+ "team": "Engineering",
+ "coverLetter": "This is a test application submission."
+ }' | jq .
+echo
+echo
+
+# Test 4: Get applications
+echo "4. Get Applications"
+echo "curl -s $BASE_URL/api/applications"
+curl -s $BASE_URL/api/applications | jq .
+echo
+echo
+
+# Test 5: Get statistics
+echo "5. Get Statistics"
+echo "curl -s $BASE_URL/api/applications/stats/summary"
+curl -s $BASE_URL/api/applications/stats/summary | jq .
+echo
+echo
+
+# Test 6: Create new team
+echo "6. Create New Team"
+echo "curl -s -X POST $BASE_URL/api/teams \\"
+echo " -H 'Content-Type: application/json' \\"
+echo " -d '{ ... }'"
+
+curl -s -X POST $BASE_URL/api/teams \
+ -H "Content-Type: application/json" \
+ -d '{
+ "name": "QA",
+ "description": "Quality Assurance team",
+ "executives": ["cqo@company.com"],
+ "projectLeads": ["qa-lead@company.com"]
+ }' | jq .
+echo
+echo
+
+# Test 7: Error handling (invalid team)
+echo "7. Error Handling (Invalid Team)"
+echo "curl -s -X POST $BASE_URL/api/applications \\"
+echo " -H 'Content-Type: application/json' \\"
+echo " -d '{ \"team\": \"InvalidTeam\" }'"
+
+curl -s -X POST $BASE_URL/api/applications \
+ -H "Content-Type: application/json" \
+ -d '{
+ "applicantName": "Error Test",
+ "applicantEmail": "error@example.com",
+ "position": "Test Position",
+ "team": "InvalidTeam"
+ }' | jq .
+echo
+echo
+
+echo "✅ API tests completed!"
+echo
+echo "💡 Tips:"
+echo " - Use 'npm run demo' for a complete interactive demo"
+echo " - Configure .env file for real email sending"
+echo " - Check server logs for email notifications"
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
index 5632d30..0cb7fa2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -9,6 +9,7 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
+ "axios": "^1.12.2",
"cors": "^2.8.5",
"dotenv": "^17.2.2",
"express": "^5.1.0",
@@ -47,6 +48,23 @@
"node": ">= 8"
}
},
+ "node_modules/asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
+ "license": "MIT"
+ },
+ "node_modules/axios": {
+ "version": "1.12.2",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.12.2.tgz",
+ "integrity": "sha512-vMJzPewAlRyOgxV2dU0Cuz2O8zzzx9VYtbJOaBgXFeLc4IV/Eg50n4LowmehOOR61S8ZMpc2K5Sa7g6A4jfkUw==",
+ "license": "MIT",
+ "dependencies": {
+ "follow-redirects": "^1.15.6",
+ "form-data": "^4.0.4",
+ "proxy-from-env": "^1.1.0"
+ }
+ },
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
@@ -192,6 +210,18 @@
"fsevents": "~2.3.2"
}
},
+ "node_modules/combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "license": "MIT",
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
@@ -268,6 +298,15 @@
}
}
},
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
@@ -348,6 +387,21 @@
"node": ">= 0.4"
}
},
+ "node_modules/es-set-tostringtag": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
+ "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.6",
+ "has-tostringtag": "^1.0.2",
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
@@ -435,6 +489,63 @@
"node": ">= 0.8"
}
},
+ "node_modules/follow-redirects": {
+ "version": "1.15.11",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.11.tgz",
+ "integrity": "sha512-deG2P0JfjrTxl50XGCDyfI97ZGVCxIpfKYmfyrQ54n5FO/0gfIES8C/Psl6kWVDolizcaaxZJnTS0QSMxvnsBQ==",
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/RubenVerborgh"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=4.0"
+ },
+ "peerDependenciesMeta": {
+ "debug": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/form-data": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.4.tgz",
+ "integrity": "sha512-KrGhL9Q4zjj0kiUt5OO4Mr/A/jlI2jDYs5eHBpYHPcBEVSiipAvn2Ko2HnPe20rmcuuvMHNdZFp+4IlGTMF0Ow==",
+ "license": "MIT",
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "es-set-tostringtag": "^2.1.0",
+ "hasown": "^2.0.2",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/form-data/node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/form-data/node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
@@ -561,6 +672,21 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/has-tostringtag": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
+ "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
+ "license": "MIT",
+ "dependencies": {
+ "has-symbols": "^1.0.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/hasown": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz",
@@ -959,6 +1085,12 @@
"node": ">= 0.10"
}
},
+ "node_modules/proxy-from-env": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+ "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==",
+ "license": "MIT"
+ },
"node_modules/pstree.remy": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/pstree.remy/-/pstree.remy-1.1.8.tgz",
diff --git a/package.json b/package.json
index 73dcaf8..56da305 100644
--- a/package.json
+++ b/package.json
@@ -6,12 +6,14 @@
"scripts": {
"start": "node index.js",
"dev": "nodemon index.js",
+ "demo": "node examples/demo.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
+ "axios": "^1.12.2",
"cors": "^2.8.5",
"dotenv": "^17.2.2",
"express": "^5.1.0",
From c8d8ec0dd9d2af0e47bdf5b89e54759def6266b5 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 22 Sep 2025 00:37:18 +0000
Subject: [PATCH 4/4] Migrate to Spring Boot with Docker Compose deployment
support
Co-authored-by: TommyOh0428 <101218671+TommyOh0428@users.noreply.github.com>
---
.gitignore | 47 ++-
Dockerfile | 42 +++
README.md | 304 +++++++++++++-----
data/applications.json | 77 +----
data/teams.json | 89 ++---
deploy.sh | 164 ++++++++++
docker-compose.yml | 86 +++++
nginx.conf | 76 +++++
pom.xml | 108 +++++++
.../emailbackend/EmailBackendApplication.java | 13 +
.../emailbackend/config/EmailConfig.java | 45 +++
.../emailbackend/config/WebConfig.java | 18 ++
.../controller/ApplicationController.java | 197 ++++++++++++
.../controller/SystemController.java | 42 +++
.../controller/TeamController.java | 233 ++++++++++++++
.../emailbackend/dto/ApiResponse.java | 80 +++++
.../emailbackend/dto/ApplicationStats.java | 51 +++
.../dto/ApplicationSubmissionResponse.java | 71 ++++
.../emailbackend/model/Application.java | 125 +++++++
.../com/sfuosdev/emailbackend/model/Team.java | 99 ++++++
.../emailbackend/service/DataService.java | 184 +++++++++++
.../emailbackend/service/EmailService.java | 181 +++++++++++
src/main/resources/application.properties | 27 ++
.../EmailBackendApplicationTests.java | 19 ++
24 files changed, 2171 insertions(+), 207 deletions(-)
create mode 100644 Dockerfile
create mode 100755 deploy.sh
create mode 100644 docker-compose.yml
create mode 100644 nginx.conf
create mode 100644 pom.xml
create mode 100644 src/main/java/com/sfuosdev/emailbackend/EmailBackendApplication.java
create mode 100644 src/main/java/com/sfuosdev/emailbackend/config/EmailConfig.java
create mode 100644 src/main/java/com/sfuosdev/emailbackend/config/WebConfig.java
create mode 100644 src/main/java/com/sfuosdev/emailbackend/controller/ApplicationController.java
create mode 100644 src/main/java/com/sfuosdev/emailbackend/controller/SystemController.java
create mode 100644 src/main/java/com/sfuosdev/emailbackend/controller/TeamController.java
create mode 100644 src/main/java/com/sfuosdev/emailbackend/dto/ApiResponse.java
create mode 100644 src/main/java/com/sfuosdev/emailbackend/dto/ApplicationStats.java
create mode 100644 src/main/java/com/sfuosdev/emailbackend/dto/ApplicationSubmissionResponse.java
create mode 100644 src/main/java/com/sfuosdev/emailbackend/model/Application.java
create mode 100644 src/main/java/com/sfuosdev/emailbackend/model/Team.java
create mode 100644 src/main/java/com/sfuosdev/emailbackend/service/DataService.java
create mode 100644 src/main/java/com/sfuosdev/emailbackend/service/EmailService.java
create mode 100644 src/main/resources/application.properties
create mode 100644 src/test/java/com/sfuosdev/emailbackend/EmailBackendApplicationTests.java
diff --git a/.gitignore b/.gitignore
index 35e8174..93f9088 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,36 @@
-# Dependencies
+# Java/Maven
+target/
+!.mvn/wrapper/maven-wrapper.jar
+!**/src/main/**/target/
+!**/src/test/**/target/
+*.class
+*.jar
+*.war
+*.ear
+*.nar
+hs_err_pid*
+
+# Spring Boot
+*.log
+spring.log
+
+# Node.js (legacy files)
node_modules/
+package-lock.json
+package.json
+index.js
+routes/
+services/
+models/
+examples/
# Environment variables
.env
+.env.local
+.env.docker
+
+# Data storage
+data/
# Logs
logs
@@ -27,7 +55,22 @@ temp/
# IDE
.vscode/
.idea/
+*.iml
+*.ipr
+*.iws
+.project
+.classpath
+.settings/
# OS
.DS_Store
-Thumbs.db
\ No newline at end of file
+Thumbs.db
+
+# Docker
+.dockerignore
+
+# SSL certificates
+ssl/
+*.pem
+*.key
+*.crt
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..1502e16
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,42 @@
+# Multi-stage build for optimal image size
+FROM maven:3.9.4-eclipse-temurin-17 AS build
+
+# Set working directory
+WORKDIR /app
+
+# Copy all source files
+COPY pom.xml .
+COPY src ./src
+
+# Build the application
+RUN mvn clean package -DskipTests
+
+# Production stage
+FROM eclipse-temurin:17-jre-alpine
+
+# Create app user for security
+RUN addgroup -g 1001 -S appgroup && \
+ adduser -u 1001 -S appuser -G appgroup
+
+# Set working directory
+WORKDIR /app
+
+# Copy built JAR from build stage
+COPY --from=build /app/target/email-backend-*.jar app.jar
+
+# Create data directory for JSON storage
+RUN mkdir -p /app/data && \
+ chown -R appuser:appgroup /app
+
+# Switch to non-root user
+USER appuser
+
+# Expose port
+EXPOSE 3000
+
+# Health check
+HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
+ CMD wget --no-verbose --tries=1 --spider http://localhost:3000/health || exit 1
+
+# Run the application
+ENTRYPOINT ["java", "-jar", "app.jar"]
\ No newline at end of file
diff --git a/README.md b/README.md
index 323719a..77abb83 100644
--- a/README.md
+++ b/README.md
@@ -1,84 +1,132 @@
# Email-Backend
-Backend server to receive notification via email for any applicants applying for executive and project lead positions.
+Spring Boot backend server to receive notifications via email for any applicants applying for executive and project lead positions.
## Features
- 📧 **Automated Email Notifications**: Sends email notifications to executives and project leads when new applications are submitted
- 🏢 **Team Management**: Organize teams with their respective executives and project leads
- 📊 **Application Tracking**: Track application status and view statistics
-- 🔧 **Easy Configuration**: Simple environment-based configuration
+- 🔧 **Easy Configuration**: Environment-based configuration with Docker deployment
- 🚀 **RESTful API**: Clean REST API for integration with frontend applications
+- 🐳 **Docker Ready**: Containerized application with Docker Compose for easy deployment
+- 🔒 **Production Ready**: Includes nginx reverse proxy, monitoring, and security configurations
## Quick Start
-### 1. Installation
+### Option 1: Docker Deployment (Recommended)
+#### Prerequisites
+- Docker and Docker Compose installed
+- Port 3000 available (or configure different port)
+
+#### Basic Deployment
+```bash
+# Clone and navigate to repository
+git clone
+cd Email-Backend
+
+# Deploy with Docker
+./deploy.sh basic
+```
+
+#### Production Deployment with Nginx
+```bash
+# Deploy with reverse proxy
+./deploy.sh production
+```
+
+#### Full Stack with Monitoring
```bash
-npm install
+# Deploy with Prometheus and Grafana monitoring
+./deploy.sh monitoring
```
-### 2. Configuration
+### Option 2: Manual Spring Boot Deployment
-Copy the example environment file and configure your settings:
+#### Prerequisites
+- Java 17 or higher
+- Maven 3.6 or higher
+#### Build and Run
```bash
-cp .env.example .env
+# Build the application
+mvn clean package
+
+# Run the application
+java -jar target/email-backend-*.jar
+
+# Or run in development mode
+mvn spring-boot:run
```
-Edit `.env` with your email configuration:
+## Configuration
+
+### Environment Variables
+
+Create a `.env` file (copy from `.env.docker`) and configure:
```env
# Server Configuration
PORT=3000
-NODE_ENV=development
+APP_NAME=Executive Hiring Notification System
-# Email Configuration (Gmail example)
+# Email Configuration
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-app-password
-EMAIL_FROM=noreply@yourcompany.com
-
-# Application Configuration
-APP_NAME=Executive Hiring Notification System
```
-### 3. Start the Server
+### Email Provider Examples
-```bash
-# Development mode with auto-reload
-npm run dev
+#### Gmail
+```env
+EMAIL_HOST=smtp.gmail.com
+EMAIL_PORT=587
+EMAIL_USER=your-email@gmail.com
+EMAIL_PASS=your-app-password # Use App Password, not regular password
+```
-# Production mode
-npm start
+#### Outlook/Hotmail
+```env
+EMAIL_HOST=smtp-mail.outlook.com
+EMAIL_PORT=587
+EMAIL_USER=your-email@outlook.com
+EMAIL_PASS=your-password
```
-The server will start on `http://localhost:3000` (or your configured PORT).
+#### Custom SMTP
+```env
+EMAIL_HOST=your-smtp-server.com
+EMAIL_PORT=587
+EMAIL_USER=your-email@domain.com
+EMAIL_PASS=your-password
+```
## API Endpoints
### Applications
-- `POST /api/applications` - Submit a new application
-- `GET /api/applications` - Get all applications (with optional filtering)
-- `GET /api/applications/:id` - Get specific application
-- `PATCH /api/applications/:id/status` - Update application status
+- `POST /api/applications` - Submit a new application (triggers email notifications)
+- `GET /api/applications` - Get all applications (with optional filtering by team/status)
+- `GET /api/applications/{id}` - Get specific application
+- `PATCH /api/applications/{id}/status` - Update application status
- `GET /api/applications/stats/summary` - Get application statistics
### Teams
- `GET /api/teams` - Get all teams
-- `GET /api/teams/:id` - Get specific team
+- `GET /api/teams/{id}` - Get specific team
- `POST /api/teams` - Create new team
-- `PUT /api/teams/:id` - Update team
-- `DELETE /api/teams/:id` - Delete team
-- `POST /api/teams/:id/test-email` - Send test email notification
+- `PUT /api/teams/{id}` - Update team
+- `DELETE /api/teams/{id}` - Delete team
+- `POST /api/teams/{id}/test-email` - Send test email notification
- `GET /api/teams/email/status` - Check email service status
### System
-- `GET /health` - Health check endpoint
+- `GET /health` - Health check endpoint (Spring Boot Actuator)
- `GET /` - API information
## Usage Examples
@@ -111,16 +159,54 @@ curl -X POST http://localhost:3000/api/teams \
}'
```
-### Get All Applications for a Team
+## Docker Deployment
+### Basic Setup
```bash
-curl "http://localhost:3000/api/applications?team=Engineering"
+# Start basic service
+./deploy.sh basic
+
+# Check status
+./deploy.sh status
+
+# View logs
+./deploy.sh logs
+
+# Stop services
+./deploy.sh stop
+```
+
+### Production Setup
+The production setup includes:
+- Nginx reverse proxy with rate limiting
+- SSL/HTTPS support (configure certificates)
+- Security headers and gzip compression
+- Health checks and monitoring
+
+```bash
+# Deploy production setup
+./deploy.sh production
+
+# Service available at http://localhost (port 80)
+# Backend API at http://localhost:3000
+```
+
+### Monitoring Stack
+Includes Prometheus and Grafana for monitoring:
+
+```bash
+# Deploy with monitoring
+./deploy.sh monitoring
+
+# Access points:
+# - Application: http://localhost
+# - Prometheus: http://localhost:9090
+# - Grafana: http://localhost:3001 (admin/admin)
```
## Data Models
### Application
-
```json
{
"id": "unique-id",
@@ -130,13 +216,12 @@ curl "http://localhost:3000/api/applications?team=Engineering"
"team": "Engineering",
"resumeUrl": "https://example.com/resume.pdf",
"coverLetter": "Cover letter text...",
- "appliedAt": "2024-01-01T12:00:00.000Z",
+ "appliedAt": "2024-01-01T12:00:00",
"status": "pending"
}
```
### Team
-
```json
{
"id": "unique-id",
@@ -144,70 +229,139 @@ curl "http://localhost:3000/api/applications?team=Engineering"
"description": "Software development team",
"executives": ["cto@company.com"],
"projectLeads": ["eng-lead@company.com"],
- "createdAt": "2024-01-01T12:00:00.000Z"
+ "createdAt": "2024-01-01T12:00:00"
}
```
-## Email Configuration
-
-The system supports various email providers. Here are some common configurations:
+## Deployment Platforms
-### Gmail
+### NAS Servers
+The Docker Compose setup is perfect for NAS servers like:
+- **Synology NAS**: Use Container Manager
+- **QNAP NAS**: Use Container Station
+- **TrueNAS**: Use TrueCharts or custom deployment
-```env
-EMAIL_HOST=smtp.gmail.com
-EMAIL_PORT=587
-EMAIL_USER=your-email@gmail.com
-EMAIL_PASS=your-app-password # Use App Password, not regular password
+```bash
+# On NAS, clone repository and run:
+./deploy.sh production
```
-### Outlook/Hotmail
+### Cloud Platforms
-```env
-EMAIL_HOST=smtp-mail.outlook.com
-EMAIL_PORT=587
-EMAIL_USER=your-email@outlook.com
-EMAIL_PASS=your-password
+#### Firebase Hosting + Cloud Run
+```bash
+# Build and push to Google Container Registry
+docker build -t gcr.io/your-project/email-backend .
+docker push gcr.io/your-project/email-backend
+
+# Deploy to Cloud Run
+gcloud run deploy email-backend \
+ --image gcr.io/your-project/email-backend \
+ --platform managed \
+ --allow-unauthenticated
```
-### Custom SMTP
+#### AWS ECS/Fargate
+Use the provided Dockerfile with AWS ECS task definitions.
-```env
-EMAIL_HOST=your-smtp-server.com
-EMAIL_PORT=587
-EMAIL_USER=your-email@domain.com
-EMAIL_PASS=your-password
-```
+#### DigitalOcean Apps
+Connect your repository and use the Dockerfile for automatic deployment.
## Development
### Project Structure
-
```
-├── index.js # Main server file
-├── models/ # Data models
-│ ├── Application.js
-│ └── Team.js
-├── routes/ # API routes
-│ ├── applications.js
-│ └── teams.js
-├── services/ # Business logic
-│ ├── emailService.js
-│ └── dataService.js
-└── data/ # JSON data storage
- ├── applications.json
- └── teams.json
+src/
+├── main/
+│ ├── java/com/sfuosdev/emailbackend/
+│ │ ├── controller/ # REST controllers
+│ │ ├── service/ # Business logic
+│ │ ├── model/ # Data models
+│ │ ├── dto/ # Data transfer objects
+│ │ ├── config/ # Configuration classes
+│ │ └── EmailBackendApplication.java
+│ └── resources/
+│ └── application.properties
+├── test/ # Unit and integration tests
+├── Dockerfile # Container definition
+├── docker-compose.yml # Multi-container setup
+├── deploy.sh # Deployment script
+└── pom.xml # Maven dependencies
```
### Default Teams
-
The system comes with three pre-configured teams:
-
1. **Engineering** - Software development and technical roles
2. **Product** - Product management and design roles
3. **Marketing** - Marketing and growth roles
-You can modify these or add new teams via the API.
+### Building from Source
+```bash
+# Clone repository
+git clone
+cd Email-Backend
+
+# Build with Maven
+mvn clean package
+
+# Run tests
+mvn test
+
+# Run application
+mvn spring-boot:run
+```
+
+## Monitoring and Health Checks
+
+### Health Endpoints
+- `/health` - Application health status
+- `/actuator/health` - Detailed health information
+- `/actuator/info` - Application information
+
+### Docker Health Checks
+The Docker containers include built-in health checks that monitor application availability.
+
+### Prometheus Metrics
+When deployed with monitoring, metrics are available at `/actuator/prometheus`.
+
+## Security
+
+### Production Security Features
+- CORS configuration for API access
+- Rate limiting via nginx
+- Security headers (X-Frame-Options, X-Content-Type-Options, etc.)
+- Non-root user in Docker container
+- Input validation and sanitization
+
+### SSL/HTTPS Setup
+Uncomment SSL configuration in `nginx.conf` and provide certificates:
+```bash
+# Create SSL directory and add certificates
+mkdir ssl
+# Add cert.pem and key.pem to ssl/ directory
+# Update docker-compose.yml to mount SSL directory
+```
+
+## Troubleshooting
+
+### Common Issues
+
+1. **Email not sending**: Check email configuration in `.env` file
+2. **Port conflicts**: Change PORT in `.env` or docker-compose.yml
+3. **Permission issues**: Ensure Docker has proper permissions
+4. **Memory issues**: Adjust JVM settings in Dockerfile if needed
+
+### Logs and Debugging
+```bash
+# View application logs
+./deploy.sh logs
+
+# View all container logs
+docker-compose logs
+
+# Debug email configuration
+curl http://localhost:3000/api/teams/email/status
+```
## Contributing
diff --git a/data/applications.json b/data/applications.json
index 0748951..6e52308 100644
--- a/data/applications.json
+++ b/data/applications.json
@@ -1,66 +1,11 @@
-[
- {
- "id": "mfudkrnfy4ouj7erm18",
- "applicantName": "John Doe",
- "applicantEmail": "john@example.com",
- "position": "Senior Software Engineer",
- "team": "Engineering",
- "resumeUrl": "https://example.com/resume.pdf",
- "coverLetter": "I am excited to apply for this position and believe my experience in full-stack development would be valuable to your team.",
- "appliedAt": "2025-09-22T00:15:34.395Z",
- "status": "pending"
- },
- {
- "id": "mfudlgi4z6nn9ag2e2k",
- "applicantName": "Jane Smith",
- "applicantEmail": "jane@example.com",
- "position": "Product Manager",
- "team": "Product",
- "coverLetter": "I have 5 years of experience in product management and am passionate about building user-centric products.",
- "appliedAt": "2025-09-22T00:16:06.604Z",
- "status": "pending"
- },
- {
- "id": "mfudlzhcf4vmuzsq51",
- "applicantName": "Alice Johnson",
- "applicantEmail": "alice@example.com",
- "position": "Senior Data Scientist",
- "team": "Data Science",
- "resumeUrl": "https://example.com/alice-resume.pdf",
- "coverLetter": "I have extensive experience in machine learning and statistical analysis, with a PhD in Statistics and 3 years at a leading tech company.",
- "appliedAt": "2025-09-22T00:16:31.200Z",
- "status": "pending"
- },
- {
- "id": "mfudpebmzfrn9fb0leq",
- "applicantName": "Sarah Chen",
- "applicantEmail": "sarah.chen@example.com",
- "position": "Senior Full Stack Developer",
- "team": "Engineering",
- "resumeUrl": "https://example.com/sarah-resume.pdf",
- "coverLetter": "I have 6 years of experience in React, Node.js, and cloud technologies. I am passionate about building scalable web applications and leading technical initiatives.",
- "appliedAt": "2025-09-22T00:19:10.402Z",
- "status": "pending"
- },
- {
- "id": "mfudpec5dscpafxqtxi",
- "applicantName": "Michael Rodriguez",
- "applicantEmail": "michael.r@example.com",
- "position": "Senior Product Manager",
- "team": "Product",
- "coverLetter": "With 8 years in product management at high-growth startups, I specialize in user research, roadmap planning, and cross-functional team leadership.",
- "appliedAt": "2025-09-22T00:19:10.421Z",
- "status": "pending"
- },
- {
- "id": "mfudpecaqrsyn8vxdah",
- "applicantName": "Jennifer Kim",
- "applicantEmail": "jennifer.kim@example.com",
- "position": "Digital Marketing Manager",
- "team": "Marketing",
- "resumeUrl": "https://example.com/jennifer-resume.pdf",
- "coverLetter": "I have successfully led digital marketing campaigns that increased user acquisition by 300% and managed marketing budgets of $2M+.",
- "appliedAt": "2025-09-22T00:19:10.426Z",
- "status": "pending"
- }
-]
\ No newline at end of file
+[ {
+ "id" : "mfueb93x143c8dfd",
+ "applicantName" : "John Doe",
+ "applicantEmail" : "john@example.com",
+ "position" : "Senior Software Engineer",
+ "team" : "Engineering",
+ "resumeUrl" : "https://example.com/resume.pdf",
+ "coverLetter" : "I am excited to apply for this position and bring my Spring Boot expertise to your team.",
+ "appliedAt" : "2025-09-22T00:36:10",
+ "status" : "pending"
+} ]
\ No newline at end of file
diff --git a/data/teams.json b/data/teams.json
index abfcdae..956ca7b 100644
--- a/data/teams.json
+++ b/data/teams.json
@@ -1,64 +1,25 @@
-[
- {
- "id": "engineering",
- "name": "Engineering",
- "description": "Software development and technical roles",
- "executives": [
- "cto@company.com"
- ],
- "projectLeads": [
- "eng-lead@company.com"
- ],
- "createdAt": "2025-09-22T00:11:57.322Z"
- },
- {
- "id": "product",
- "name": "Product",
- "description": "Product management and design roles",
- "executives": [
- "cpo@company.com"
- ],
- "projectLeads": [
- "product-lead@company.com"
- ],
- "createdAt": "2025-09-22T00:11:57.322Z"
- },
- {
- "id": "marketing",
- "name": "Marketing",
- "description": "Marketing and growth roles",
- "executives": [
- "cmo@company.com"
- ],
- "projectLeads": [
- "marketing-lead@company.com"
- ],
- "createdAt": "2025-09-22T00:11:57.322Z"
- },
- {
- "id": "mfudlsejt3id23x2dym",
- "name": "Data Science",
- "description": "Data science and analytics team",
- "executives": [
- "cdo@company.com"
- ],
- "projectLeads": [
- "data-lead@company.com",
- "analytics-lead@company.com"
- ],
- "createdAt": "2025-09-22T00:16:22.027Z"
- },
- {
- "id": "mfudpech246lxameuwti",
- "name": "DevOps",
- "description": "Infrastructure and deployment team",
- "executives": [
- "cto@company.com"
- ],
- "projectLeads": [
- "devops-lead@company.com",
- "infrastructure-lead@company.com"
- ],
- "createdAt": "2025-09-22T00:19:10.433Z"
- }
-]
\ No newline at end of file
+[ {
+ "id" : "engineering",
+ "name" : "Engineering",
+ "description" : "Software development and technical roles",
+ "executives" : [ "cto@company.com" ],
+ "projectLeads" : [ "eng-lead@company.com" ],
+ "createdAt" : "2025-09-22T00:35:44",
+ "allNotificationEmails" : [ "cto@company.com", "eng-lead@company.com" ]
+}, {
+ "id" : "product",
+ "name" : "Product",
+ "description" : "Product management and design roles",
+ "executives" : [ "cpo@company.com" ],
+ "projectLeads" : [ "product-lead@company.com" ],
+ "createdAt" : "2025-09-22T00:35:44",
+ "allNotificationEmails" : [ "cpo@company.com", "product-lead@company.com" ]
+}, {
+ "id" : "marketing",
+ "name" : "Marketing",
+ "description" : "Marketing and growth roles",
+ "executives" : [ "cmo@company.com" ],
+ "projectLeads" : [ "marketing-lead@company.com" ],
+ "createdAt" : "2025-09-22T00:35:44",
+ "allNotificationEmails" : [ "cmo@company.com", "marketing-lead@company.com" ]
+} ]
\ No newline at end of file
diff --git a/deploy.sh b/deploy.sh
new file mode 100755
index 0000000..9b0eb6e
--- /dev/null
+++ b/deploy.sh
@@ -0,0 +1,164 @@
+#!/bin/bash
+
+# Email Backend Deployment Script
+# This script helps deploy the Spring Boot email backend using Docker Compose
+
+set -e
+
+echo "🚀 Email Backend Deployment Script"
+echo "=================================="
+
+# Check if Docker and Docker Compose are installed
+if ! command -v docker &> /dev/null; then
+ echo "❌ Docker is not installed. Please install Docker first."
+ exit 1
+fi
+
+if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null; then
+ echo "❌ Docker Compose is not installed. Please install Docker Compose first."
+ exit 1
+fi
+
+# Function to deploy basic setup
+deploy_basic() {
+ echo "📦 Deploying basic email backend..."
+
+ # Create data directory
+ mkdir -p data
+
+ # Copy environment template if .env doesn't exist
+ if [ ! -f .env ]; then
+ echo "📝 Creating .env file from template..."
+ cp .env.docker .env
+ echo "⚠️ Please edit .env file with your email configuration before starting the service"
+ fi
+
+ # Build and start the service
+ docker-compose up -d --build
+
+ echo "✅ Basic deployment completed!"
+ echo "🌐 Service will be available at: http://localhost:3000"
+ echo "📧 Configure email settings in .env file and restart if needed"
+}
+
+# Function to deploy with nginx proxy
+deploy_production() {
+ echo "🏭 Deploying production setup with nginx..."
+
+ # Create data directory
+ mkdir -p data
+
+ # Copy environment template if .env doesn't exist
+ if [ ! -f .env ]; then
+ cp .env.docker .env
+ echo "⚠️ Please edit .env file with your configuration"
+ fi
+
+ # Deploy with production profile
+ docker-compose --profile production up -d --build
+
+ echo "✅ Production deployment completed!"
+ echo "🌐 Service available at: http://localhost (port 80)"
+ echo "🌐 Direct backend access: http://localhost:3000"
+}
+
+# Function to deploy with monitoring
+deploy_monitoring() {
+ echo "📊 Deploying with monitoring (Prometheus + Grafana)..."
+
+ mkdir -p data monitoring
+
+ # Create Prometheus config if it doesn't exist
+ if [ ! -f monitoring/prometheus.yml ]; then
+ cat > monitoring/prometheus.yml << EOF
+global:
+ scrape_interval: 15s
+
+scrape_configs:
+ - job_name: 'email-backend'
+ static_configs:
+ - targets: ['email-backend:3000']
+ metrics_path: '/actuator/prometheus'
+ scrape_interval: 5s
+EOF
+ fi
+
+ if [ ! -f .env ]; then
+ cp .env.docker .env
+ fi
+
+ # Deploy with monitoring profile
+ docker-compose --profile production --profile monitoring up -d --build
+
+ echo "✅ Monitoring deployment completed!"
+ echo "🌐 Application: http://localhost"
+ echo "📊 Prometheus: http://localhost:9090"
+ echo "📈 Grafana: http://localhost:3001 (admin/admin)"
+}
+
+# Function to stop services
+stop_services() {
+ echo "🛑 Stopping email backend services..."
+ docker-compose --profile production --profile monitoring down
+ echo "✅ Services stopped"
+}
+
+# Function to show logs
+show_logs() {
+ echo "📋 Showing email backend logs..."
+ docker-compose logs -f email-backend
+}
+
+# Function to show status
+show_status() {
+ echo "📊 Email Backend Status"
+ echo "======================"
+ docker-compose ps
+ echo ""
+ echo "🔍 Health Check:"
+ curl -s http://localhost:3000/health | jq . || echo "Service not responding"
+}
+
+# Main menu
+case "${1:-menu}" in
+ "basic")
+ deploy_basic
+ ;;
+ "production")
+ deploy_production
+ ;;
+ "monitoring")
+ deploy_monitoring
+ ;;
+ "stop")
+ stop_services
+ ;;
+ "logs")
+ show_logs
+ ;;
+ "status")
+ show_status
+ ;;
+ "menu"|*)
+ echo ""
+ echo "Usage: $0 [command]"
+ echo ""
+ echo "Commands:"
+ echo " basic - Deploy basic setup (backend only)"
+ echo " production - Deploy with nginx reverse proxy"
+ echo " monitoring - Deploy with nginx + monitoring stack"
+ echo " stop - Stop all services"
+ echo " logs - Show application logs"
+ echo " status - Show service status"
+ echo ""
+ echo "Examples:"
+ echo " $0 basic # Simple deployment for development"
+ echo " $0 production # Production deployment with nginx"
+ echo " $0 monitoring # Full stack with monitoring"
+ echo ""
+ echo "📝 Configuration:"
+ echo " - Edit .env file for email settings"
+ echo " - Edit docker-compose.yml for advanced configuration"
+ echo " - Edit nginx.conf for proxy settings"
+ ;;
+esac
\ No newline at end of file
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..8df889a
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,86 @@
+version: '3.8'
+
+services:
+ email-backend:
+ build: .
+ container_name: email-backend
+ ports:
+ - "3000:3000"
+ environment:
+ # Server Configuration
+ - PORT=3000
+ - APP_NAME=Executive Hiring Notification System
+
+ # Email Configuration (configure these for production)
+ # - EMAIL_HOST=smtp.gmail.com
+ # - EMAIL_PORT=587
+ # - EMAIL_USER=your-email@gmail.com
+ # - EMAIL_PASS=your-app-password
+
+ volumes:
+ # Persist data directory for JSON storage
+ - ./data:/app/data
+ # Optional: Mount custom configuration
+ # - ./config:/app/config
+
+ restart: unless-stopped
+
+ healthcheck:
+ test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/health"]
+ interval: 30s
+ timeout: 10s
+ retries: 3
+ start_period: 40s
+
+ labels:
+ - "com.sfuosdev.service=email-backend"
+ - "com.sfuosdev.version=1.0.0"
+ - "com.sfuosdev.description=Executive Hiring Email Notification System"
+
+# Optional: Add nginx reverse proxy for production
+ nginx:
+ image: nginx:alpine
+ container_name: email-backend-nginx
+ ports:
+ - "80:80"
+ - "443:443"
+ volumes:
+ - ./nginx.conf:/etc/nginx/nginx.conf:ro
+ # - ./ssl:/etc/nginx/ssl:ro # Uncomment for SSL certificates
+ depends_on:
+ - email-backend
+ restart: unless-stopped
+ profiles:
+ - production
+
+# Optional: Add monitoring with Prometheus and Grafana
+ prometheus:
+ image: prom/prometheus:latest
+ container_name: email-backend-prometheus
+ ports:
+ - "9090:9090"
+ volumes:
+ - ./monitoring/prometheus.yml:/etc/prometheus/prometheus.yml:ro
+ restart: unless-stopped
+ profiles:
+ - monitoring
+
+ grafana:
+ image: grafana/grafana:latest
+ container_name: email-backend-grafana
+ ports:
+ - "3001:3000"
+ environment:
+ - GF_SECURITY_ADMIN_PASSWORD=admin
+ volumes:
+ - grafana-data:/var/lib/grafana
+ restart: unless-stopped
+ profiles:
+ - monitoring
+
+volumes:
+ grafana-data:
+
+networks:
+ default:
+ name: email-backend-network
\ No newline at end of file
diff --git a/nginx.conf b/nginx.conf
new file mode 100644
index 0000000..b2deffb
--- /dev/null
+++ b/nginx.conf
@@ -0,0 +1,76 @@
+events {
+ worker_connections 1024;
+}
+
+http {
+ upstream email-backend {
+ server email-backend:3000;
+ }
+
+ # Rate limiting
+ limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s;
+
+ server {
+ listen 80;
+ server_name localhost;
+
+ # Security headers
+ add_header X-Frame-Options DENY;
+ add_header X-Content-Type-Options nosniff;
+ add_header X-XSS-Protection "1; mode=block";
+ add_header Referrer-Policy "strict-origin-when-cross-origin";
+
+ # Gzip compression
+ gzip on;
+ gzip_vary on;
+ gzip_min_length 1024;
+ gzip_types
+ text/plain
+ text/css
+ text/xml
+ text/javascript
+ application/json
+ application/javascript
+ application/xml+rss
+ application/atom+xml;
+
+ # API endpoints
+ location / {
+ limit_req zone=api burst=20 nodelay;
+
+ proxy_pass http://email-backend;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+
+ # Timeouts
+ proxy_connect_timeout 30s;
+ proxy_send_timeout 30s;
+ proxy_read_timeout 30s;
+ }
+
+ # Health check (bypass rate limiting)
+ location /health {
+ proxy_pass http://email-backend;
+ proxy_set_header Host $host;
+ proxy_set_header X-Real-IP $remote_addr;
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
+ }
+ }
+
+ # Optional SSL configuration (uncomment and configure for HTTPS)
+ # server {
+ # listen 443 ssl http2;
+ # server_name localhost;
+ #
+ # ssl_certificate /etc/nginx/ssl/cert.pem;
+ # ssl_certificate_key /etc/nginx/ssl/key.pem;
+ # ssl_protocols TLSv1.2 TLSv1.3;
+ # ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384;
+ # ssl_prefer_server_ciphers off;
+ #
+ # # Same location blocks as HTTP server
+ # }
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..6086781
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,108 @@
+
+
+ 4.0.0
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 3.2.0
+
+
+
+ com.sfuosdev
+ email-backend
+ 1.0.0
+ email-backend
+ Backend server to receive notification via email for any applicants applying
+ jar
+
+
+ 17
+ 17
+ 17
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-mail
+
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
+
+
+ org.springframework.boot
+ spring-boot-starter-json
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+
+
+
+ com.fasterxml.jackson.datatype
+ jackson-datatype-jsr310
+
+
+
+
+ org.apache.commons
+ commons-lang3
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+ org.springframework.boot
+ spring-boot-testcontainers
+ test
+
+
+
+ org.testcontainers
+ junit-jupiter
+ test
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/sfuosdev/emailbackend/EmailBackendApplication.java b/src/main/java/com/sfuosdev/emailbackend/EmailBackendApplication.java
new file mode 100644
index 0000000..2279014
--- /dev/null
+++ b/src/main/java/com/sfuosdev/emailbackend/EmailBackendApplication.java
@@ -0,0 +1,13 @@
+package com.sfuosdev.emailbackend;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.scheduling.annotation.EnableAsync;
+
+@SpringBootApplication
+@EnableAsync
+public class EmailBackendApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(EmailBackendApplication.class, args);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/sfuosdev/emailbackend/config/EmailConfig.java b/src/main/java/com/sfuosdev/emailbackend/config/EmailConfig.java
new file mode 100644
index 0000000..4b0def9
--- /dev/null
+++ b/src/main/java/com/sfuosdev/emailbackend/config/EmailConfig.java
@@ -0,0 +1,45 @@
+package com.sfuosdev.emailbackend.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.mail.javamail.JavaMailSender;
+import org.springframework.mail.javamail.JavaMailSenderImpl;
+
+import java.util.Properties;
+
+@Configuration
+public class EmailConfig {
+
+ @Value("${spring.mail.host:#{null}}")
+ private String host;
+
+ @Value("${spring.mail.port:587}")
+ private int port;
+
+ @Value("${spring.mail.username:#{null}}")
+ private String username;
+
+ @Value("${spring.mail.password:#{null}}")
+ private String password;
+
+ @Bean
+ public JavaMailSender javaMailSender() {
+ JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
+
+ if (host != null && username != null && password != null) {
+ mailSender.setHost(host);
+ mailSender.setPort(port);
+ mailSender.setUsername(username);
+ mailSender.setPassword(password);
+
+ Properties props = mailSender.getJavaMailProperties();
+ props.put("mail.transport.protocol", "smtp");
+ props.put("mail.smtp.auth", "true");
+ props.put("mail.smtp.starttls.enable", "true");
+ props.put("mail.debug", "false");
+ }
+
+ return mailSender;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/sfuosdev/emailbackend/config/WebConfig.java b/src/main/java/com/sfuosdev/emailbackend/config/WebConfig.java
new file mode 100644
index 0000000..076df35
--- /dev/null
+++ b/src/main/java/com/sfuosdev/emailbackend/config/WebConfig.java
@@ -0,0 +1,18 @@
+package com.sfuosdev.emailbackend.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@Configuration
+public class WebConfig implements WebMvcConfigurer {
+
+ @Override
+ public void addCorsMappings(CorsRegistry registry) {
+ registry.addMapping("/**")
+ .allowedOrigins("*")
+ .allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS")
+ .allowedHeaders("*")
+ .maxAge(3600);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/sfuosdev/emailbackend/controller/ApplicationController.java b/src/main/java/com/sfuosdev/emailbackend/controller/ApplicationController.java
new file mode 100644
index 0000000..0293204
--- /dev/null
+++ b/src/main/java/com/sfuosdev/emailbackend/controller/ApplicationController.java
@@ -0,0 +1,197 @@
+package com.sfuosdev.emailbackend.controller;
+
+import com.sfuosdev.emailbackend.dto.ApiResponse;
+import com.sfuosdev.emailbackend.dto.ApplicationStats;
+import com.sfuosdev.emailbackend.dto.ApplicationSubmissionResponse;
+import com.sfuosdev.emailbackend.model.Application;
+import com.sfuosdev.emailbackend.model.Team;
+import com.sfuosdev.emailbackend.service.DataService;
+import com.sfuosdev.emailbackend.service.EmailService;
+import jakarta.validation.Valid;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.concurrent.ExecutionException;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/api/applications")
+@CrossOrigin(origins = "*")
+public class ApplicationController {
+ private static final Logger logger = LoggerFactory.getLogger(ApplicationController.class);
+
+ private final DataService dataService;
+ private final EmailService emailService;
+
+ public ApplicationController(DataService dataService, EmailService emailService) {
+ this.dataService = dataService;
+ this.emailService = emailService;
+ }
+
+ @PostMapping
+ public ResponseEntity> submitApplication(@Valid @RequestBody Application application) {
+ try {
+ // Check if the team exists
+ Optional team = dataService.getTeamByName(application.getTeam());
+ if (team.isEmpty()) {
+ List availableTeams = dataService.getAllTeams().stream()
+ .map(Team::getName)
+ .collect(Collectors.toList());
+
+ return ResponseEntity.badRequest().body(
+ ApiResponse.error("Invalid team",
+ String.format("Team \"%s\" not found. Please use one of the existing teams: %s",
+ application.getTeam(), String.join(", ", availableTeams)))
+ );
+ }
+
+ // Save the application
+ Application savedApplication = dataService.saveApplication(application);
+
+ // Get notification recipients from the team
+ List recipients = team.get().getAllNotificationEmails();
+
+ // Send email notifications
+ EmailService.EmailResult emailResult = emailService.sendApplicationNotification(
+ savedApplication, recipients).get();
+
+ ApplicationSubmissionResponse.EmailNotificationResult notificationResult =
+ new ApplicationSubmissionResponse.EmailNotificationResult(
+ emailResult.isSuccess(), recipients, emailResult.getMessage());
+
+ ApplicationSubmissionResponse response = new ApplicationSubmissionResponse(
+ savedApplication, notificationResult);
+
+ logger.info("📧 Application notification sent for {} ({}) to team {}",
+ application.getApplicantName(), application.getPosition(), team.get().getName());
+ logger.info("Recipients: {}", String.join(", ", recipients));
+
+ return ResponseEntity.status(HttpStatus.CREATED).body(
+ ApiResponse.success("Application submitted successfully", response)
+ );
+
+ } catch (IOException e) {
+ logger.error("Error submitting application: {}", e.getMessage());
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(
+ ApiResponse.error("Failed to submit application", e.getMessage())
+ );
+ } catch (InterruptedException | ExecutionException e) {
+ logger.error("Error sending email notification: {}", e.getMessage());
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(
+ ApiResponse.error("Failed to send email notification", e.getMessage())
+ );
+ }
+ }
+
+ @GetMapping
+ public ResponseEntity>> getAllApplications(
+ @RequestParam(required = false) String team,
+ @RequestParam(required = false) String status) {
+
+ List applications = dataService.getAllApplications();
+
+ // Apply filters
+ if (team != null && !team.isEmpty()) {
+ applications = applications.stream()
+ .filter(app -> app.getTeam().equalsIgnoreCase(team))
+ .collect(Collectors.toList());
+ }
+
+ if (status != null && !status.isEmpty()) {
+ applications = applications.stream()
+ .filter(app -> app.getStatus().equals(status))
+ .collect(Collectors.toList());
+ }
+
+ Map result = Map.of(
+ "count", applications.size(),
+ "applications", applications
+ );
+
+ return ResponseEntity.ok(ApiResponse.success("Applications retrieved successfully", result));
+ }
+
+ @GetMapping("/{id}")
+ public ResponseEntity> getApplicationById(@PathVariable String id) {
+ Optional application = dataService.getApplicationById(id);
+
+ if (application.isEmpty()) {
+ return ResponseEntity.status(HttpStatus.NOT_FOUND).body(
+ ApiResponse.error("Application not found",
+ String.format("Application with ID \"%s\" does not exist", id))
+ );
+ }
+
+ return ResponseEntity.ok(ApiResponse.success("Application retrieved successfully", application.get()));
+ }
+
+ @PatchMapping("/{id}/status")
+ public ResponseEntity> updateApplicationStatus(
+ @PathVariable String id,
+ @RequestBody Map request) {
+
+ String status = request.get("status");
+ if (status == null || status.isEmpty()) {
+ return ResponseEntity.badRequest().body(
+ ApiResponse.error("Status is required", "Please provide a status value")
+ );
+ }
+
+ List validStatuses = Arrays.asList("pending", "reviewing", "interview", "accepted", "rejected");
+ if (!validStatuses.contains(status)) {
+ return ResponseEntity.badRequest().body(
+ ApiResponse.error("Invalid status",
+ String.format("Status must be one of: %s", String.join(", ", validStatuses)))
+ );
+ }
+
+ try {
+ Application updatedApplication = dataService.updateApplicationStatus(id, status);
+ return ResponseEntity.ok(ApiResponse.success("Application status updated successfully", updatedApplication));
+ } catch (IllegalArgumentException e) {
+ return ResponseEntity.status(HttpStatus.NOT_FOUND).body(
+ ApiResponse.error("Application not found", e.getMessage())
+ );
+ } catch (IOException e) {
+ logger.error("Error updating application status: {}", e.getMessage());
+ return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(
+ ApiResponse.error("Failed to update application status", e.getMessage())
+ );
+ }
+ }
+
+ @GetMapping("/stats/summary")
+ public ResponseEntity>> getApplicationStats() {
+ List applications = dataService.getAllApplications();
+
+ // Count by status
+ Map byStatus = applications.stream()
+ .collect(Collectors.groupingBy(
+ Application::getStatus,
+ Collectors.collectingAndThen(Collectors.counting(), Math::toIntExact)
+ ));
+
+ // Count by team
+ Map byTeam = applications.stream()
+ .collect(Collectors.groupingBy(
+ Application::getTeam,
+ Collectors.collectingAndThen(Collectors.counting(), Math::toIntExact)
+ ));
+
+ // Recent applications (last 7 days)
+ int recent = dataService.getRecentApplications(7).size();
+
+ ApplicationStats stats = new ApplicationStats(applications.size(), byStatus, byTeam, recent);
+
+ Map result = Map.of("stats", stats);
+ return ResponseEntity.ok(ApiResponse.success("Application statistics retrieved successfully", result));
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/sfuosdev/emailbackend/controller/SystemController.java b/src/main/java/com/sfuosdev/emailbackend/controller/SystemController.java
new file mode 100644
index 0000000..bded8a6
--- /dev/null
+++ b/src/main/java/com/sfuosdev/emailbackend/controller/SystemController.java
@@ -0,0 +1,42 @@
+package com.sfuosdev.emailbackend.controller;
+
+import com.sfuosdev.emailbackend.dto.ApiResponse;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.time.LocalDateTime;
+import java.util.Map;
+
+@RestController
+@CrossOrigin(origins = "*")
+public class SystemController {
+
+ @GetMapping("/health")
+ public ResponseEntity