Skip to content

DysCreate/JobLink

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Job Posting Platform

A full-stack web application for connecting employers with employees. Employers can post job opportunities, and employees can browse and apply for jobs.

πŸ›  Tech Stack

Backend

  • Java 17 with Javalin (lightweight web framework)
  • Hibernate ORM for database operations
  • MySQL database
  • JWT (JSON Web Tokens) for authentication
  • BCrypt for password hashing
  • Maven for dependency management

Frontend

  • React 18 with functional components and hooks
  • React Router for navigation
  • Axios for API calls
  • CSS for styling

πŸ“ Project Structure

job-platform/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ main/
β”‚   β”‚   β”‚   β”œβ”€β”€ java/com/jobplatform/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ controller/     # API controllers
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ dao/            # Data Access Objects
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ dto/            # Data Transfer Objects
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ model/          # Entity models
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ util/           # Utility classes
β”‚   β”‚   β”‚   β”‚   └── App.java        # Main application
β”‚   β”‚   β”‚   └── resources/
β”‚   β”‚   β”‚       β”œβ”€β”€ hibernate.cfg.xml
β”‚   β”‚   β”‚       └── schema.sql
β”‚   └── pom.xml
└── frontend/
    β”œβ”€β”€ public/
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ components/          # Reusable components
    β”‚   β”œβ”€β”€ context/            # React context
    β”‚   β”œβ”€β”€ pages/              # Page components
    β”‚   β”œβ”€β”€ services/           # API services
    β”‚   β”œβ”€β”€ App.js
    β”‚   └── index.js
    └── package.json

πŸš€ Setup Instructions

Prerequisites

  • Java 17 or higher
  • Maven 3.6+
  • MySQL 8.0+
  • Node.js 16+ and npm

Database Setup

  1. Start your MySQL server

  2. Create the database:

CREATE DATABASE job_platform_db;
  1. Run the schema script located at backend/src/main/resources/schema.sql or let Hibernate create the tables automatically.

  2. Update database credentials in backend/src/main/resources/hibernate.cfg.xml:

<property name="hibernate.connection.username">your_username</property>
<property name="hibernate.connection.password">your_password</property>

Backend Setup

  1. Navigate to the backend directory:
cd backend
  1. Install dependencies and build:
mvn clean install
  1. Run the application:
mvn exec:java -Dexec.mainClass="com.jobplatform.App"

The backend server will start on http://localhost:7070

Frontend Setup

  1. Navigate to the frontend directory:
cd frontend
  1. Install dependencies:
npm install
  1. Start the development server:
npm start

The frontend will start on http://localhost:3000

πŸ“‘ API Documentation

Authentication Endpoints

Register User

POST /api/auth/register
Content-Type: application/json

{
  "name": "John Doe",
  "email": "john@example.com",
  "password": "password123",
  "role": "EMPLOYEE"  // or "EMPLOYER"
}

Response: 201 Created
{
  "token": "jwt-token",
  "userId": 1,
  "name": "John Doe",
  "email": "john@example.com",
  "role": "EMPLOYEE"
}

Login

POST /api/auth/login
Content-Type: application/json

{
  "email": "john@example.com",
  "password": "password123"
}

Response: 200 OK
{
  "token": "jwt-token",
  "userId": 1,
  "name": "John Doe",
  "email": "john@example.com",
  "role": "EMPLOYEE"
}

Job Endpoints

Get All Jobs (Public)

GET /api/jobs

Response: 200 OK
[
  {
    "id": 1,
    "title": "Software Developer",
    "description": "Looking for a skilled developer...",
    "pay": 75000.00,
    "location": "New York, NY",
    "category": "Technology",
    "status": "OPEN",
    "employerId": 2,
    "employerName": "Tech Company",
    "employerEmail": "company@example.com",
    "createdAt": "2025-10-05T10:00:00"
  }
]

Get Job by ID (Public)

GET /api/jobs/{id}

Response: 200 OK
{
  "id": 1,
  "title": "Software Developer",
  ...
}

Create Job (Employer Only, Protected)

POST /api/jobs
Authorization: Bearer {token}
Content-Type: application/json

{
  "title": "Software Developer",
  "description": "Looking for a skilled developer...",
  "pay": 75000.00,
  "location": "New York, NY",
  "category": "Technology"
}

