Before setting up JobOS for development, ensure you have the following installed:
- Node.js (v18.0 or higher)
- Python (v3.11 or higher)
- Docker and Docker Compose
- Git
- Redis (for local development without Docker)
git clone https://github.com/mpat247/JobOS.git
cd JobOSCreate environment files for both services:
cp .env.example .envConfigure the following variables:
# Supabase Configuration
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
# Database
DATABASE_URL=postgresql://username:password@localhost:5432/jobos
# Redis
REDIS_URL=redis://localhost:6379
# Ollama (Local LLM)
OLLAMA_BASE_URL=http://localhost:11434
# Environment
NODE_ENV=development
DEBUG=trueNEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
NEXT_PUBLIC_API_URL=http://localhost:8000DEBUG=True
SECRET_KEY=your_django_secret_key
DATABASE_URL=postgresql://username:password@localhost:5432/jobos
REDIS_URL=redis://localhost:6379
SUPABASE_URL=your_supabase_url
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
OLLAMA_BASE_URL=http://localhost:11434- Go to Supabase and create a new project
- Note your project URL and anon key from the project settings
- Create a service role key from the project API settings
Run the following SQL in your Supabase SQL editor:
-- Enable UUID extension
CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
-- Create roles table
CREATE TABLE roles (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY,
name VARCHAR(50) UNIQUE NOT NULL,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Insert default roles
INSERT INTO roles (name) VALUES ('user'), ('admin');
-- Create profiles table
CREATE TABLE profiles (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY,
user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE,
full_name TEXT,
email TEXT,
role_id UUID REFERENCES roles(id) DEFAULT (SELECT id FROM roles WHERE name = 'user'),
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Create companies table
CREATE TABLE companies (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY,
name TEXT NOT NULL,
website TEXT,
career_page TEXT,
country TEXT,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Create jobs table
CREATE TABLE jobs (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY,
company_id UUID REFERENCES companies(id) ON DELETE CASCADE,
title TEXT NOT NULL,
location TEXT,
description TEXT,
extracted_fields JSONB DEFAULT '{}',
posted_date DATE,
is_active BOOLEAN DEFAULT true,
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
);
-- Create profile trigger
CREATE OR REPLACE FUNCTION public.handle_new_user()
RETURNS TRIGGER AS $$
BEGIN
INSERT INTO public.profiles (user_id, email, full_name)
VALUES (
NEW.id,
NEW.email,
NEW.raw_user_meta_data->>'full_name'
);
RETURN NEW;
END;
$$ LANGUAGE plpgsql SECURITY DEFINER;
CREATE TRIGGER on_auth_user_created
AFTER INSERT ON auth.users
FOR EACH ROW EXECUTE PROCEDURE public.handle_new_user();- Enable Google OAuth in Supabase Auth settings
- Configure redirect URLs:
- Development:
http://localhost:3000/auth/callback - Production:
https://yourdomain.com/auth/callback
- Development:
This method sets up all services with their dependencies:
# Build and start all services
docker-compose up --build
# Run in detached mode
docker-compose up -d
# View logs
docker-compose logs -f
# Stop all services
docker-compose downAccess points:
- Frontend: http://localhost:3000
- Django API: http://localhost:8000
- Redis: http://localhost:6379
For more control during development:
# Using Docker
docker run -d -p 6379:6379 redis:alpine
# Or install locally (macOS)
brew install redis
brew services start redis
# Or install locally (Ubuntu)
sudo apt-get install redis-server
sudo systemctl start rediscd scraper
# Create virtual environment
python -m venv jobos-venv
source jobos-venv/bin/activate # On Windows: jobos-venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run migrations
python manage.py migrate
# Create superuser (optional)
python manage.py createsuperuser
# Start Celery worker (in separate terminal)
celery -A scraperproject worker --loglevel=info
# Start Django server
python manage.py runserver 8000cd app
# Install dependencies
npm install
# Start development server
npm run dev# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh
# Pull required models
ollama pull llama2
ollama pull mistral
# Start Ollama service
ollama serve# Django migrations
cd scraper
python manage.py makemigrations
python manage.py migrate
# Reset database
python manage.py flushcd app
npm run test # Run tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage reportcd scraper
python manage.py test # Run all tests
python manage.py test discovery # Test specific app
pytest --cov=discovery # Coverage with pytestcd app
npm run lint # ESLint
npm run lint:fix # Auto-fix issues
npm run type-check # TypeScript check
npm run format # Prettier formattingcd scraper
black . # Code formatting
flake8 . # Linting
mypy . # Type checkingcd scraper
python manage.py shell
# In Django shell
from discovery.models import Company, Job
Company.objects.create(name="TechCorp", country="Canada", website="https://techcorp.com")Recommended extensions for optimal development experience:
- Python
- Pylance
- ES7+ React/Redux/React-Native snippets
- Tailwind CSS IntelliSense
- Docker
- GitLens
- React Developer Tools
- Redux DevTools
- Supabase Extension
- Supabase Dashboard (built-in)
- TablePlus or DBeaver for advanced database management
- Redis Commander for Redis inspection
# Enable detailed Next.js debugging
DEBUG=* npm run dev
# TypeScript type checking
npm run type-check# Django with detailed logging
DEBUG=True python manage.py runserver
# Celery with debugging
celery -A scraperproject worker --loglevel=debug
# Interactive debugging with pdb
import pdb; pdb.set_trace()# Check service connectivity
curl http://localhost:3000/api/health
curl http://localhost:8000/api/health
# Redis connection
redis-cli pingIf ports are already in use:
# Find process using port
lsof -i :3000
lsof -i :8000
# Kill process
kill -9 <PID># Check Supabase connection
psql "postgresql://username:password@host:port/database"
# Test environment variables
echo $DATABASE_URLcd app
rm -rf node_modules package-lock.json
npm installcd scraper
deactivate
rm -rf jobos-venv
python -m venv jobos-venv
source jobos-venv/bin/activate
pip install -r requirements.txt# Next.js with faster builds
cd app
npm run dev:turbo
# Django with auto-reload disabled for large projects
cd scraper
python manage.py runserver --noreloadMonitor memory usage during development:
# Docker container stats
docker stats
# Python memory profiling
pip install memory-profiler
python -m memory_profiler your_script.pyThis setup provides a complete development environment for JobOS with all necessary tools and configurations.