Skip to main content
This guide covers everything you need to install and configure TikTok Miner for development or production use.

System Requirements

Minimum Requirements

  • Node.js: 18.x or higher
  • Package Manager: Bun 1.2.5+ (recommended), npm, yarn, or pnpm
  • PostgreSQL: 14 or higher
  • Redis: 7 or higher
  • Memory: 2GB RAM minimum, 4GB recommended
  • Storage: 10GB free space
  • OS: Linux, macOS, or Windows with WSL2
  • Node.js: 20.x LTS
  • PostgreSQL: 15 or 16
  • Redis: 7.2 or higher
  • Memory: 8GB RAM

Installation Methods

Environment Variables

Complete reference of environment variables:

Database Configuration

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string with pgBouncer
DIRECT_URLYesDirect PostgreSQL connection for migrations
PASSWORDNoDatabase password (legacy)
Example:
DATABASE_URL="postgresql://postgres.xxx:[email protected]:6543/postgres?pgbouncer=true&connection_limit=1&pool_timeout=0"
DIRECT_URL="postgresql://postgres.xxx:[email protected]:5432/postgres"

Supabase Configuration

VariableRequiredDescription
NEXT_PUBLIC_SUPABASE_URLYesYour Supabase project URL
NEXT_PUBLIC_SUPABASE_ANON_KEYYesSupabase anonymous key

AI Configuration

VariableRequiredDescriptionDefault
OPENAI_API_KEYYesOpenAI API key-
OPENAI_MODELNoModel to usegpt-4o
OPENAI_TEMPERATURENoResponse randomness (0-1)0.7
OPENAI_MIN_CONFIDENCENoMinimum confidence threshold0.5

GitHub Configuration

VariableRequiredDescription
GITHUB_TOKENRecommendedGitHub personal access token
GITHUB_TOKENSNoComma-separated tokens for load balancing
GITHUB_TOKEN_LB_STRATEGYNoLoad balancing strategy

Social Media APIs

VariableRequiredDescription
TIKTOK_CLIENT_KEYNoTikTok API client key
TIKTOK_CLIENT_SECRETNoTikTok API client secret
INSTAGRAM_CLIENT_IDNoInstagram API client ID
INSTAGRAM_CLIENT_SECRETNoInstagram API client secret
TWITTER_BEARER_TOKENNoTwitter API bearer token
YOUTUBE_API_KEYNoYouTube Data API key

Email Configuration

VariableRequiredDescription
SMTP_HOSTNoSMTP server host
SMTP_PORTNoSMTP server port (465 or 587)
SMTP_USERNoSMTP username
SMTP_PASSWORDNoSMTP password
SMTP_SECURENoUse SSL/TLS (true for 465)
SMTP_AUTH_METHODNoAuthentication method

Application Configuration

VariableRequiredDescriptionDefault
NEXT_PUBLIC_APP_URLYesApplication URLhttp://localhost:3000
LOG_LEVELNoLogging levelinfo
NODE_ENVNoEnvironmentdevelopment
PORTNoServer port3000

Database Schema

TikTok Miner uses Prisma ORM with the following main models:

Creator Profiles

model CreatorProfile {
  id                      String   @id @default(uuid())
  name                    String
  email                   String?
  bio                     String?
  profileImageUrl         String?
  category                String?
  tags                    String[]
  isVerified              Boolean  @default(false)
  platformIdentifiers     Json
  compositeEngagementScore Float?
  totalReach              Int
  averageEngagementRate   Float?
  contentFrequency        Float?
  audienceQualityScore    Float?
  lastSync                DateTime @default(now())
  syncStatus              SyncStatus @default(PENDING)
  
  // Relations
  youtubeMetrics          YoutubeMetrics?
  twitterMetrics          TwitterMetrics?
  instagramMetrics        InstagramMetrics?
  tiktokMetrics           TiktokMetrics?
  metricsHistory          CreatorMetricsHistory[]
  engagementAnalytics     EngagementAnalytics[]
}

TikTok Metrics

model TiktokMetrics {
  id                String   @id @default(uuid())
  creatorProfileId  String   @unique
  userId            String   @unique
  followerCount     Int
  followingCount    Int
  videoCount        Int
  heartCount        BigInt
  averageViews      Int
  averageLikes      Int
  averageComments   Int
  averageShares     Int
  engagementRate    Float
  username          String   @unique
  nickname          String?
  profileUrl        String
  bio               String?
  isVerified        Boolean
  totalViews        BigInt
  dailyViewGrowth   Float?
  dailyFollowerGrowth Float?
}

Budget Management

TikTok Miner includes comprehensive budget tracking:
model Budget {
  id                String         @id @default(uuid())
  name              String
  budgetType        BudgetType
  totalAmount       Float
  spentAmount       Float
  remainingAmount   Float
  startDate         DateTime
  endDate           DateTime
  status            BudgetStatus
  alertThreshold80  Boolean
  alertThreshold90  Boolean
  alertThreshold100 Boolean
  autoRenewal       Boolean
}
For the complete schema, see prisma/schema.prisma in the repository.

Verification

Verify your installation:

Check Database Connection

bun x prisma db pull

Test API Health

curl http://localhost:3000/api/health

Run Tests

bun run test:all

Next Steps

Quickstart Guide

Run your first creator search in 5 minutes

Environment Variables

Deep dive into configuration options

CLI Tools

Learn about command-line tools

API Reference

Explore the REST API

Troubleshooting

Common Issues

This usually means the database connection is incorrect or unreachable.Solutions:
  • Verify DATABASE_URL and DIRECT_URL are correct
  • Check PostgreSQL is running
  • Test connection: psql $DATABASE_URL
  • Ensure database exists
Another service is using port 3000.Solutions:
  • Stop the conflicting service
  • Change port: PORT=3001 bun run dev
  • In Docker: Update docker-compose.yml ports section
Redis is not running or not accessible.Solutions:
  • Start Redis: redis-server
  • Check if running: redis-cli ping
  • Verify REDIS_URL in .env
  • Check firewall rules for port 6379
Supabase configuration is incorrect.Solutions:
  • Verify NEXT_PUBLIC_SUPABASE_URL matches your project
  • Check NEXT_PUBLIC_SUPABASE_ANON_KEY is valid
  • Ensure Supabase project is active
  • Test in Supabase dashboard first
Database schema doesn’t match expected state.Solutions:
  • Reset database: bun x prisma migrate reset
  • Check migration history: bun x prisma migrate status
  • Apply pending migrations: bun x prisma migrate deploy
  • Use DIRECT_URL for migrations, not pooled connection

Getting Help

If you’re still having issues:

Build docs developers (and LLMs) love