A comprehensive, enterprise-grade form management solution built with the MERN stack (MongoDB, Express, React, Node.js). This system allows for creating dynamic forms, collecting responses, managing users with role-based access, and visualizing data through analytics.
- Customer Facing Forms: https://forms.focusengineeringapp.com
- Admin Panel: https://formsadmin.netlify.app
- Backend API: https://forms-backend-1-9ate.onrender.com/api
The project is organized into two main directories:
backend_EVS/: Node.js/Express REST API (Render).customer-module_EVS/: Premium, mobile-optimized form filler for end-users (Cloudflare Pages).frontend_EVS/: Admin dashboard for form building and analytics (Netlify).
- NPS Optimized UI: "Fit-to-Screen" mobile experience with no vertical or horizontal scrolling.
- Branded White Theme: Permanent light-mode UI for a premium, professional feel.
- Dynamic Form Builder: Create complex forms with various input types and logic.
- Multi-Channel Invites: Send via Email, SMS, and WhatsApp with real-time tracking.
- Authentication: Secure JWT-based authentication.
- File Storage:
- AWS S3 for scalable file storage.
- Cloudinary for image optimization (legacy/optional).
- Google Drive integration for specific workflows.
- Multi-Channel Notifications:
- Email: SMTP (Gmail/Outlook) or MailerSend
- SMS: Twilio SMS service
- WhatsApp: Twilio WhatsApp API
- PDF Generation: Automated PDF report generation using Puppeteer.
- Runtime: Node.js
- Framework: Express.js
- Database: MongoDB (Mongoose ODM)
- Services: AWS SDK, Twilio, Nodemailer, Puppeteer, Google APIs
- Framework: React 18
- Build Tool: Vite
- Styling: Tailwind CSS
- State/API: Context API + Custom Hooks
- Icons: Lucide React
To start the full system, run these commands in THREE separate terminals:
Terminal 1 (Backend - API & WhatsApp):
cd backend_EVS
npm run devTerminal 2 (Admin Panel):
cd frontend_EVS
npm run devTerminal 3 (Customer Module):
cd customer-module_EVS
npm run devYou can run this application in two ways:
Run everything with one command using Docker:
# Copy environment template
cp .env.docker .env
# Edit .env with your credentials
# Start all services (MongoDB, Backend, Frontend)
docker-compose up -dAccess the app at http://localhost:3000
Docker Services:
- MongoDB: Database (port 27017)
- Backend: API server (port 5000)
- Frontend: React app (port 3000)
Docker Commands:
# Start services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
# Rebuild after code changes
docker-compose up -d --build- Node.js (v18+ recommended)
- MongoDB (Local or Atlas connection)
- Git
-
Clone the repository (if not already done)
-
Install Dependencies:
# Install backend dependencies cd backend_EVS npm install # Install admin dependencies cd ../frontend_EVS npm install # Install customer module dependencies cd ../customer-module_EVS npm install
-
Configure Environment:
- Create
backend_EVS/.envwith required variables (see configuration section below) - Update MongoDB URI, SMTP credentials, and other services
- Create
-
Start the Servers:
# Terminal 1 - Backend cd backend_EVS npm run dev # Terminal 2 - Admin Panel cd frontend_EVS npm run dev # Terminal 3 - Customer Module cd customer-module_EVS npm run dev
-
Access the Application:
- Frontend: http://localhost:5173
- Backend API: http://localhost:5001
The system creates default accounts on first run:
Super Admin (System-wide access)
- Email:
superadmin@focus.com - Password:
superadmin123# - Access: All tenants, system configuration
Production Admin (Hussein)
- Email:
hussein@evsuae.com - Password:
hussein@EVS - Access: EVS NPS form management and analytics
Tenant Admin (Default Business)
- Email:
admin@focus.com - Password:
admin123# - Access: Default tenant forms and users
β οΈ Security Warning: Change these passwords immediately in production!
Create a .env file in the backend/ directory with these variables:
# Server
PORT=5001
NODE_ENV=development
# Database
MONGODB_URI=mongodb://localhost:27017/forms-db
# Or use MongoDB Atlas:
# MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/forms-db
# Authentication
JWT_SECRET=your-super-secret-jwt-key-change-this
# Frontend URL (for CORS and email links)
FRONTEND_URL=http://localhost:5173
# Email Configuration (Choose one)
# Option 1: Gmail SMTP (Recommended for development)
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=your-app-password
SHOP_EMAIL=your-email@gmail.com
# Option 2: Outlook SMTP
# SMTP_HOST=smtp-mail.outlook.com
# SMTP_PORT=587
# SMTP_USER=your-email@outlook.com
# SMTP_PASS=your-password
# Option 3: MailerSend (Production)
# MAILERSEND_API_KEY=your-mailersend-api-key
# MAILERSEND_FROM_EMAIL=noreply@yourdomain.com
# MAILERSEND_FROM_NAME=Your App Name
# SMS Configuration (Twilio)
TWILIO_ACCOUNT_SID=your-twilio-account-sid
TWILIO_AUTH_TOKEN=your-twilio-auth-token
TWILIO_SMS_NUMBER=+18452804623
TWILIO_SMS_NUMBER_SID=your-sms-number-sid
# WhatsApp Configuration (Twilio)
TWILIO_WHATSAPP_NUMBER=whatsapp:+14155238886
TWILIO_INVITE_TEMPLATE_SID=your-template-sid
# File Storage (AWS S3)
AWS_ACCESS_KEY_ID=your-aws-key
AWS_SECRET_ACCESS_KEY=your-aws-secret
AWS_REGION=us-east-1
AWS_S3_BUCKET_NAME=your-bucket-name
CLOUDFRONT_DOMAIN=your-cloudfront-domain.cloudfront.net
# Optional: Cloudinary (Legacy)
CLOUDINARY_CLOUD_NAME=your-cloud-name
CLOUDINARY_API_KEY=your-api-key
CLOUDINARY_API_SECRET=your-api-secret- Go to Google Account Settings
- Enable 2-Factor Authentication
- Generate an App Password:
- Go to Security β 2-Step Verification β App passwords
- Select "Mail" and your device
- Copy the 16-character password
- Use this password in
SMTP_PASS
Configuration:
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your-email@gmail.com
SMTP_PASS=abcd efgh ijkl mnop # 16-character app password
SHOP_EMAIL=your-email@gmail.comConfiguration:
SMTP_HOST=smtp-mail.outlook.com
SMTP_PORT=587
SMTP_USER=your-email@outlook.com
SMTP_PASS=your-password
SHOP_EMAIL=your-email@outlook.com- Sign up at MailerSend
- Verify your domain
- Get your API key
- Configure:
MAILERSEND_API_KEY=your-api-key
MAILERSEND_FROM_EMAIL=noreply@yourdomain.com
MAILERSEND_FROM_NAME=Your App Name- Sign up at Twilio
- Get your Account SID and Auth Token
- Go to Phone Numbers β Buy a Number
- Choose a US number with SMS capabilities
- Recommended:
+1 845 280 4623(or similar)
- Go to Messaging β Settings β Geo Permissions
- Enable countries you want to send to (e.g., India, US)
- Go to Phone Numbers β Verified Caller IDs
- Add and verify recipient phone numbers
- Required for trial accounts
TWILIO_ACCOUNT_SID=ACxxxxxxxxxxxxxxxxxxxxxxxxxx
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_SMS_NUMBER=+18452804623
TWILIO_SMS_NUMBER_SID=PNxxxxxxxxxxxxxxxxxxxxxxxxxx- US Number: $1.00/month
- SMS to India: $0.0520 per message
- SMS to US: $0.0079 per message
cd backend
node scripts/test-sms.js-
Access Twilio Sandbox:
- Go to Twilio Console β Messaging β Try it out β Send a WhatsApp message
- Join sandbox by sending code to
+1 415 523 8886
-
Configure:
TWILIO_WHATSAPP_NUMBER=whatsapp:+14155238886
-
Test immediately - No verification needed!
β VERIFIED: Direct Delivery to India (+91) & UAE (+971)
The system is now fully optimized for the Focus Engineering Verified Account. This configuration bypasses the 24-hour window restrictions and the sandbox-requirement.
Ensure your backend/.env is set exactly like this for global reach:
WA_TWILIO_ACCOUNT_SID=your_twilio_account_sid
WA_TWILIO_AUTH_TOKEN=your_twilio_auth_token
WA_TWILIO_WHATSAPP_NUMBER=+919486240282
WA_TWILIO_INVITE_TEMPLATE_SID=your_template_sidUnlike standard trial numbers, this verified path uses an approved Content API template (service_update_v1). This template has been manually synced between Meta and Twilio to ensure it delivers even to users who haven't messaged the shop yet.
- Error 63016: This will NOT occur with the current configuration as the template variables are pre-aligned (Single-variable mode
{{1}}). - Delivery Delay: If a message lags, check the Twilio Content Template Builder to ensure the "WhatsApp business initiated" status remains green.
- β Send form invites via email
- β Upload recipient lists (Excel/CSV)
- β Track delivery status
- β Unique invite links per recipient
- β Resend functionality
- β Send form invites via SMS
- β Upload phone number lists (Excel/CSV)
- β International phone support
- β Track delivery status
- β Unique invite links per recipient
- β Send form invites via WhatsApp
- β Upload phone number lists (Excel/CSV)
- β Template-based messaging
- β Track delivery status
- β Sandbox for testing
Excel/CSV Requirements:
Email,Phone
user1@example.com,+919894286683
user2@example.com,+911234567890
user3@example.com,+919876543210Columns:
- Email: Required for email invites, optional for SMS/WhatsApp
- Phone: Required for SMS/WhatsApp, optional for email
- Phone numbers must be in international format (+country code)
-
Update environment variables in
.env:NODE_ENV=production FRONTEND_URL=https://prismatic-puffpuff-3f5237.netlify.app MONGODB_URI=mongodb+srv://user:pass@cluster.mongodb.net/forms-db
-
Build and deploy:
docker-compose -f docker-compose.prod.yml up -d
-
Configure reverse proxy (Nginx/Caddy) for SSL
Development (docker-compose.yml):
- Hot reload enabled
- Development ports exposed
- Volume mounts for live code changes
Production (docker-compose.prod.yml):
- Optimized builds
- No development dependencies
- Health checks enabled
- Restart policies configured
POST /api/auth/login- User loginPOST /api/auth/register- User registrationGET /api/auth/profile- Get user profilePUT /api/auth/change-password- Change password
GET /api/forms- List all formsPOST /api/forms- Create new formGET /api/forms/:id- Get form detailsPUT /api/forms/:id- Update formDELETE /api/forms/:id- Delete formPOST /api/forms/:id/duplicate- Duplicate form
POST /api/forms/:formId/invites/upload- Upload invite listPOST /api/forms/:formId/invites/send- Send email invitesPOST /api/forms/:formId/invites/sms/send- Send SMS invitesPOST /api/forms/:formId/invites/whatsapp/send- Send WhatsApp invitesGET /api/forms/:formId/invites/stats- Get invite statisticsGET /api/forms/:formId/invites- List all invites
GET /api/responses- List all responsesPOST /api/responses/:formId- Submit form responseGET /api/responses/form/:formId- Get form responsesGET /api/responses/form/:formId/export- Export responses
cd backend
npm testcd frontend_EVS
npm testcd backend_EVS
node scripts/test-sms.jscd backend_EVS
node scripts/test-email.jsIf users see "Failed to load form" or CORS errors in the console:
- Ensure the Render Environment Variable
FRONTEND_URLincludes the full protocol.- β
Correct:
https://forms.focusengineeringapp.com - β Incorrect:
forms.focusengineeringapp.com
- β
Correct:
- Backend re-deploys automatically when environment variables change. Wait for "Deploy Live".
The project uses two different MongoDB Atlas clusters. Ensure your .env matches the correct one for the data you need:
- Render Cluster:
8im0otd.mongodb.net(Used for production data). - Legacy Cluster:
8ia0std.mongodb.net.
On the Render Free Tier, the backend will "spin down" after inactivity.
- The user will see a branded "Retry Connection" screen.
- Wait ~60 seconds for the server to wake up before clicking retry.
- Verify MongoDB is running:
mongod --version - Check connection string in
.env - For Atlas: Whitelist your IP address
- Verify SMTP credentials
- Check app password (Gmail)
- Enable "Less secure app access" if needed
- Check spam folder
- Verify Twilio credentials
- Check phone number format (+country code)
- Verify recipient numbers (trial account)
- Check geographic permissions
- Verify sandbox join code sent
- Check template SID (production)
- Verify phone number format
- Check Twilio console logs
# View logs
docker-compose logs -f backend_EVS
docker-compose logs -f frontend_EVS
# Restart services
docker-compose restart
# Clean rebuild
docker-compose down
docker-compose up -d --buildforms_new/
βββ backend_EVS/
β βββ controllers/ # Request handlers
β βββ models/ # MongoDB schemas
β βββ routes/ # API routes
β βββ services/ # Business logic (email, SMS, WhatsApp)
β βββ middleware/ # Auth, validation
β βββ scripts/ # Utility scripts
β βββ .env # Environment variables
β βββ server.js # Entry point
β
βββ frontend_EVS/
β βββ src/
β β βββ components/ # React components
β β βββ api/ # API client
β β βββ contexts/ # React contexts
β β βββ pages/ # Page components
β β βββ utils/ # Utilities
β βββ vite.config.ts # Vite configuration
β
βββ customer-module_EVS/ # end-user UI
β
βββ docker-compose.yml # Docker development
βββ Dockerfile # Docker image
βββ README.md # This file
- Change default admin passwords
- Set strong
JWT_SECRET - Configure production MongoDB (Atlas)
- Set up SSL certificates
- Configure production email service
- Set up SMS/WhatsApp production numbers
- Configure AWS S3 for file storage
- Set up monitoring and logging
- Configure backup strategy
- Set up CI/CD pipeline
NODE_ENV=production
FRONTEND_URL=https://prismatic-puffpuff-3f5237.netlify.app
MONGODB_URI=mongodb+srv://...
JWT_SECRET=very-long-random-string
# ... other production valuesPlease ensure you follow the project's coding standards and submit pull requests for any new features or bug fixes.
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit pull request
- Wait for code review
This project is proprietary software. All rights reserved.
For issues and questions:
- Check this README first
- Review error logs
- Check Twilio/AWS console for service issues
- Contact system administrator
- β Multi-channel notifications (Email, SMS, WhatsApp)
- β Invite tracking and analytics
- β Docker deployment support
- β AWS S3 file storage
- β Enhanced security
- Initial release
- Basic form builder
- Response collection
- User management
Built with β€οΈ using MERN Stack