Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

42 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

JobSphere ๐ŸŒ

> A full-stack job board platform where employers post jobs, job seekers apply, and admins manage the entire ecosystem.

Platform Backend Frontend Database Auth Testing Status


๐Ÿ“Œ Table of Contents


๐Ÿ“– About the Project

JobSphere is a full-stack job board web application built as a learning project for server-side web development. It simulates a real-world hiring platform where three types of users interact โ€” Job Seekers, Employers, and Admins.

The platform is split into two separate applications that communicate with each other:

  • A Node.js REST API that handles all business logic, authentication, database operations, file uploads, and email notifications.
  • A PHP Frontend that renders all pages and communicates with the API using cURL HTTP requests.

This architecture demonstrates how a decoupled frontend and backend work together in a professional, real-world setting.


โœจ Features

๐Ÿ‘ค Job Seekers

  • Register and manage a personal profile
  • Browse and search job listings with filters (keyword, location, job type, salary)
  • Apply to jobs by uploading a CV (PDF or Word)
  • Write and submit a cover letter with each application
  • Track all submitted applications and their current status
  • Receive email notifications when application status is updated

๐Ÿข Employers

  • Register and create a company profile with logo upload
  • Post, edit, and delete job listings
  • View all applications received for each listing
  • Download applicant CVs
  • Update application statuses (Reviewed, Shortlisted, Interview, Rejected, Offered)
  • Receive email notifications when someone applies

๐Ÿ›ก๏ธ Admins

  • Access a full admin dashboard with platform statistics
  • Approve or reject company registrations
  • Activate or deactivate user accounts
  • Remove inappropriate job listings
  • View all users, companies, jobs, and applications

๐Ÿ”ง Platform

  • JWT-based authentication with role-based access control
  • Secure file uploads for CVs and company logos
  • Email notifications using Nodemailer
  • Search and filter system for job listings
  • Fully decoupled REST API and PHP frontend
  • Comprehensive test coverage with Jest and PHPUnit

๐Ÿ—๏ธ Architecture

Browser
โ”‚
โ–ผ
PHP Frontend  (localhost:8000)
โ”‚  cURL HTTP Requests + JWT Token
โ–ผ
Node.js REST API  (localhost:5000)
โ”‚  Mongoose Queries
โ–ผ
MongoDB Atlas  (Cloud Database)

The PHP frontend never directly connects to the database. Every data request goes through the Node.js API. JWT tokens returned at login are stored in PHP sessions and sent as Authorization: Bearer <token> headers on every authenticated request.


๐Ÿ› ๏ธ Tech Stack

Layer Technology
Frontend PHP 8, HTML5, CSS3, JavaScript
Backend Node.js, Express.js
Database MongoDB (via MongoDB Atlas)
ODM Mongoose
Authentication JWT (JSON Web Tokens)
Password Hashing bcryptjs
File Uploads Multer
Email Nodemailer
API Communication cURL (PHP โ†’ Node.js)
Testing Backend Jest, Supertest, MongoDB Memory Server
Testing Frontend PHPUnit
Dev Tools Nodemon, Postman, Composer

๐Ÿ“ฆ Installed Dependencies

Backend Dependencies (jobsphere-backend/package.json)

Production Dependencies

Package Version Purpose
express ^4.18.2 Web framework for Node.js
mongoose ^7.0.0 MongoDB object modeling (ODM)
bcryptjs ^2.4.3 Password hashing and encryption
jsonwebtoken ^9.0.0 JWT authentication tokens
multer ^1.4.5-lts.1 File upload handling (CVs, logos)
nodemailer ^6.9.0 Email sending service
dotenv ^16.0.3 Environment variable management
cors ^2.8.5 Cross-Origin Resource Sharing
express-validator ^6.15.0 Request validation and sanitization

Development Dependencies

Package Version Purpose
jest ^29.5.0 JavaScript testing framework
supertest ^6.3.3 HTTP assertion library for testing
mongodb-memory-server ^8.12.0 In-memory MongoDB for testing
nodemon ^2.0.22 Auto-restart server on file changes

Install all backend dependencies:

cd jobsphere-backend
npm install

---

## ๐Ÿ“ Project Structure

### Backend โ€” `jobsphere-backend/`

jobsphere-backend/ โ”‚ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ config/ โ”‚ โ”‚ โ””โ”€โ”€ db.js # MongoDB connection โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ models/ โ”‚ โ”‚ โ”œโ”€โ”€ User.js โ”‚ โ”‚ โ”œโ”€โ”€ Company.js โ”‚ โ”‚ โ”œโ”€โ”€ Job.js โ”‚ โ”‚ โ””โ”€โ”€ Application.js โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ routes/ โ”‚ โ”‚ โ”œโ”€โ”€ index.js โ”‚ โ”‚ โ”œโ”€โ”€ auth.routes.js โ”‚ โ”‚ โ”œโ”€โ”€ job.routes.js โ”‚ โ”‚ โ”œโ”€โ”€ company.routes.js โ”‚ โ”‚ โ”œโ”€โ”€ application.routes.js โ”‚ โ”‚ โ””โ”€โ”€ admin.routes.js โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ controllers/ โ”‚ โ”‚ โ”œโ”€โ”€ auth.controller.js โ”‚ โ”‚ โ”œโ”€โ”€ job.controller.js โ”‚ โ”‚ โ”œโ”€โ”€ company.controller.js โ”‚ โ”‚ โ”œโ”€โ”€ application.controller.js โ”‚ โ”‚ โ””โ”€โ”€ admin.controller.js โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ services/ โ”‚ โ”‚ โ”œโ”€โ”€ auth.service.js โ”‚ โ”‚ โ”œโ”€โ”€ job.service.js โ”‚ โ”‚ โ”œโ”€โ”€ email.service.js โ”‚ โ”‚ โ””โ”€โ”€ upload.service.js โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ middleware/ โ”‚ โ”‚ โ”œโ”€โ”€ auth.middleware.js โ”‚ โ”‚ โ”œโ”€โ”€ role.middleware.js โ”‚ โ”‚ โ”œโ”€โ”€ error.middleware.js โ”‚ โ”‚ โ””โ”€โ”€ validate.middleware.js โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ utils/ โ”‚ โ”œโ”€โ”€ response.js โ”‚ โ”œโ”€โ”€ jwt.js โ”‚ โ””โ”€โ”€ asyncHandler.js โ”‚ โ”œโ”€โ”€ tests/ # Test suites โ”‚ โ”œโ”€โ”€ setup.js # Test database configuration โ”‚ โ”œโ”€โ”€ unit/ โ”‚ โ”‚ โ”œโ”€โ”€ models/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ User.test.js โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Job.test.js โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ Company.test.js โ”‚ โ”‚ โ”œโ”€โ”€ services/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ email.service.test.js โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ upload.service.test.js โ”‚ โ”‚ โ””โ”€โ”€ utils/ โ”‚ โ”‚ โ””โ”€โ”€ jwt.test.js โ”‚ โ””โ”€โ”€ integration/ โ”‚ โ”œโ”€โ”€ auth.routes.test.js โ”‚ โ”œโ”€โ”€ job.routes.test.js โ”‚ โ””โ”€โ”€ application.routes.test.js โ”‚ โ”œโ”€โ”€ uploads/ โ”‚ โ”œโ”€โ”€ cvs/ # Uploaded CV storage โ”‚ โ””โ”€โ”€ logos/ # Uploaded company logos โ”‚ โ”œโ”€โ”€ coverage/ # Jest coverage reports โ”œโ”€โ”€ .env โ”œโ”€โ”€ .env.example โ”œโ”€โ”€ .gitignore โ”œโ”€โ”€ app.js โ”œโ”€โ”€ server.js โ”œโ”€โ”€ package.json โ””โ”€โ”€ package-lock.json


### Frontend โ€” `jobsphere-frontend/`