Response: 201 Created
{
  "id": 1,
  "title": "Software Developer",
  ...
}

Assign Job (Employee Only, Protected)

PUT /api/jobs/{id}/assign
Authorization: Bearer {token}

Response: 200 OK
{
  "id": 1,
  "status": "ASSIGNED",
  ...
}

Get User Jobs (Protected)

GET /api/users/{id}/jobs
Authorization: Bearer {token}

Response: 200 OK
[
  // For employers: jobs they posted
  // For employees: jobs they applied to
]

🎯 Features

Employer Features

  • βœ… Register and login as an employer
  • βœ… Post new job opportunities with details
  • βœ… View all posted jobs
  • βœ… Track job status (Open, Assigned, Completed)

Employee Features

  • βœ… Register and login as an employee
  • βœ… Browse all available jobs
  • βœ… View detailed job information
  • βœ… Apply for jobs
  • βœ… View applied jobs in dashboard

Security Features

  • βœ… JWT-based authentication
  • βœ… Password hashing with BCrypt
  • βœ… Protected API routes
  • βœ… Role-based access control

πŸ—ƒ Database Schema

users

  • id (BIGINT, PK, AUTO_INCREMENT)
  • name (VARCHAR(100))
  • email (VARCHAR(100), UNIQUE)
  • password (VARCHAR(255))
  • role (ENUM: 'EMPLOYER', 'EMPLOYEE')
  • created_at (TIMESTAMP)

jobs

  • id (BIGINT, PK, AUTO_INCREMENT)
  • title (VARCHAR(200))
  • description (TEXT)
  • pay (DECIMAL(10,2))
  • location (VARCHAR(200))
  • category (VARCHAR(100))
  • employer_id (BIGINT, FK β†’ users.id)
  • status (ENUM: 'OPEN', 'ASSIGNED', 'COMPLETED')
  • created_at (TIMESTAMP)

applications

  • id (BIGINT, PK, AUTO_INCREMENT)
  • job_id (BIGINT, FK β†’ jobs.id)
  • employee_id (BIGINT, FK β†’ users.id)
  • status (ENUM: 'PENDING', 'ACCEPTED', 'COMPLETED')
  • applied_at (TIMESTAMP)

πŸ”§ Configuration

Backend Configuration

  • Port: 7070 (can be changed in App.java)
  • JWT Secret: Change in JWTUtil.java for production
  • Database: Configure in hibernate.cfg.xml

Frontend Configuration

  • API Base URL: Set in src/services/api.js
  • Port: 3000 (default React port)

πŸ§ͺ Testing the Application

  1. Start both backend and frontend servers
  2. Navigate to http://localhost:3000
  3. Register as an employer and post some jobs
  4. Register as an employee and apply for jobs
  5. Check the dashboards to see posted/applied jobs

πŸ“ Usage Flow

For Employers:

  1. Register with role "EMPLOYER"
  2. Login to your account
  3. Go to Dashboard
  4. Click "Post New Job"
  5. Fill in job details and submit
  6. View your posted jobs in the dashboard

For Employees:

  1. Register with role "EMPLOYEE"
  2. Login to your account
  3. Browse jobs from the Jobs page
  4. Click on a job to view details
  5. Click "Apply Now" to apply
  6. View applied jobs in your dashboard

πŸ” Security Notes

⚠️ Important for Production:

  • Change the JWT secret key in JWTUtil.java
  • Use environment variables for sensitive data
  • Enable HTTPS
  • Implement rate limiting
  • Add input validation and sanitization
  • Use proper error handling
  • Implement refresh tokens
  • Add CSRF protection

πŸ› Troubleshooting

Backend Issues

  • Port already in use: Change the port in App.java
  • Database connection failed: Check MySQL credentials in hibernate.cfg.xml
  • Hibernate errors: Ensure database tables are created

Frontend Issues

  • API calls failing: Check if backend is running on port 7070
  • CORS errors: Ensure CORS is enabled in Javalin configuration
  • Login not working: Check JWT token is being stored in localStorage

πŸ“„ License

This project is open source and available for educational purposes.

πŸ‘¨β€πŸ’» Author

Built as a demonstration of a full-stack Java + React application.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors