Overview
Welcome to PMT
A comprehensive project management system built with React 18 (Admin Panel), Angular 21+ (Frontend), and Node.js (Backend). Perfect for managing projects, tasks, teams, and client collaboration.
Project Management
Create and manage multiple projects, track progress, assign team members, and organize tasks efficiently.
Task Management
Create tasks with priorities and due dates, assign to team members, organize by milestones, and collaborate through comments.
Admin Panel (React)
Modern React-based admin with company management, user management, CMS, settings, and analytics dashboard.
Technology Stack
Quick Links
Installation Guide
Step 1: Install Dependencies
cd backend
npm install
cd frontend
npm install
cd admin
npm install
Step 2: Set Up MongoDB
- Install MongoDB from official website
- Start MongoDB service:
Linux/Mac
sudo systemctl start mongod # or mongod - Verify MongoDB is running:
Command
mongosh
Step 3: Configure Environment
Update environment files in each application:
Backend Configuration
Create .env file in backend/ directory:
PORT=4001
NODE_ENV=development
BASE_URL=http://localhost:4001
# Database
DB_URL=mongodb://localhost:27017/pmt
# JWT
JWT_SECRET=your-secret-key-change-in-production
JWT_EXPIRES_IN=24h
JWT_REFRESH_EXPIRES_IN=7d
# Session
SESSION_SECRET=your-session-secret-change-in-production
# CORS
CORS_ORIGIN=*
# Email (Optional - SendGrid)
SENDGRID_API_KEY=
FROM_EMAIL=noreply@pmt.com
FROM_NAME=PMT
# File Upload
MAX_FILE_SIZE=5242880
UPLOAD_PATH=./app/storage
# Rate Limiting
RATE_LIMIT_WINDOW_MS=900000
RATE_LIMIT_MAX=100
# Logging
LOG_LEVEL=info
LOG_DIR=./logs
Admin Panel Configuration (Optional)
Create .env file in admin/ directory:
VITE_API_URL=http://localhost:4001/
If not provided, defaults to http://localhost:4001/
Step 4: Start Development Servers
Backend Server
cd backend
npm start
Runs on http://localhost:4001
Frontend Application
cd frontend
npm start
Runs on http://localhost:4200
Admin Panel (React)
cd admin
npm run dev
Runs on http://localhost:3001
Step 5: Create Admin User
Before logging in, create an admin user:
curl -X POST http://localhost:4001/auth/register/admin \
-H "Content-Type: application/json" \
-d '{
"name": "Admin User",
"email": "admin@pmt.com",
"password": "Admin123!",
"company": "PMT Admin"
}'
Then login at http://localhost:3001/login with your credentials.
Step 6: Seed Sample Data (Optional)
Populate database with test data:
curl -X POST http://localhost:4001/seeder/seed
See Test Credentials section for login details.
Access URLs
- Admin Panel:
http://localhost:3001 - Frontend:
http://localhost:4200 - Backend API:
http://localhost:4001
Configuration Guide
Environment Variables
Configure your application using environment variables or config files.
Backend Environment Variables
| Variable | Description | Default |
|---|---|---|
DB_URL |
MongoDB connection string | mongodb://localhost:27017/pmt |
JWT_SECRET |
Secret key for JWT tokens | your-secret-key-change-in-production |
PORT |
Server port | 4001 |
NODE_ENV |
Environment mode | development |
SENDGRID_API_KEY |
SendGrid API key for emails | - |
GOOGLE_CLIENT_ID |
Google OAuth client ID | - |
GOOGLE_CLIENT_SECRET |
Google OAuth client secret | - |
File Upload Configuration
Configure file upload settings in backend/app/config/config.js:
upload: {
maxFileSize: 5 * 1024 * 1024, // 5MB
allowedMimeTypes: [
'image/jpeg',
'image/png',
'application/pdf',
'application/msword'
]
}
Email Configuration
Set up email notifications using SendGrid:
- Create a SendGrid account
- Generate an API key
- Add to
.env:.envSENDGRID_API_KEY=your-api-key-here FROM_EMAIL=noreply@yourdomain.com FROM_NAME=Job Portal
OAuth Configuration
Configure Google and LinkedIn OAuth from the admin panel under Settings → OAuth.
See ../OAUTH_SETUP_GUIDE.md for detailed OAuth setup instructions.
Features
Project Management Features
Project Creation & Management
Create multiple projects, assign team members, track status, and organize by companies.
Task Management
Create tasks with priorities, due dates, assign to team members, and organize by milestones.
Milestone Tracking
Organize tasks into milestones, track progress, and manage project phases.
Board Management
Create boards for projects, organize tasks visually, and collaborate through board comments.
Real-Time Collaboration
Communicate through task comments, board comments, and real-time messaging system.
Team Management Features
User Roles
Manage three user types: Company Admin (role_id: 1), Staff (role_id: 2), and Clients (role_id: 3).
Company Management
Create and manage companies, assign users to companies, and track company projects.
Staff & Client Management
Add staff members and clients to companies, assign to projects, and manage permissions.
Messaging System
Real-time messaging between team members with unread message tracking.
Dashboard Analytics
Track project counts, task counts, staff counts, and client counts with visual statistics.
Admin Panel Features
Dashboard Analytics
Real-time statistics showing total companies, users, projects, clients, and staff counts.
Company Management
View all companies, see company users and projects, manage company data.
User Management
View users by company, filter by role (Admin/Staff/Client), update user status, and manage user accounts.
CMS Management
Create and manage content pages (About, Contact, Help, Terms, Privacy, Custom) with publish/unpublish functionality.
Settings & Branding
Configure application settings, upload logos/favicons, setup OAuth (Google, LinkedIn), customize color scheme, and manage contact information.
Cache Management
Clear application cache to refresh settings and content updates.
API Reference
http://localhost:4001/ (development) or your production domain
Authentication
Most endpoints require authentication. Include JWT token in headers:
Authorization: Bearer YOUR_JWT_TOKEN
Main Endpoints
Admin APIs
/auth/admin
Admin login
/crud/companies
Get all companies
/settings
Get application settings
/settings
Update settings
/cms/
Get all CMS pages
Frontend APIs
/auth/users
User login
/users
Register new user (creates company)
/projects/count
Count user's projects
/crud/projects/
Create project
/crud/tasks/
Create task
/messages
Get messages
Seeder APIs
/seeder/seed
Seed sample data
/seeder/credentials
Get login credentials
Postman Collection
Import Postman collection for easy API testing:
- Complete Collection:
backend/postman/pmt-complete.postman_collection.json
Includes all endpoints with examples, auto-save tokens, and organized sections for Admin and Frontend APIs.
See API.md for detailed API documentation.
Deployment Guide
Build for Production
Frontend Build
cd frontend
npm run build -- --configuration production
Output: frontend/dist/frontend/
Admin Panel Build (React)
cd admin
npm run build
Output: admin/dist/
Nginx Configuration
Example Nginx configuration for single domain deployment:
server {
listen 80;
server_name your-domain.com www.your-domain.com;
# Frontend Angular SPA at /
root /var/www/job-portal/frontend;
index index.html;
# API -> Node on port 4001
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_pass http://127.0.0.1:4001/;
}
# Admin React SPA at /admin
location /admin/ {
alias /var/www/job-portal/admin/dist/;
try_files $uri $uri/ /admin/index.html;
}
# SPA fallback for frontend
location / {
try_files $uri $uri/ /index.html;
}
}
SSL Certificate
Enable HTTPS with Let's Encrypt:
sudo certbot --nginx -d your-domain.com -d www.your-domain.com
PM2 Process Manager
Run backend with PM2 for production:
npm install -g pm2
cd backend
pm2 start server.js --name job-portal-api
pm2 save
pm2 startup
Troubleshooting
Common Issues
MongoDB Connection Error
Problem: Cannot connect to MongoDB
Solution:
- Verify MongoDB is running:
mongosh - Check connection string in
.envfile - Ensure MongoDB service is started:
sudo systemctl start mongod
Port Already in Use
Problem: Port 4001, 4200, or 3001 is already in use
Solution:
- Find process using port:
lsof -i :4001(or :4200, :3001) - Kill process:
kill -9 PID - Or change port in configuration:
- Backend: Change
PORTinbackend/.env - Admin: Change port in
admin/vite.config.tsor usenpm run dev -- --port 3002 - Frontend: Use
ng serve --port 4300
- Backend: Change
Admin Panel Cannot Connect to Backend
Problem: Admin panel shows connection errors
Solution:
- Verify backend is running on port 4001
- Check
VITE_API_URLinadmin/.envfile - Check browser console for CORS errors
- Verify backend CORS configuration allows
http://localhost:3001
Cannot Login to Admin Panel
Problem: Login fails or credentials don't work
Solution:
- Verify admin user was created (see Step 5 in Installation)
- Check credentials are correct
- Check backend logs for errors
- Verify
JWT_SECRETis set in backend.env - Clear browser localStorage and try again
Module Not Found
Problem: npm module errors
Solution:
- Delete
node_modulesfolder - Delete
package-lock.json - Run
npm installagain
CORS Errors
Problem: CORS policy errors in browser
Solution:
- Check CORS configuration in
backend/app/config/config.js - Ensure frontend URL is in allowed origins
- Verify API URL in frontend environment files
JWT Token Errors
Problem: Authentication token invalid or expired
Solution:
- Clear browser localStorage
- Login again to get new token
- Check JWT_SECRET in backend configuration
Log Files
Check log files for detailed error information:
backend/logs/error.log- Error logsbackend/logs/combined.log- All logs
Test Credentials
Admin123! | User passwords: Demo123!
Admin Panel Accounts
| Name | Password | Type | |
|---|---|---|---|
| Admin User | admin@pmt.com |
Admin123! |
Admin |
| Super Admin | superadmin@pmt.com |
Admin123! |
Admin |
Company Admin Accounts (role_id: 1)
| Name | Company | Password | |
|---|---|---|---|
| Sarah Johnson | TechCorp Solutions | sarah.johnson@techcorp.com |
Demo123! |
| Michael Chen | InnovateAI | michael.chen@innovateai.com |
Demo123! |
| Emily Rodriguez | Design Studio Pro | emily.rodriguez@designstudio.com |
Demo123! |
Staff Accounts (role_id: 2)
| Name | Company | Password | |
|---|---|---|---|
| John Smith | TechCorp Solutions | john.smith@techcorp.com |
Demo123! |
| Jane Doe | TechCorp Solutions | jane.doe@techcorp.com |
Demo123! |
| Robert Brown | InnovateAI | robert.brown@innovateai.com |
Demo123! |
| Lisa Anderson | Design Studio Pro | lisa.anderson@designstudio.com |
Demo123! |
| David Wilson | FinanceHub | david.wilson@financehub.com |
Demo123! |
Client Accounts (role_id: 3)
| Name | Company | Password | |
|---|---|---|---|
| Alex Martinez | TechCorp Solutions | alex.martinez@client.com |
Demo123! |
| Jessica Kim | InnovateAI | jessica.kim@client.com |
Demo123! |
| Ryan Patel | Design Studio Pro | ryan.patel@client.com |
Demo123! |
Seed Sample Data
To populate database with test data:
curl -X POST http://localhost:4001/seeder/seed
Get credentials:
curl http://localhost:4001/seeder/credentials