Prerequisites
Before you begin, ensure you have the following installed on your system:Install Bun
Install Docker
Docker is required to run the PostgreSQL database.Download and install Docker Desktop for your operating system.Verify installation:
Install Git
Project Structure
Jefftube is organized as a monorepo with three main components:Clone the Repository
Backend Setup (Server)
Start PostgreSQL database
The server uses Docker Compose to run PostgreSQL 16.This will start a PostgreSQL container with:
- User:
jtube - Password:
jtube - Database:
jtube - Port:
5432
Seed the database (optional)
Populate the database with initial video data:
The seed script filters out videos with null titles and NSFW content from
src/data.json and src/video-state.json.Server Environment Variables
The server uses the following environment variables (all optional with defaults):| Variable | Default | Description |
|---|---|---|
PORT | 3001 | Server port |
DATABASE_URL | postgres://jtube:jtube@localhost:5432/jtube | PostgreSQL connection string |
NODE_ENV | (none) | Set to production to disable debug logging |
RECAPTCHA_SECRET_KEY | (none) | Google reCAPTCHA v3 secret key for verification. If not set, reCAPTCHA checks are skipped |
Frontend Setup (Web)
Create environment file
Copy the example environment file:Edit
.env with your configuration:All variables are optional. PostHog and reCAPTCHA are not required for local development.
VITE_API_URL defaults to the production API if not set.Frontend Environment Variables
| Variable | Default | Description | Required |
|---|---|---|---|
VITE_API_URL | https://jefftube-server-758971609529.us-central1.run.app | Backend API URL | No |
VITE_PUBLIC_POSTHOG_KEY | (hardcoded fallback) | PostHog analytics project API key | No |
VITE_PUBLIC_POSTHOG_HOST | https://us.i.posthog.com | PostHog host URL | No |
VITE_RECAPTCHA_SITE_KEY | (hardcoded fallback) | Google reCAPTCHA v3 site key | No |
Scraper Setup (Scrapper)
The scraper extracts video metadata from the Department of Justice Epstein disclosures.Running the Full Stack
To run the complete application:- Frontend: http://localhost:5173
- Backend API: http://localhost:3001
- Database Studio: Run
bun run db:studioin the server directory
Available Scripts
Backend Scripts
| Command | Description |
|---|---|
bun run dev | Start development server with hot reload |
bun run start | Start production server |
bun run db:start | Start PostgreSQL with Docker |
bun run db:stop | Stop PostgreSQL container |
bun run db:generate | Generate migration files |
bun run db:migrate | Run migrations |
bun run db:push | Push schema changes to database |
bun run db:studio | Open Drizzle Studio (database GUI) |
bun run db:seed | Seed database with video data |
Frontend Scripts
| Command | Description |
|---|---|
bun run dev | Start Vite dev server |
bun run build | Build for production |
bun run preview | Preview production build |
bun run lint | Run ESLint |
bun run start | Serve production build |
Troubleshooting
Database connection failed
Database connection failed
Problem: Cannot connect to PostgreSQL database.Solutions:
- Ensure Docker is running:
docker ps - Check if the database container is running:
docker ps | grep jtube-postgres - Restart the database:
bun run db:stop && bun run db:start - Verify the
DATABASE_URLenvironment variable matches your setup
Port already in use
Port already in use
Problem: Port 3001 or 5173 is already in use.Solutions:
- Find and kill the process using the port:
- Or change the port:
- Backend: Set
PORTenvironment variable - Frontend: Edit
vite.config.tsto addserver: { port: 5174 }
- Backend: Set
Module not found errors
Module not found errors
Problem: Import errors or missing dependencies.Solutions:
- Clear Bun cache:
rm -rf node_modules && bun install - Ensure you’re using Bun (not npm/yarn):
bun --version - Check that you’re in the correct directory (web/ or server/)
Migrations fail
Migrations fail
Problem: Database migrations fail or schema mismatch.Solutions:
- Reset the database:
- Regenerate migrations:
bun run db:generate
Scraper fails with robot check
Scraper fails with robot check
Problem: Scraper blocked by “I am not a robot” check.Solutions:
- Reduce concurrency:
bun run scraper.ts --concurrency 3 - Run in visible mode to see what’s happening:
bun run scrape:visible - Add delays between requests (edit
STAGGER_DELAY_MSinscraper.ts)
Next Steps
Architecture
Understand the system architecture and how components interact
Database Schema
Learn about the database structure and relationships