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

React 18
Angular
Node.js
MongoDB
Express.js
TypeScript
JWT Auth

Quick Links

Installation Guide

Prerequisites: Node.js 18+, MongoDB, npm/yarn

Step 1: Install Dependencies

Backend
cd backend
npm install
Frontend
cd frontend
npm install
Admin Panel (React)
cd admin
npm install

Step 2: Set Up MongoDB

  1. Install MongoDB from official website
  2. Start MongoDB service:
    Linux/Mac
    sudo systemctl start mongod
    # or
    mongod
  3. Verify MongoDB is running:
    Command
    mongosh

Step 3: Configure Environment

Update environment files in each application:

Backend Configuration

Create .env file in backend/ directory:

.env
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:

.env
VITE_API_URL=http://localhost:4001/

If not provided, defaults to http://localhost:4001/

Step 4: Start Development Servers

1

Backend Server

Terminal 1
cd backend
npm start

Runs on http://localhost:4001

2

Frontend Application

Terminal 2
cd frontend
npm start

Runs on http://localhost:4200

3

Admin Panel (React)

Terminal 3
cd admin
npm run dev

Runs on http://localhost:3001

Step 5: Create Admin User

Before logging in, create an admin user:

cURL
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:

API Call
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
Installation Complete! Your Job Portal is now ready to use.

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:

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:

  1. Create a SendGrid account
  2. Generate an API key
  3. Add to .env:
    .env
    SENDGRID_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

Base URL: http://localhost:4001/ (development) or your production domain

Authentication

Most endpoints require authentication. Include JWT token in headers:

Headers
Authorization: Bearer YOUR_JWT_TOKEN

Main Endpoints

Admin APIs

POST
/auth/admin

Admin login

GET
/crud/companies

Get all companies

GET
/settings

Get application settings

PUT
/settings

Update settings

GET
/cms/

Get all CMS pages

Frontend APIs

POST
/auth/users

User login

POST
/users

Register new user (creates company)

GET
/projects/count

Count user's projects

POST
/crud/projects/

Create project

POST
/crud/tasks/

Create task

GET
/messages

Get messages

Seeder APIs

POST
/seeder/seed

Seed sample data

GET
/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

Command
cd frontend
npm run build -- --configuration production

Output: frontend/dist/frontend/

Admin Panel Build (React)

Command
cd admin
npm run build

Output: admin/dist/

Nginx Configuration

Example Nginx configuration for single domain deployment:

nginx.conf
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:

Command
sudo certbot --nginx -d your-domain.com -d www.your-domain.com

PM2 Process Manager

Run backend with PM2 for production:

Install PM2
npm install -g pm2
Start Backend
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 .env file
  • 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 PORT in backend/.env
    • Admin: Change port in admin/vite.config.ts or use npm run dev -- --port 3002
    • Frontend: Use ng serve --port 4300

Admin Panel Cannot Connect to Backend

Problem: Admin panel shows connection errors

Solution:

  • Verify backend is running on port 4001
  • Check VITE_API_URL in admin/.env file
  • 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_SECRET is set in backend .env
  • Clear browser localStorage and try again

Module Not Found

Problem: npm module errors

Solution:

  • Delete node_modules folder
  • Delete package-lock.json
  • Run npm install again

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 logs
  • backend/logs/combined.log - All logs

Test Credentials

Note: Admin passwords: Admin123! | User passwords: Demo123!

Admin Panel Accounts

Name Email Password Type
Admin User admin@pmt.com Admin123! Admin
Super Admin superadmin@pmt.com Admin123! Admin

Company Admin Accounts (role_id: 1)

Name Company Email 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 Email 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 Email 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:

API Call
curl -X POST http://localhost:4001/seeder/seed

Get credentials:

API Call
curl http://localhost:4001/seeder/credentials