Skip to content
gvanleePublic

About

Trying to build a web app to store multiple CV's for easy retrieval

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

BetterCV - Resume Management System

WORK IN PROGRESS, USE AT OWN RISK

A Python application for managing and maintaining resume data using SQLite database.

Features

  • Store all resume data in a structured database
  • Web-based forms for easy data entry and editing
  • Manage personal info, work experience, education, skills, projects, and certifications
  • AI-powered CV parsing using Google Gemini, Groq, or local Ollama - automatically extract data from existing CVs (PDF, DOCX, TXT)
  • Multi-consultant support - manage multiple consultant profiles with easy switching
  • Multi-language support (English and Dutch) with easy language switching
  • Import/export consultant data in JSON format
  • Docker support for easy deployment

AI-Powered CV Parsing

The application includes AI-powered features that can automatically parse existing CVs and extract structured information using Google Gemini, Groq, or local Ollama.

Supported File Formats

  • PDF files (.pdf)
  • Microsoft Word documents (.docx, .doc)
  • Plain text files (.txt)

Setup AI Features

  1. Get a Gemini API key from Google AI Studio
  2. Set the environment variable:
    export GEMINI_API_KEY="your-gemini-api-key-here"
  3. Optional: Configure Groq:
    export GROQ_API_KEY="your-groq-api-key-here"
  4. Optional: Configure local Ollama (defaults already work for local install):
    export OLLAMA_ENABLED=true
    export OLLAMA_BASE_URL="http://localhost:11434"
    export OLLAMA_MODEL="orca2"
    export OLLAMA_TIMEOUT_SECONDS=180
  5. In Docker, use host.docker.internal when Ollama runs on the host machine.

How it works

  1. Upload your CV file via the web interface
  2. The AI analyzes the content and extracts:
    • Personal information (name, contact details)
    • Work experience with dates and descriptions
    • Education history
    • Skills categorized by type
    • Projects with technologies used
    • Certifications with issue dates
  3. Review the extracted data before importing
  4. Create a new consultant profile with the structured data

Note: The AI parsing feature is optional. All manual features work without an API key.

Authentication & Security

The application includes OAuth 2.0 authentication with role-based access control to secure your resume data when exposing the application to the internet.

Features

  • OAuth 2.0 Integration: Login with Google or Microsoft accounts
  • Passwordless Email Login: Send one-time sign-in links to existing users
  • Whitelist-based Access: Only pre-approved emails can access the system
  • Role-based Authorization:
    • Admin: Full access to all features, user management, and whitelist control
    • Consultant: Can only edit their own personal resume data
  • Admin Dashboard: Manage users, roles, and whitelist entries

Initial Setup

  1. Configure OAuth Providers

    Copy the environment template:

    cp env.template .env
  2. Set up Google OAuth (Optional)

    a. Go to Google Cloud Console

    b. Create a new project or select existing

    c. Enable Google+ API

    d. Go to "Credentials" → "Create Credentials" → "OAuth 2.0 Client ID"

    e. Set application type to "Web application"

    f. Add authorized redirect URI: http://localhost:5000/auth/google/callback (or your domain)

    g. Copy Client ID and Client Secret to .env:

    GOOGLE_CLIENT_ID=your-client-id-here
    GOOGLE_CLIENT_SECRET=your-client-secret-here
  3. Set up Microsoft OAuth (Optional)

    a. Go to Azure Portal

    b. Navigate to "Azure Active Directory" → "App registrations"

    c. Click "New registration"

    d. Set redirect URI: http://localhost:5000/auth/microsoft/callback (or your domain)

    e. Go to "Certificates & secrets" → Create new client secret

    f. Copy Application (client) ID and client secret to .env:

    MICROSOFT_CLIENT_ID=your-client-id-here
    MICROSOFT_CLIENT_SECRET=your-client-secret-here

    If a provider client ID is not configured, that provider button is hidden from the login screen.

  4. Configure Email Magic-Link Login (Optional)

    Add SMTP settings to .env:

    SMTP_HOST=smtp.yourprovider.com
    SMTP_PORT=587
    SMTP_USERNAME=your-smtp-username
    SMTP_PASSWORD=your-smtp-password
    SMTP_USE_TLS=true
    SMTP_USE_SSL=false
    SMTP_FROM_EMAIL=no-reply@yourdomain.com
    SMTP_FROM_NAME=BetterCV
    EMAIL_LOGIN_TOKEN_TTL_MINUTES=30

    Users can request a one-time login link by email. The login session remains active for 24 hours (or until logout).

  5. Generate Secret Key

    Generate a secure random secret key:

    python -c "import secrets; print(secrets.token_hex(32))"

    Add it to .env:

    SECRET_KEY=your-generated-secret-key-here
  6. Set Base URL

    For production deployment, set your domain:

    BASE_URL=https://yourdomain.com

