Skip to content

Latest commit

 

History

History
302 lines (231 loc) · 8.11 KB

ReadeMe.md

File metadata and controls

302 lines (231 loc) · 8.11 KB

Header: Find Jobs, About, Post Job, (Sign up & Login will decide) Home page will think of it. Background color of my choice of about 40% (used)

Find Jobs

Has all jobs available Search by keywords category or role (shows all jobs with that keyword) one can filter by location, roles and (Remote, hybrid or on-site) should have apply button Some jobs preview page when the job is clicked should have apply button

application should be sent automatically to the company....

Post Job

The owner should sign up and have some sort of a company account... on the account the owner can click post a Job and a form appears and the owner puts the job description post button below the form or rich text editor which ever The owner can bring down the application or disabled the button after some time or a certain number of applicants are reached. The company can view all the jobs they have posted using there accounts.

Messages

Implement messages where the recruiter can reach for a candidate they interested at....(add on)

HOW I WILL BUILD IT

1. Project Setup

Backend Setup:

Initialize your project:

npm init -y

Install essential packages:

npm install express pg sequelize bcryptjs jsonwebtoken dotenv cors
npm install --save-dev nodemon
  • Express: Backend framework for REST APIs.
  • pg: PostgreSQL client for connecting to your database.
  • Prisma: Modern ORM for managing PostgreSQL database.
  • bcryptjs: For password hashing. jsonwebtoken: For authentication.
  • dotenv: For environment variables. cors: To handle cross-origin requests.

Set up Prisma: Initialize Prisma in your project:

npx prisma init

This creates a .env file and a prisma folder with a schema.prisma file.

2. Configure the Database Connection

Open your .env file and set up your PostgreSQL database connection:

DATABASE_URL="postgresql://username:password@localhost:5432/job_board"

Replace username, password, and job_board with your actual PostgreSQL credentials.

3. Defining the Database Schema with Prisma

Edit your prisma/schema.prisma file to define the tables using Prisma's schema syntax:

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator client {
  provider = "prisma-client-js"
}

model User {
  id       Int     @id @default(autoincrement())
  name     String
  email    String  @unique
  password String
  role     Role
  profile  Profile?
  jobs     Job[]
  messages Message[]

  @@map("users")
}

model Profile {
  id     Int    @id @default(autoincrement())
  bio    String
  skills String[]
  userId Int    @unique
  user   User   @relation(fields: [userId], references: [id])
}

model Company {
  id          Int    @id @default(autoincrement())
  name        String
  description String
  location    String
  contactEmail String
  jobs        Job[]
}

model Job {
  id          Int       @id @default(autoincrement())
  title       String
  description String
  location    String
  type        JobType
  salary      Float?
  category    String
  deadline    DateTime
  companyId   Int
  company     Company   @relation(fields: [companyId], references: [id])
  applications Application[]
}

model Application {
  id          Int       @id @default(autoincrement())
  status      AppStatus @default(APPLIED)
  appliedDate DateTime  @default(now())
  userId      Int
  jobId       Int
  user        User      @relation(fields: [userId], references: [id])
  job         Job       @relation(fields: [jobId], references: [id])
}

model Message {
  id        Int      @id @default(autoincrement())
  senderId  Int
  receiverId Int
  content   String
  timestamp DateTime @default(now())
  sender    User     @relation("SentMessages", fields: [senderId], references: [id])
  receiver  User     @relation("ReceivedMessages", fields: [receiverId], references: [id])
}

enum Role {
  EMPLOYER
  JOB_SEEKER
}

enum JobType {
  REMOTE
  HYBRID
  ONSITE
}

enum AppStatus {
  APPLIED
  INTERVIEW
  HIRED
  REJECTED
}
  • User table stores user information (both employers and job seekers).
  • Company stores details about employers.
  • Job is for job listings.
  • Application tracks job applications.
  • Message handles communication between users.

4. Generate Prisma Client

After defining your schema, generate the Prisma client:

npx prisma generate

Run migrations to apply the schema to your PostgreSQL database:

npx prisma migrate dev --name init

5. API Endpoints Design with Express & Prisma

Authentication Routes

  1. Register a user: /api/auth/register
  2. Login: /api/auth/login
  3. Get user profile: /api/auth/profile

Job Management Routes

  1. Get all job listings: /api/jobs

    • Supports filtering by keywords, location, category, and job type.
  2. Get job details: /api/jobs/:id

  3. Post a job (employers only): /api/jobs

  4. Update job listing: /api/jobs/:id

  5. Delete job listing: /api/jobs/:id

Applications Routes

  1. Apply for a job: /api/applications
  2. View applications (for employers and job seekers): /api/applications

Messaging Routes

  1. Send a message: /api/messages
  2. Get messages: /api/messages/:userId

6. Frontend Structure (React)

Adjust your React app to connect with the new Prisma-powered backend. You can use Axios to make HTTP requests to the backend APIs.

Folder Structure:

src/
├── components/
│   ├── Navbar.js
│   ├── JobList.js
│   ├── JobDetails.js
│   ├── PostJob.js
│   ├── Register.js
│   ├── Login.js
│   └── Profile.js
├── pages/
│   ├── Home.js
│   ├── About.js
│   ├── FindJobs.js
│   ├── Messages.js
│   └── Dashboard.js
├── utils/
│   ├── axiosInstance.js
│   └── auth.js
├── App.js
└── index.js

Key Components:

  • Navbar: Navigation links (Home, Find Jobs, Post Job, About, Sign Up/Login).
  • Home: Introduction, hero section, and call-to-action buttons.
  • FindJobs: Display all job listings with search and filtering functionality.
  • JobDetails: Detailed view of a job listing with an Apply button.
  • PostJob: Form for employers to post a new job.
  • Messages: Messaging interface for employers and job seekers.
  • Profile: User dashboard to manage jobs, applications, and profile settings.

7. Testing the APIs with Postman

  • Use Postman to test your backend endpoints.
  • Start by creating a new user (registration).
  • Test login, job posting, applying for jobs, and sending messages.

8. Deployment

  1. Deploy your PostgreSQL database using services like Supabase or Render.
  2. Deploy your backend server (Express + Prisma) to Railway or Vercel.
  3. Deploy your React frontend to Netlify or Vercel.

Key Features Implementation

  1. Authentication: Create a registration and login system with JWT authentication. Use bcryptjs to hash passwords before storing them in the database.
  2. Job Listings: Employers can post jobs via a form. Jobs are displayed in the FindJobs page, where users can filter by keywords, category, location, and job type (remote, hybrid, on-site). Implement pagination for job listings.
  3. Search & Filtering: Use a combination of frontend filtering (in React) and backend querying (PostgreSQL) to optimize search performance. Optionally, integrate Elasticsearch for more advanced search capabilities if needed.
  4. Job Applications: Job seekers can click the "Apply" button, which automatically sends their profile and resume to the employer. Employers can close job applications or set a limit on the number of applicants.
  5. Notifications & Messaging: Implement notifications for new job matches and application status updates. Add a messaging feature where employers can reach out to job seekers directly.

N/B

  1. Start with the backend:
  • Set up your Express server, PostgreSQL database, and Sequelize models.
  • Build and test your API endpoints using Postman.
  1. Move to the frontend:
  • Create your React components and pages.
  • Implement authentication, job listings, and filtering.
  1. Add advanced features like messaging, notifications, and Elasticsearch integration (if needed).