Skip to content

UGilfoyle/salary-calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

165 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ’ฐ Salary Calculator & Resume ATS Checker

A modern, Gen Z-friendly web application for calculating in-hand salary according to Indian tax laws and checking resume compatibility with Applicant Tracking Systems (ATS). Built with React/Vite frontend and NestJS backend.

โœจ Features

๐Ÿ’ต Salary Calculator

  • ๐Ÿงฎ Calculate in-hand salary based on CTC and city
  • ๐Ÿ“ Support for major Indian cities with accurate tax calculations
  • ๐Ÿ“Š Detailed salary breakdown (Basic, HRA, EPF, ESI, Professional Tax, Income Tax)
  • ๐Ÿ“ˆ Variable pay and insurance support
  • ๐Ÿ’พ Save calculation history in database
  • ๐Ÿ“œ User-specific calculation history with easy access

๐Ÿ“„ Resume ATS Checker

  • ๐Ÿ” Analyze resume compatibility with ATS systems
  • ๐Ÿ“ Support for PDF and DOCX file formats (up to 2MB)
  • ๐ŸŽฏ ATS score calculation (0-100)
  • โœ… Keyword matching analysis
  • ๐Ÿ’ช Strengths identification
  • โš ๏ธ Areas for improvement detection
  • ๐Ÿ’ก Actionable suggestions for optimization
  • โฑ๏ธ Rate limiting: 3 checks per user, resets every 12 hours

๐Ÿ” Authentication & User Management

  • ๐Ÿ”‘ GitHub OAuth integration
  • ๐Ÿ“ง Email/Password authentication
  • ๐Ÿ‘ค User profile management
  • ๐Ÿ”’ Secure JWT-based authentication
  • ๐Ÿ’พ User-specific data storage

๐Ÿ› ๏ธ Tech Stack

Frontend

  • React 19
  • TypeScript
  • Vite
  • Lucide React (Icons)
  • Axios

Backend

  • NestJS
  • TypeScript
  • PostgreSQL
  • TypeORM
  • JWT Authentication
  • Passport.js (GitHub OAuth)
  • bcryptjs (Password hashing)
  • Multer (File uploads)
  • pdf-parse (PDF parsing)
  • mammoth (DOCX parsing)

๐Ÿš€ Getting Started

Prerequisites

  • Node.js (v20.13.1 or higher)
  • PostgreSQL (v12 or higher) or Neon account
  • npm or pnpm
  • GitHub account (for OAuth, optional)

Installation

  1. Clone the repository
git clone https://github.com/akashkaintura/salary-calculator.git
cd salary-calculator
  1. Set up the Backend
cd backend
npm install

# Create a .env file
cp .env.example .env

# Edit .env with your configuration
# See Environment Variables section below
  1. Set up Database

Option A: Using Neon (Recommended)

  • Go to neon.tech and create a project
  • Copy your DATABASE_URL connection string
  • Add it to backend/.env

Option B: Local PostgreSQL

createdb salary_calculator
# Or using psql
psql -U postgres
CREATE DATABASE salary_calculator;
\q
  1. Seed the Database (Optional)
cd backend
npm run seed
  1. Start the Backend
cd backend
npm run start:dev

The backend will run on http://localhost:3000

  1. Set up the Frontend
cd frontend
npm install

# Create a .env file
echo "VITE_API_URL=http://localhost:3000" > .env
  1. Start the Frontend
cd frontend
npm run dev

The frontend will run on http://localhost:5173

๐Ÿ“ Environment Variables

Backend (.env)

# Database Configuration
DATABASE_URL=postgresql://user:password@host:port/database?sslmode=require&channel_binding=require

# OR Use individual parameters (for local development)
# DB_HOST=localhost
# DB_PORT=5432
# DB_USERNAME=postgres
# DB_PASSWORD=your_password
# DB_NAME=salary_calculator

# Server Configuration
PORT=3000
NODE_ENV=development

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

# GitHub OAuth (Get from https://github.com/settings/developers)
GITHUB_CLIENT_ID=your_github_client_id_here
GITHUB_CLIENT_SECRET=your_github_client_secret_here
GITHUB_CALLBACK_URL=http://localhost:3000/api/auth/github/callback

       # JWT Secret (Generate: openssl rand -base64 32)
       JWT_SECRET=your-super-secret-jwt-key-change-this-in-production

       # UPI Payment Configuration
       UPI_ID=your-upi-id@paytm  # Your UPI ID (e.g., yourname@paytm, yourname@ybl, etc.)
       MERCHANT_NAME=SalaryCalc   # Your business/merchant name
       PAYMENT_SECRET=your-payment-secret-key  # Secret key for payment verification (optional, auto-generated if not provided)
       ```

### Frontend (.env)

```env
VITE_API_URL=http://localhost:3000

๐Ÿ” Authentication Setup

GitHub OAuth Setup

  1. Create GitHub OAuth App

    • Go to GitHub Developer Settings
    • Click "New OAuth App"
    • Fill in:
      • Application name: Salary Calculator
      • Homepage URL: Your frontend URL
      • Authorization callback URL: Your backend URL + /api/auth/github/callback
    • Click "Register application"
  2. Get Credentials

    • Copy Client ID
    • Generate and copy Client Secret
    • Add both to backend/.env

Email/Password Authentication

  • Users can register with email and password
  • No additional setup required
  • Passwords are securely hashed with bcrypt

๐Ÿงฎ Salary Calculation Logic

The calculator uses the following structure:

  • Basic Salary: 50% of Fixed CTC
  • HRA: 40% of Fixed CTC
  • Special Allowance: 10% of Fixed CTC
  • Fixed CTC: Total CTC - Variable Pay - Insurance
  • EPF: 12% of Basic Salary (employee contribution)
  • ESI: 0.75% of Gross Salary (if salary < โ‚น21,000)
  • Professional Tax: Varies by state/city
  • Income Tax: Based on new tax regime 2024-25

Variable Pay & Insurance

  • Variable Pay: Part of CTC but not included in monthly salary calculations
  • Insurance: Health/Life insurance premiums (part of CTC, not monthly salary)
  • Monthly salary is calculated from Fixed CTC only

๐Ÿ“Š Resume ATS Checker Logic

The ATS checker analyzes resumes based on:

  • Keyword Matching: Checks for 50+ common ATS keywords
  • Resume Length: Optimal length analysis (300-1000 words)
  • Section Detection: Verifies presence of contact, experience, education, and skills sections
  • Action Verbs: Identifies use of action verbs
  • Score Calculation: Combines keyword density (60%) and length optimization (40%)

Rate Limiting

  • 3 checks per user per 12-hour window
  • Automatic reset after 12 hours from first check
  • Usage tracking in database

๐ŸŽฏ API Endpoints

Authentication

  • POST /api/auth/register - Register with email/password
  • POST /api/auth/login - Login with email/password
  • GET /api/auth/github - Initiate GitHub OAuth
  • GET /api/auth/github/callback - GitHub OAuth callback
  • GET /api/auth/me - Get current user profile (requires auth)
  • POST /api/auth/update-profile - Update user profile (requires auth)

Salary Calculation

  • POST /api/salary/calculate - Calculate salary breakdown (requires auth)
  • GET /api/salary/history - Get user's calculation history (requires auth)

Resume ATS Checker

  • POST /api/ats/check - Upload and analyze resume (requires auth, file upload)
  • POST /api/ats/usage - Get remaining checks and reset time (requires auth)

๐Ÿ“ Project Structure

salary-calculator/
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ App.tsx              # Main application component
โ”‚   โ”‚   โ”œโ”€โ”€ App.css              # Styles
โ”‚   โ”‚   โ”œโ”€โ”€ main.tsx             # Entry point
โ”‚   โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Login.tsx        # Login/Signup component
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ AtsChecker.tsx   # ATS Checker component
โ”‚   โ”‚   โ””โ”€โ”€ contexts/
โ”‚   โ”‚       โ””โ”€โ”€ AuthContext.tsx  # Authentication context
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ vite.config.ts
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ main.ts              # Application entry point
โ”‚   โ”‚   โ”œโ”€โ”€ app.module.ts        # Root module
โ”‚   โ”‚   โ”œโ”€โ”€ auth/                # Authentication module
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ auth.controller.ts
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ auth.service.ts
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ strategies/      # GitHub & JWT strategies
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ dto/             # Register & Login DTOs
โ”‚   โ”‚   โ”œโ”€โ”€ user/                # User module
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ entities/
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ user.entity.ts
โ”‚   โ”‚   โ”œโ”€โ”€ salary/              # Salary calculation module
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ salary.controller.ts
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ salary.service.ts
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ dto/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ entities/
โ”‚   โ”‚   โ””โ”€โ”€ ats/                 # ATS checker module
โ”‚   โ”‚       โ”œโ”€โ”€ ats.controller.ts
โ”‚   โ”‚       โ”œโ”€โ”€ ats.service.ts
โ”‚   โ”‚       โ””โ”€โ”€ entities/
โ”‚   โ”‚           โ””โ”€โ”€ ats-usage.entity.ts
โ”‚   โ”œโ”€โ”€ package.json
โ”‚   โ””โ”€โ”€ tsconfig.json
โ””โ”€โ”€ README.md

๐Ÿ› Troubleshooting

Backend not connecting to database

  • Verify DATABASE_URL is correct
  • Check that database is active (not paused)
  • Ensure SSL is enabled if using cloud database

CORS errors

  • Ensure FRONTEND_URL in backend matches your frontend URL exactly
  • Check that frontend is using the correct VITE_API_URL

Authentication not working

  • Verify GitHub OAuth credentials are correct
  • Check that callback URL matches exactly
  • Ensure JWT_SECRET is set

File upload issues

  • Verify file is PDF or DOCX format
  • Check file size is under 2MB
  • Ensure user has remaining checks available

Build failures

  • Check Node.js version (should be 20+)
  • Verify all dependencies are in package.json
  • Check build logs for specific errors

๐Ÿ“„ License

ISC

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Releases

No releases published

Packages

 
 
 

Contributors

Languages