User Management

  1. Initial Admin Setup

    Before first login, add your email to the whitelist:

    a. Edit database.py and modify the default admin email:

    INSERT OR IGNORE INTO user_whitelist (email, role, notes) 
    VALUES ('your-email@example.com', 'admin', 'Initial admin user')

    b. Initialize/reinitialize the database:

    python init_db.py
  2. Adding More Users

    After logging in as admin:

    • Go to the Admin Dashboard (Admin link in navigation)
    • Use "Whitelist Management" to add approved emails
    • Assign roles (admin or consultant)
    • Users can then log in using OAuth providers
  3. Role Permissions

    • Admin:
      • Access all consultant profiles
      • Edit any resume data
      • Manage users and whitelist
      • Access admin dashboard
    • Consultant:
      • View only their own profile
      • Edit only their personal information
      • Cannot access other consultants' data

Security Best Practices

  • Never commit .env file to version control (already in .gitignore)
  • Use HTTPS in production for secure OAuth callbacks
  • Rotate secrets regularly, especially if exposed
  • Review whitelist periodically to remove inactive users
  • Use strong secret keys (minimum 32 characters)
  • Configure OAuth apps with minimal required scopes
  • Set appropriate redirect URIs in OAuth provider settings (no wildcards)

Docker Deployment with Authentication

Update docker-compose.yml with your environment variables or use .env file:

services:
  bettercv:
    environment:
      - SECRET_KEY=${SECRET_KEY}
      - GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
      - GOOGLE_CLIENT_SECRET=${GOOGLE_CLIENT_SECRET}
      - MICROSOFT_CLIENT_ID=${MICROSOFT_CLIENT_ID}
      - MICROSOFT_CLIENT_SECRET=${MICROSOFT_CLIENT_SECRET}
      - BASE_URL=https://yourdomain.com
    env_file:
      - .env

Then run:

docker-compose up -d

Setup Options

Option 1: Docker (Recommended)

  1. Build and run with Docker Compose:

    docker-compose up -d
  2. For AI features: Set the Gemini API key in your environment:

    export GEMINI_API_KEY="your-gemini-api-key-here"
    docker-compose down
    docker-compose up -d

    Or add it directly to the docker-compose.yml file:

    environment:
      - GEMINI_API_KEY=your-gemini-api-key-here
        - GROQ_API_KEY=your-groq-api-key-here
        - OLLAMA_ENABLED=true
        - OLLAMA_BASE_URL=http://host.docker.internal:11434
        - OLLAMA_MODEL=orca2
  3. Open your browser to: http://localhost:5000

  4. To stop the application:

    docker-compose down

The database will be persisted in the ./data directory.

Option 2: Manual Setup

  1. Install dependencies:

    pip install -r requirements.txt
  2. Install native libraries for WeasyPrint (required for PDF export):

    • Linux (Debian/Ubuntu):
      sudo apt-get update
      sudo apt-get install -y libcairo2 libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf-2.0-0 libffi-dev shared-mime-info
    • Windows/macOS: See the official WeasyPrint installation guide for required system libraries.
  3. For AI features: Set one or more AI provider settings:

    export GEMINI_API_KEY="your-gemini-api-key-here"
    export GROQ_API_KEY="your-groq-api-key-here"
    export OLLAMA_ENABLED=true
    export OLLAMA_BASE_URL="http://localhost:11434"
    export OLLAMA_MODEL="orca2"
  4. Initialize the database:

    python init_db.py
  5. Run the application:

    python app.py
  6. Open your browser to: http://localhost:5000

PDF export note: BetterCV uses WeasyPrint for PDF generation.

Docker Commands

Build the image:

docker build -t bettercv .

Run the container:

# Basic run (without authentication)
docker run -d -p 5000:5000 -v $(pwd)/data:/app/data --name bettercv bettercv

# With AI features (include Gemini API key)
docker run -d -p 5000:5000 -v $(pwd)/data:/app/data \
  -e GEMINI_API_KEY="your-api-key-here" \
  --name bettercv bettercv

# With authentication (include OAuth credentials)
docker run -d -p 5000:5000 -v $(pwd)/data:/app/data \
  -e SECRET_KEY="your-secret-key-here" \
  -e GOOGLE_CLIENT_ID="your-google-client-id" \
  -e GOOGLE_CLIENT_SECRET="your-google-client-secret" \
  -e MICROSOFT_CLIENT_ID="your-microsoft-client-id" \
  -e MICROSOFT_CLIENT_SECRET="your-microsoft-client-secret" \
  -e BASE_URL="http://localhost:5000" \
  --name bettercv bettercv

# Full setup with all features
docker run -d -p 5000:5000 -v $(pwd)/data:/app/data \
  -e SECRET_KEY="your-secret-key-here" \
  -e GOOGLE_CLIENT_ID="your-google-client-id" \
  -e GOOGLE_CLIENT_SECRET="your-google-client-secret" \
  -e MICROSOFT_CLIENT_ID="your-microsoft-client-id" \
  -e MICROSOFT_CLIENT_SECRET="your-microsoft-client-secret" \
  -e GEMINI_API_KEY="your-gemini-api-key" \
  -e BASE_URL="http://localhost:5000" \
  --name bettercv bettercv

Or use docker-compose (recommended):

# Make sure you have .env file configured first
docker-compose up -d

View logs:

docker logs bettercv
# or with docker-compose:
docker-compose logs -f

Stop the container:

docker stop bettercv
# or with docker-compose:
docker-compose down

About

Trying to build a web app to store multiple CV's for easy retrieval

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages