Skip to main content

Installation Guide

This comprehensive guide covers everything you need to set up Film Fanatic with all features enabled, including authentication and cloud synchronization.

Prerequisites

Required Software

1

Node.js 20+

Film Fanatic requires Node.js version 20 or higher.Download: nodejs.orgVerify installation:
node --version
# Should output v20.0.0 or higher
2

pnpm Package Manager

Film Fanatic uses pnpm for dependency management.Install pnpm:
npm install -g pnpm
Verify installation:
pnpm --version
pnpm is faster and more disk-efficient than npm or yarn, making it ideal for large projects.
3

Git

Required for cloning the repository.Download: git-scm.comVerify installation:
git --version

Required API Keys and Accounts

The Movie Database (TMDB) provides all movie and TV show data.Setup Steps:
  1. Create a free account at themoviedb.org
  2. Navigate to Settings → API
  3. Request an API key (select “Developer” for non-commercial use)
  4. Copy the API Read Access Token (v4 auth, not the v3 API Key)
The access token is a long Bearer token that starts with eyJ. This is different from the shorter v3 API key.
Convex powers the real-time backend and cloud sync.Setup Steps:
  1. Sign up at convex.dev
  2. Create a new project
  3. Run npx convex dev in your project to link it
  4. Copy the deployment URL and deploy key from the dashboard
Without Convex, the app works in local-only mode using localStorage. Convex is needed for:
  • User authentication sync
  • Cross-device watchlist synchronization
  • Real-time updates
Clerk provides secure authentication and user management.Setup Steps:
  1. Sign up at clerk.com
  2. Create a new application
  3. Choose your authentication methods (Email, Google, etc.)
  4. Copy the publishable key and secret key from the dashboard
  5. Configure the Clerk issuer URL in Convex settings
Clerk and Convex must be configured together for authentication to work. The Clerk issuer URL must match your Convex domain.

Installation Process

Step 1: Clone the Repository

Clone Film Fanatic from the official GitHub repository:
git clone https://github.com/Swastikdan/Film-Fanatic.git
cd film-fanatic

Step 2: Install Dependencies

Install all required npm packages:
pnpm install
This installs:
  • Framework: TanStack Start, React 19, Nitro
  • Backend: Convex client and React Query integration
  • Auth: Clerk React SDK
  • UI: Tailwind CSS 4.0, Radix UI, shadcn/ui components
  • Dev tools: Biome, TypeScript, Vite
The first installation may take 2-3 minutes depending on your internet connection.

Step 3: Environment Configuration

Create a .env.local file in the project root with your API keys and configuration:
# TMDB API Configuration
VITE_TMDB_ACCESS_TOKEN=eyJhbGciOiJIUzI1NiJ9.your_actual_token_here
VITE_TMDB_API_URL=https://api.themoviedb.org/3

# Clerk Authentication
VITE_CLERK_PUBLISHABLE_KEY=pk_test_your_key_here
CLERK_SECRET_KEY=sk_test_your_secret_here

# Convex Backend
VITE_CONVEX_URL=https://your-project.convex.cloud
CONVEX_DEPLOY_KEY=prod:your-project|your_deploy_key_here

# Convex + Clerk Integration
CONVEX_CLERK_ISSUER_URL=https://your-clerk-domain.clerk.accounts.dev
Never commit .env.local to version control. It’s already included in .gitignore.

Step 4: Set Up Convex (Optional)

If you’re using Convex for backend functionality:
# Initialize Convex in your project
npx convex dev
This will:
  1. Prompt you to log in to Convex
  2. Link your local project to your Convex deployment
  3. Deploy the schema and functions from the /convex directory
  4. Start watching for changes
The Convex dev server will output your VITE_CONVEX_URL. Copy this to your .env.local file.

Step 5: Configure Clerk + Convex Integration (Optional)

If using both Clerk and Convex:
  1. In Clerk Dashboard:
    • Go to your application settings
    • Copy your issuer URL (usually https://<your-domain>.clerk.accounts.dev)
  2. In .env.local:
    CONVEX_CLERK_ISSUER_URL=https://your-domain.clerk.accounts.dev
    
  3. In Convex Dashboard:
    • Go to Settings → Environment Variables
    • Add CLERK_ISSUER_URL with the same value
The integration is configured in convex/auth.config.ts:
export default {
  providers: [
    {
      domain: process.env.CONVEX_CLERK_ISSUER_URL,
      applicationID: "convex",
    },
  ],
};

Step 6: Start Development

Launch the full development environment:
pnpm dev
This runs two processes in parallel:
  • Vite dev server on http://localhost:3000 (frontend)
  • Convex dev (backend functions with hot reload)
You should see output similar to:
> npm-run-all --parallel dev:vite dev:convex

VITE v7.1.7  ready in 1203 ms
  Local:   http://localhost:3000/
  Network: http://192.168.1.100:3000/

Convex functions deployed

Project Structure Overview

Understanding the codebase structure:
film-fanatic/
├── convex/                   # Backend (Convex)
│   ├── _generated/           # Auto-generated Convex code
│   ├── auth.config.ts        # Clerk authentication config
│   ├── schema.ts             # Database schema
│   ├── users.ts              # User management functions
│   └── watchlist.ts          # Watchlist mutations/queries

├── src/                      # Frontend (React)
│   ├── components/           # UI components
│   │   ├── ui/              # shadcn/ui base components
│   │   └── ...              # Feature-specific components
│   ├── hooks/               # Custom React hooks
│   ├── lib/                 # Utilities and clients
│   ├── routes/              # TanStack Router pages
│   ├── constants.ts         # App constants
│   ├── types.d.ts           # TypeScript type definitions
│   └── styles.css           # Global Tailwind styles

├── public/                   # Static assets
├── .env.local               # Environment variables (create this)
├── package.json             # Dependencies and scripts
├── tsconfig.json            # TypeScript configuration
├── vite.config.ts           # Vite build configuration
└── biome.json              # Biome linter/formatter config

Database Schema

Film Fanatic uses Convex with the following schema (defined in convex/schema.ts):

Users Table

users: {
  tokenIdentifier: string,
  name?: string,
  image?: string,
  email?: string
}

Watch Items Table

watch_items: {
  userId: Id<"users">,
  tmdbId: number,
  mediaType: "movie" | "tv",
  inWatchlist?: boolean,
  progressStatus?: "want-to-watch" | "watching" | "finished",
  reaction?: "loved" | "liked" | "mixed" | "not-for-me",
  progress?: number,  // 0-100
  title?: string,
  image?: string,
  rating?: number,
  release_date?: string,
  overview?: string,
  updatedAt: number
}

Episode Progress Table

episode_progress: {
  userId: Id<"users">,
  tmdbId: number,
  season: number,
  episode: number,
  isWatched: boolean,
  updatedAt: number
}

Build for Production

When you’re ready to deploy:
# Type check and build
pnpm build
This will:
  1. Run TypeScript type checking
  2. Build the Vite bundle with optimizations:
    • Terser minification
    • Code splitting (vendor, tanstack, convex, clerk chunks)
    • Tree shaking
    • Console removal in production
The build output is in .output/ directory.

Troubleshooting

Issue: npx convex dev fails with authentication errorsSolutions:
  1. Ensure you’re logged in: npx convex login
  2. Check your Convex dashboard has the correct project
  3. Verify CONVEX_DEPLOY_KEY in .env.local matches your project
  4. Try npx convex dev --once to force a single deployment
Issue: Sign in/up buttons don’t work or return errorsSolutions:
  1. Verify both VITE_CLERK_PUBLISHABLE_KEY and CLERK_SECRET_KEY are set
  2. Check that your Clerk application is in development mode
  3. Ensure CONVEX_CLERK_ISSUER_URL matches your Clerk domain exactly
  4. Restart the dev server after changing environment variables
  5. Check Clerk dashboard → Sessions → Settings for allowed domains
Issue: Movie posters and images show broken image placeholdersSolutions:
  1. Verify VITE_TMDB_ACCESS_TOKEN is the v4 Read Access Token (not v3 API key)
  2. Check the token hasn’t expired
  3. Ensure VITE_TMDB_API_URL=https://api.themoviedb.org/3 is set correctly
  4. Test the API directly:
    curl -H "Authorization: Bearer YOUR_TOKEN" \
      https://api.themoviedb.org/3/movie/popular
    
Issue: pnpm build fails with TypeScript errorsSolutions:
  1. Run pnpm check to see all type errors
  2. Ensure all dependencies are installed: pnpm install
  3. Clear TypeScript cache: rm -rf node_modules/.vite
  4. Check tsconfig.json is correctly configured
  5. Update TypeScript: pnpm add -D typescript@latest
Issue: Port 3000 is already in useSolutions:
  1. Change the port in package.json:
    "dev:vite": "vite dev --port 3001 --host"
    
  2. Or kill the process using port 3000:
    # macOS/Linux
    lsof -ti:3000 | xargs kill -9
    
    # Windows
    netstat -ano | findstr :3000
    taskkill /PID <PID> /F
    
Issue: Import errors like Cannot find module '@/components/...'Solutions:
  1. Verify tsconfig.json has the path alias:
    "paths": {
      "@/*": ["./src/*"]
    }
    
  2. Check vite.config.ts includes vite-tsconfig-paths plugin
  3. Restart your IDE/editor TypeScript server
  4. Clear cache: rm -rf node_modules/.vite

Development Scripts Reference

All available npm scripts from package.json:
CommandDescription
pnpm devStart both Vite and Convex dev servers in parallel
pnpm dev:viteStart only the Vite frontend dev server (port 3000)
pnpm dev:convexStart only the Convex backend dev server
pnpm buildType check and build for production
pnpm serveBuild and start production server
pnpm vite:servePreview production build locally
pnpm formatFormat code with Biome
pnpm lintLint code with Biome (max 20 diagnostics)
pnpm lint:fixAuto-fix linting issues
pnpm checkRun Biome check and TypeScript type checking
pnpm check:fixAuto-fix all checkable issues
Run pnpm check before every commit to ensure code quality.

Next Steps

Configuration

Customize themes, features, and settings

Development Guide

Learn about the codebase architecture

API Integration

Working with TMDB and Convex APIs

Configuration

Configure environment variables and services

Build docs developers (and LLMs) love