Skip to content
/ jobs Public

High-performance job recruitment API built with Go and the Gin framework. Implements Clean Architecture with Role-Based Access Control (RBAC), resume management via Cloudinary, and Redis caching. Designed for scalability with AWS Lambda support.

Notifications You must be signed in to change notification settings

switch247/jobs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Job Application API

A RESTful API for job applications where companies can post jobs and applicants can browse and apply for positions.

Features

  • User Authentication: JWT-based authentication with role-based access control
  • Company Features: Create, update, delete job postings; view applications
  • Applicant Features: Browse jobs, apply with resume upload, track applications
  • File Upload: Resume upload to Cloudinary
  • Pagination: All list endpoints support pagination
  • Search & Filtering: Job search with title, location, and company filters

Tech Stack

  • Backend: Go with Gin framework
  • Database: PostgreSQL with GORM
  • Authentication: JWT tokens
  • File Storage: Cloudinary
  • Cache: Redis
  • Deployment: AWS Lambda support

Setup Instructions

Prerequisites

  • Go 1.23+
  • PostgreSQL database
  • Redis (optional, for caching)
  • Cloudinary account for file uploads

Environment Variables

Create a .env file with the following variables:

# Database
DATABASE_URL=postgresql://username:password@host:port/database?sslmode=require

# JWT
JWT_SECRETE_KEY=your_jwt_secret_key

# Cloudinary
Cloud_api_key=your_cloudinary_api_key
Cloud_api_secret=your_cloudinary_api_secret
Cloud_api_name=your_cloudinary_cloud_name

# Redis (optional)
REDIS_ADDR=localhost:6379
REDIS_PASSWORD=your_redis_password

# Email (for password reset)
Mail_TRAP_API_KEY=your_mailtrap_api_key

# Google OAuth (optional)
GOOGLE_KEY=your_google_client_id
GOOGLE_SECRET=your_google_client_secret
Google_Callback=your_google_callback_url

# AI Integration (optional)
GROQ_API_KEY=your_groq_api_key

Installation

  1. Clone the repository:
git clone <repository-url>
cd job-application-api
  1. Install dependencies:
go mod download
  1. Set up your environment variables in .env file

  2. Run the application:

go run cmd/main.go

The server will start on port 8080 by default.

API Endpoints

Authentication

  • POST /auth/register - User registration (company or applicant)
  • POST /auth/login - User login
  • GET /auth/logout - User logout
  • POST /auth/forget-password - Request password reset
  • POST /auth/forget-password/:token - Reset password

Jobs

  • POST /jobs - Create job (Company only)
  • GET /jobs/:id - Get job details (All authenticated users)
  • PUT /jobs/:id - Update job (Company only, own jobs)
  • DELETE /jobs/:id - Delete job (Company only, own jobs)
  • GET /jobs/company/my-jobs - Get company's jobs (Company only)
  • GET /jobs/browse - Browse jobs with filters (Applicant only)

Applications

  • POST /applications - Apply for job with resume upload (Applicant only)
  • GET /applications/my-applications - Get applicant's applications (Applicant only)
  • GET /applications/job/:jobId - Get job applications (Company only, own jobs)
  • PUT /applications/:id/status - Update application status (Company only)

User Management

  • GET /users - Get all users (Admin only)
  • GET /users/:id - Get user by ID (Admin only)
  • POST /users - Create user (Admin only)
  • PUT /users/:id - Update user (Admin only)
  • DELETE /users/:id - Delete user (Admin only)

Profile

  • GET /me - Get current user profile
  • PATCH /me - Update current user profile
  • DELETE /me - Delete current user profile

Request/Response Format

Base Response Structure

{
  "success": boolean,
  "message": "string",
  "object": object,
  "errors": ["string"] | null
}

Paginated Response Structure

{
  "success": boolean,
  "message": "string",
  "object": [objects],
  "pageNumber": number,
  "pageSize": number,
  "totalSize": number,
  "errors": ["string"] | null
}

User Roles

  • APPLICANT: Can browse jobs, apply for positions, track applications
  • COMPANY: Can create/manage job postings, view applications, update application status
  • ADMIN: Full system access (user management)

Validation Rules

User Registration

  • Name: Required, alphabets only
  • Email: Required, valid email format, unique
  • Password: Required, minimum 8 characters, must contain uppercase, lowercase, number, and special character
  • Role: Required, must be "APPLICANT" or "COMPANY"

Job Creation

  • Title: Required, 1-100 characters
  • Description: Required, 20-2000 characters
  • Location: Optional

Application

  • Resume: Required PDF file
  • Cover Letter: Optional, maximum 200 characters
  • One application per job per applicant

File Upload

Resume files are uploaded to Cloudinary and must be in PDF format. The API returns a secure URL for the uploaded file.

Security Features

  • JWT-based authentication
  • Role-based access control
  • Password hashing with bcrypt
  • Input validation and sanitization
  • CORS protection
  • XSS protection middleware

Database Schema

Users Table

  • ID (UUID, Primary Key)
  • Name (String)
  • Email (String, Unique)
  • Password (String, Hashed)
  • Role (Enum: APPLICANT, COMPANY, ADMIN)
  • CreatedAt, UpdatedAt (Timestamps)

Jobs Table

  • ID (UUID, Primary Key)
  • Title (String)
  • Description (String)
  • Location (String)
  • CreatedBy (UUID, Foreign Key to Users)
  • CreatedAt, UpdatedAt (Timestamps)

Applications Table

  • ID (UUID, Primary Key)
  • ApplicantId (UUID, Foreign Key to Users)
  • JobId (UUID, Foreign Key to Jobs)
  • ResumeLink (String, Cloudinary URL)
  • CoverLetter (String, Optional)
  • Status (Enum: Applied, Reviewed, Interview, Rejected, Hired)
  • AppliedAt (Timestamp)

Testing

The project includes comprehensive unit tests for controllers, use cases, and repositories. Run tests with:

go test ./...

Deployment

The application supports deployment to AWS Lambda. Build and deploy using the provided Dockerfile or deploy directly to Lambda using the AWS CLI.

Technology Choices

  • Go with Gin: High performance, excellent for REST APIs
  • GORM: Powerful ORM with good PostgreSQL support
  • JWT: Stateless authentication, scalable
  • Cloudinary: Reliable file storage with CDN
  • PostgreSQL: Robust relational database with UUID support
  • Redis: Fast caching for session management
  • Clean Architecture: Separation of concerns, testable, maintainable

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request

License

This project is licensed under the MIT License.

About

High-performance job recruitment API built with Go and the Gin framework. Implements Clean Architecture with Role-Based Access Control (RBAC), resume management via Cloudinary, and Redis caching. Designed for scalability with AWS Lambda support.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published