jobsphere-frontend/ โ”‚ โ”œโ”€โ”€ config/ โ”‚ โ””โ”€โ”€ app.php # API base URL, app settings โ”‚ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ helpers/ โ”‚ โ”‚ โ”œโ”€โ”€ api.helper.php # cURL wrapper for API calls โ”‚ โ”‚ โ”œโ”€โ”€ auth.helper.php # Session management โ”‚ โ”‚ โ””โ”€โ”€ format.helper.php # Date, salary formatting โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ middleware/ โ”‚ โ”‚ โ”œโ”€โ”€ require_auth.php โ”‚ โ”‚ โ”œโ”€โ”€ require_guest.php โ”‚ โ”‚ โ””โ”€โ”€ require_role.php โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ partials/ โ”‚ โ”œโ”€โ”€ header.php โ”‚ โ”œโ”€โ”€ footer.php โ”‚ โ”œโ”€โ”€ navbar.php โ”‚ โ”œโ”€โ”€ job_card.php โ”‚ โ”œโ”€โ”€ alert.php โ”‚ โ””โ”€โ”€ pagination.php โ”‚ โ”œโ”€โ”€ pages/ โ”‚ โ”œโ”€โ”€ auth/ โ”‚ โ”‚ โ”œโ”€โ”€ login.php โ”‚ โ”‚ โ”œโ”€โ”€ register.php โ”‚ โ”‚ โ””โ”€โ”€ logout.php โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ jobs/ โ”‚ โ”‚ โ”œโ”€โ”€ index.php โ”‚ โ”‚ โ”œโ”€โ”€ view.php โ”‚ โ”‚ โ””โ”€โ”€ create.php โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ companies/ โ”‚ โ”‚ โ”œโ”€โ”€ view.php โ”‚ โ”‚ โ””โ”€โ”€ edit.php โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ dashboard/ โ”‚ โ”‚ โ”œโ”€โ”€ jobseeker/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ index.php โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ applications.php โ”‚ โ”‚ โ””โ”€โ”€ employer/ โ”‚ โ”‚ โ”œโ”€โ”€ index.php โ”‚ โ”‚ โ”œโ”€โ”€ listings.php โ”‚ โ”‚ โ””โ”€โ”€ applicants.php โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ admin/ โ”‚ โ”œโ”€โ”€ index.php โ”‚ โ”œโ”€โ”€ users.php โ”‚ โ”œโ”€โ”€ companies.php โ”‚ โ””โ”€โ”€ jobs.php โ”‚ โ”œโ”€โ”€ tests/ # PHPUnit test suites โ”‚ โ”œโ”€โ”€ unit/ โ”‚ โ”‚ โ””โ”€โ”€ helpers/ โ”‚ โ”‚ โ”œโ”€โ”€ api.helper.test.php โ”‚ โ”‚ โ””โ”€โ”€ auth.helper.test.php โ”‚ โ””โ”€โ”€ integration/ โ”‚ โ””โ”€โ”€ pages/ โ”‚ โ””โ”€โ”€ auth.test.php โ”‚ โ”œโ”€โ”€ assets/ โ”‚ โ”œโ”€โ”€ css/ โ”‚ โ”œโ”€โ”€ js/ โ”‚ โ””โ”€โ”€ images/ โ”‚ โ”œโ”€โ”€ vendor/ # Composer dependencies โ”œโ”€โ”€ phpunit.xml # PHPUnit configuration โ”œโ”€โ”€ .phpunit.result.cache # PHPUnit test cache โ”œโ”€โ”€ .htaccess โ”œโ”€โ”€ .gitignore โ””โ”€โ”€ index.php


---

## ๐Ÿš€ Getting Started

### Prerequisites

Make sure you have the following installed:

