Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
8fac185
Update README.md
codingclub-iitdh Dec 29, 2024
fa65c38
login page change
MoonKnight30 Dec 30, 2024
b110970
Updated README.md and modified backend/.env, frontend package files
anuv68 Dec 31, 2024
a8e524f
Revert "Updated README.md and modified backend/.env, frontend package…
anuv68 Dec 31, 2024
98e56d1
form pdf integration
MoonKnight30 Dec 31, 2024
33ef4af
routes
MoonKnight30 Dec 31, 2024
3786434
backend updated with user functionality working
MoonKnight30 Jan 1, 2025
4f27a4f
fixed signup
MoonKnight30 Jan 1, 2025
ebb09a0
approval model
MoonKnight30 Jan 1, 2025
bb97f8e
added page not found
MoonKnight30 Jan 2, 2025
92026b2
OAuth login working
MoonKnight30 Jan 2, 2025
255e9ed
created gitignore
MoonKnight30 Jan 2, 2025
a444f97
user details get
MoonKnight30 Jan 2, 2025
ca234d3
Replaced old Login with Google Login
UtkarshRaj130 Jan 2, 2025
0590996
Fixed Profile Page Logic (as it is from Prajwal's branch)
UtkarshRaj130 Jan 2, 2025
d357cfe
event backend and role based login updated
MoonKnight30 Jan 3, 2025
c8b2601
hierarchy based approval request
MoonKnight30 Jan 3, 2025
52fe771
functions to approve the event for a given role
MoonKnight30 Jan 3, 2025
03a2e51
event approval integrated with frontend
MoonKnight30 Jan 4, 2025
7bb5ed5
Event Form Page and generatePDF completed
UtkarshRaj130 Jan 4, 2025
f962cfd
Added Submit for Approval button
UtkarshRaj130 Jan 4, 2025
476c51d
Added My Event Applications Page
UtkarshRaj130 Jan 4, 2025
e2ffc48
Staff dashboard fixed
UtkarshRaj130 Jan 5, 2025
601ccca
Edited hardcoded pdf positions
codingclub-iitdh Jan 6, 2025
5567a86
Made relative positions
codingclub-iitdh Jan 6, 2025
fff2b14
Staff side dashboard completed
UtkarshRaj130 Jan 6, 2025
78d60f4
Added View Details Button for Club-Secretary Side
UtkarshRaj130 Jan 6, 2025
f06e811
Cleaned up a lot of unnecessary jsx
codingclub-iitdh Jan 9, 2025
8d6f937
email notification implemented
MoonKnight30 Jan 9, 2025
7693c01
Moved generatePDF() function to pdfGenerator.js
UtkarshRaj130 Jan 10, 2025
62da535
Merge branch 'Cleanup' into Utkarsh
MoonKnight30 Jan 10, 2025
81f6fb4
Fixed footer and iFrame at Event Details hidden as default
UtkarshRaj130 Jan 10, 2025
ce5d891
Improved color of Staff Dashboard Header
UtkarshRaj130 Jan 10, 2025
025312f
Added Approval Status on View Details Page
UtkarshRaj130 Jan 10, 2025
af6c4d9
Merge branch 'Prajwal' into Utkarsh
UtkarshRaj130 Feb 20, 2025
2aefb1d
Merge pull request #4 from oss2019/Utkarsh
UtkarshRaj130 Feb 20, 2025
dc18409
Modified version with query and filters
NidhishDoshi Sep 29, 2025
986c37b
fixed few ui bugs
Varaparasad Oct 9, 2025
c858da3
added event edit function
MoonKnight30 Oct 9, 2025
4f6f630
added event editable button in frontend
MoonKnight30 Oct 9, 2025
f0a6265
edit function working properly
MoonKnight30 Oct 9, 2025
de2267c
Merge pull request #5 from oss2019/main
UtkarshRaj130 Oct 10, 2025
a7fe715
added closing event function
MoonKnight30 Oct 10, 2025
a541d64
removed mail service for edited events
MoonKnight30 Oct 10, 2025
e750734
added navigating to dashboard after applying for event
MoonKnight30 Oct 10, 2025
bee48a9
made event type to be taken from club-secretary's database
MoonKnight30 Oct 10, 2025
b9ea807
Merge remote-tracking branch 'origin/Prajwal-new-updates' into Varapr…
Varaparasad Oct 10, 2025
7bc1f7a
merged new branch
Varaparasad Oct 10, 2025
7e002c1
Event Form - HTML Form updated
UtkarshRaj130 Oct 10, 2025
3431a7a
Fixed requiredfields
UtkarshRaj130 Oct 10, 2025
c9a79bb
Removed commented "//required" words
UtkarshRaj130 Oct 10, 2025
7746ada
New Format (Crudely) working on submission page
UtkarshRaj130 Oct 11, 2025
b242ce2
Merge branch 'Varaprasad' into Utkarsh
UtkarshRaj130 Oct 12, 2025
3dcbed0
Merge pull request #6 from oss2019/Utkarsh
UtkarshRaj130 Oct 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Email Configuration for Production Deployment
# ==============================================

# Gmail SMTP Configuration (recommended for production)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
EMAIL_USER=your-gmail-address@gmail.com
# Use App Password, NOT your regular Gmail password
# Generate at: https://myaccount.google.com/apppasswords
EMAIL_PASS=your-app-password-here

# Advanced SMTP Settings (optional, defaults are optimized)
SMTP_MAX_CONNECTIONS=3
SMTP_MAX_MESSAGES=50

# Environment
NODE_ENV=production

# Alternative Email Providers (uncomment to use)
# ================================================

# Outlook/Hotmail
# SMTP_HOST=smtp-mail.outlook.com
# SMTP_PORT=587
# SMTP_SECURE=false

# Yahoo Mail
# SMTP_HOST=smtp.mail.yahoo.com
# SMTP_PORT=587
# SMTP_SECURE=false

# SendGrid (Recommended for high-volume production)
# SMTP_HOST=smtp.sendgrid.net
# SMTP_PORT=587
# SMTP_SECURE=false
# EMAIL_USER=apikey
# EMAIL_PASS=your-sendgrid-api-key

# Mailgun
# SMTP_HOST=smtp.mailgun.org
# SMTP_PORT=587
# SMTP_SECURE=false
# EMAIL_USER=your-mailgun-smtp-username
# EMAIL_PASS=your-mailgun-smtp-password
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
136 changes: 136 additions & 0 deletions EMAIL_SETUP_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Email Configuration Guide for Production Deployment

## The Problem
Your application works in localhost but fails to send emails in production (Render) due to SMTP connection timeouts. This is a common issue when deploying to cloud platforms.

## Root Cause
1. **Port Configuration**: Many cloud platforms block port 465 (SMTP over SSL)
2. **Connection Timeouts**: Production environments have stricter timeout settings
3. **Gmail Security**: Gmail requires App Passwords for production applications
4. **Network Restrictions**: Some cloud providers have firewall restrictions

## Solutions Implemented

### 1. Updated SMTP Configuration
- Changed default port from 465 to 587 (STARTTLS)
- Added production-optimized timeout settings
- Implemented connection pooling with rate limiting
- Added proper TLS configuration

### 2. Added Retry Mechanism
- Automatic retry with exponential backoff
- Better error logging for debugging
- Non-blocking email failures (won't crash the application)

### 3. Environment-Specific Settings
- Different configurations for development vs production
- Comprehensive error logging
- Connection health checks

## Setup Instructions for Render

### Step 1: Configure Gmail App Password
1. Go to [Google Account Settings](https://myaccount.google.com)
2. Enable 2-Factor Authentication if not already enabled
3. Go to [App Passwords](https://myaccount.google.com/apppasswords)
4. Generate an App Password for your application
5. Use this App Password in your environment variables (NOT your regular password)

### Step 2: Set Environment Variables in Render
In your Render dashboard, add these environment variables:

```bash
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_SECURE=false
EMAIL_USER=your-gmail-address@gmail.com
EMAIL_PASS=your-app-password-here
NODE_ENV=production
```

### Step 3: Alternative Email Providers (if Gmail still fails)

#### SendGrid (Recommended for Production)
```bash
SMTP_HOST=smtp.sendgrid.net
SMTP_PORT=587
SMTP_SECURE=false
EMAIL_USER=apikey
EMAIL_PASS=your-sendgrid-api-key
```

#### Mailgun
```bash
SMTP_HOST=smtp.mailgun.org
SMTP_PORT=587
SMTP_SECURE=false
EMAIL_USER=your-mailgun-smtp-username
EMAIL_PASS=your-mailgun-smtp-password
```

### Step 4: Test the Configuration
Add this test endpoint to verify email functionality:

```javascript
// Add to your routes
app.get('/test-email', async (req, res) => {
try {
await sendEmail(
'test@example.com',
'Test Email',
'This is a test email from production'
);
res.json({ success: true, message: 'Email sent successfully' });
} catch (error) {
res.status(500).json({
success: false,
error: error.message,
code: error.code
});
}
});
```

## Troubleshooting

### Common Issues and Solutions

1. **Connection Timeout (ETIMEDOUT)**
- Switch to port 587 instead of 465
- Check if your hosting provider blocks SMTP ports
- Try alternative email providers like SendGrid

2. **Authentication Failed**
- Ensure you're using App Password, not regular password
- Verify EMAIL_USER and EMAIL_PASS are correctly set
- Check if Less Secure Apps is enabled (not recommended)

3. **TLS/SSL Issues**
- Use SMTP_SECURE=false with port 587
- Set proper TLS configuration in code

4. **Rate Limiting**
- Implemented automatic rate limiting (5 emails per second)
- Added retry mechanism for failed sends

### Debug Steps
1. Check the email health endpoint: `GET /api/email-health`
2. Monitor application logs for detailed error messages
3. Test with a simple email first
4. Verify all environment variables are set correctly

## Best Practices for Production

1. **Use Dedicated Email Services**: Consider SendGrid, Mailgun, or AWS SES for production
2. **Monitor Email Delivery**: Set up logging and monitoring for email failures
3. **Implement Email Queues**: For high-volume applications, use a queue system
4. **Error Handling**: Never let email failures crash your application
5. **Security**: Always use App Passwords or API keys, never regular passwords

## Code Changes Made

1. **Enhanced SMTP Configuration**: Added timeout settings, rate limiting, and TLS configuration
2. **Retry Logic**: Automatic retry with exponential backoff for failed emails
3. **Async/Await**: Converted all email calls to async/await with proper error handling
4. **Better Logging**: Comprehensive error logging for debugging
5. **Non-blocking**: Email failures won't block the application flow
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Fork Details
- Forked from Outpass Management System
- To Modify to convert it into an Institute Forms Portal
- Details of original project below

# Outpass Management System

## Project Overview
Expand Down
11 changes: 11 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
npm-debug.log
.env
.git
.gitignore
README.md
Dockerfile
.dockerignore
coverage
.nyc_output
.log
5 changes: 0 additions & 5 deletions backend/.env

This file was deleted.

23 changes: 23 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Use official Node.js LTS (Long Term Support) image
FROM node:22-alpine

# Set working directory
WORKDIR /app

# Copy package.json and package-lock.json (if available)
COPY package*.json ./

# Install dependencies
RUN npm ci --only=production

# Copy the rest of the application code
COPY . .

# Set the port for the container
ENV PORT=5000

# Expose the port your app runs on (adjust if different)
EXPOSE 5000

# Command to run the application
CMD ["npm", "start"]
Loading