- [Node.js](https://nodejs.org/) v18 or higher
- [PHP](https://www.php.net/) v8.0 or higher
- [Composer](https://getcomposer.org/) (optional but recommended)
- A [MongoDB Atlas](https://www.mongodb.com/cloud/atlas) free account
- [Postman](https://www.postman.com/) (for API testing)

---

### 1. Clone the Repository

```bash
git clone https://github.com/your-username/jobsphere.git
cd jobsphere

2. Set Up the Backend (Node.js API)

cd jobsphere-api
npm install

Create your .env file by copying the example:

cp .env.example .env

Fill in your environment variables (see Environment Variables section below).

Start the development server:

npm run dev

The API will run at http://localhost:5000


3. Set Up the Frontend (PHP)

cd jobsphere-frontend

Open config/app.php and make sure the API URL points to your running Node.js server:

define('API_BASE_URL', 'http://localhost:5000/api');

Start the PHP development server:

php -S localhost:8000

The frontend will run at http://localhost:8000


4. Set Up Admin Account

After registering a user, go to your MongoDB Atlas dashboard, find that user in the users collection, and manually change their role field from "jobseeker" to "admin". This user can now access the admin panel at /pages/admin/index.php.


๐Ÿ”‘ Environment Variables

Create a .env file inside jobsphere-api/ with the following:

# Server
PORT=5000

# MongoDB
MONGO_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/jobsphere

# JWT
JWT_SECRET=your_strong_secret_key_here
JWT_EXPIRES_IN=7d

# Email (Gmail SMTP)
EMAIL_USER=your_email@gmail.com
EMAIL_PASS=your_gmail_app_password

# Frontend URL (for CORS)
FRONTEND_URL=http://localhost:8000

Note: For Gmail, you need to generate an App Password from your Google account security settings. Do not use your regular Gmail password.


๐Ÿ“ก API Endpoints

Auth

Method Endpoint Access Description
POST /api/auth/register Public Register a new user
POST /api/auth/login Public Login and receive JWT
GET /api/auth/me Private Get logged in user

Jobs

Method Endpoint Access Description
GET /api/jobs Public Get all active jobs (supports filters)
GET /api/jobs/:id Public Get single job
POST /api/jobs Employer Create a job listing
PUT /api/jobs/:id Employer Update own job listing
DELETE /api/jobs/:id Employer Delete own job listing
GET /api/jobs/my-listings Employer Get employer's own listings

Companies

Method Endpoint Access Description
POST /api/companies Employer Create company profile
GET /api/companies/:id Public View company profile
PUT /api/companies/:id Employer Update company profile

Applications

Method Endpoint Access Description
POST /api/applications/:jobId Job Seeker Apply to a job (CV upload)
GET /api/applications/my-apps Job Seeker View my applications
GET /api/applications/job/:jobId Employer View applicants for a job
PUT /api/applications/:id/status Employer Update application status

Admin

Method Endpoint Access Description
GET /api/admin/stats Admin Platform statistics
GET /api/admin/users Admin List all users
PUT /api/admin/users/:id/status Admin Activate/deactivate user
GET /api/admin/companies/pending Admin Pending company approvals
PUT /api/admin/companies/:id/approve Admin Approve or reject company
DELETE /api/admin/jobs/:id Admin Remove any job listing

๐Ÿ‘ฅ User Roles

Role Description
jobseeker Can browse jobs, apply, track applications
employer Can create company, post jobs, manage applicants
admin Full platform control, set manually in database

๐Ÿ“ธ Screenshots

Screenshots will be added as the project develops.


๐Ÿ—บ๏ธ Roadmap

โœ… Core Features (Phase 1โ€“6)

  • Project setup and folder structure
  • JWT Authentication with role-based access
  • Company profile creation and logo upload
  • Job listings CRUD with search and filter
  • Job applications with CV upload
  • Email notifications (Nodemailer)
  • Admin panel and dashboard

๐Ÿ”ฎ Planned Expansions

  • Saved jobs and job alerts (cron jobs)
  • Company reviews by applicants
  • Application status pipeline (Kanban-style)
  • Interview scheduling system
  • Employer subscription plans with Stripe payments
  • Resume/CV builder (PDF generation with PDFKit)
  • Employer analytics dashboard
  • REST API refactor with React frontend
  • Real-time notifications with Socket.io

๐Ÿค Contributing

This is a personal learning project but contributions, suggestions, and feedback are welcome.

  1. Fork the repository
  2. Create a new branch (git checkout -b feature/your-feature-name)
  3. Commit your changes (git commit -m 'Add some feature')
  4. Push to the branch (git push origin feature/your-feature-name)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.


๐Ÿ‘จโ€๐Ÿ’ป Author

Your Name


Built with โค๏ธ as a university server-side web development project.

About

A full stack job board platform where employers post jobs, job seekers apply, and admins manage the entire ecosystem.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages