An AI-powered agent system for TikTok influencer marketing and trend research. Built with Next.js, Prisma, and Gemini AI.
This project demonstrates a multi-agent system that routes queries to specialized agents:
- Database Search Agent: Query influencers by tier, genre, location, and price
- Trend Research Agent: Research TikTok trends and content ideas
- YouTube Video Finder Agent (Student Challenge): Find YouTube videos on any topic
- Node.js 20.x or higher
- Yarn or npm
- API Keys (see setup below)
# Install dependencies
yarn install
# or
npm installCreate a .env file in the root directory with the following keys:
# Required: Get your Gemini API key
GEMINI_API_KEY=your_gemini_key_here
# Required: Get your SerpAPI key for trend research
SERP_API_KEY=your_serpapi_key_here
# Database URL (shared for students - read-only access)
DATABASE_URL="postgresql://neondb_owner:npg_Rt2Mena8ZVwA@ep-billowing-shape-a4a0p4zw-pooler.us-east-1.aws.neon.tech/neondb?sslmode=require&channel_binding=require"- Go to Google AI Studio
- Sign in with your Google account
- Click "Create API Key"
- Copy the key and paste it in your
.envfile asGEMINI_API_KEY
Free Tier: 60 requests per minute, sufficient for development and testing
- Go to SerpAPI
- Sign up for a free account
- Navigate to your Dashboard
- Copy your API key and paste it in your
.envfile asSERP_API_KEY
Free Tier: 100 searches per month
Option A: Use Shared Database (Recommended for Workshop)
The DATABASE_URL provided above connects to a pre-seeded database with 1000 influencers.
Simply run:
npx prisma generateThis generates the Prisma Client with TypeScript types. No migration or seed needed!
Option B: Create Your Own Database
If you want your own Postgres instance:
-
Create a Postgres Database (options):
-
Update DATABASE_URL in
.envwith your connection string -
Generate Prisma Client:
npx prisma generate
-
Run Migrations:
npx prisma migrate dev
-
Seed the Database (creates 1000 influencers):
npx prisma db seed
yarn dev
# or
npm run devOpen http://localhost:3000 in your browser.
app/
├── agents/
│ ├── executeAgent.ts # Main router agent
│ ├── databaseSearchAgent.ts # Database queries
│ ├── trendResearchAgent.ts # Trend research
│ ├── videoFinderAgent.ts # Student challenge (to implement)
│ └── agentTypes.ts # Type definitions
├── libs/
│ ├── gemini.ts # Gemini AI client
│ └── prisma.ts # Database client
├── actions.ts # Server actions
└── page.tsx # Main UI
prisma/
├── schema.prisma # Database schema
└── seed.ts # Seed script
Database Search:
- "Find micro influencers in beauty"
- "Show me gaming influencers under $500"
- "I need nano tier influencers in Los Angeles"
Trend Research:
- "What are the latest TikTok dance trends?"
- "Trending fitness content ideas"
- "Popular hashtags for beauty campaigns"
See TODOS.md for a guided challenge to build a new agent.
What you'll build: An agent that finds YouTube videos on any topic using SerpAPI and Gemini AI.
The database includes:
- 1000 Influencers with metadata (tier, genre, location)
- 5 Tiers: nano, micro, mid, macro, mega
- 10 Genres: pop, hiphop, rock, electronic, country, gaming, beauty, fitness, comedy, tech
- Pricing data for different content types
# Open Prisma Studio to browse data
npx prisma studioIf you make changes to prisma/schema.prisma:
# Generate Prisma client
npx prisma generate
# Create and apply migration (if using your own DB)
npx prisma migrate dev --name your_migration_name- Double-check your
GEMINI_API_KEYandSERP_API_KEYin.env - Ensure there are no quotes around the keys
- Restart the dev server after changing
.env
- Using shared DB: Check your internet connection
- Using own DB: Verify your
DATABASE_URLis correct - Run
npx prisma db pushto sync schema
- Database Search: Make sure database is seeded (
npx prisma db seed) - Trend Research: Check SERP_API_KEY is valid
- Check console logs for detailed error messages
# Regenerate Prisma client
npx prisma generate
# Reset database (warning: deletes all data)
npx prisma migrate resetRead Anthropic's guide on agent design patterns: Building Effective Agents
Key concepts covered:
- Workflows vs Agents
- When to use agents
- Prompt engineering for agents
- Structured outputs
- Agent orchestration patterns
- Next.js 16 - React framework
- Prisma - Database ORM
- Gemini AI - Language model
- Zod - Schema validation
- SerpAPI - Search results API
This is an educational project. Feel free to:
- Add new agents
- Improve existing agents
- Enhance the UI
- Add more seed data
MIT License - feel free to use this for learning and teaching!
If you enjoyed building this agent system and want to take your AI development skills to the next level, check out Parsity's 30-Day AI Dev Cohort.
What you'll learn:
- RAG (Retrieval-Augmented Generation) agents
- LLM operations and deployment
- Linear algebra fundamentals for ML
- Model fine-tuning techniques
What you'll get:
- Live support and office hours
- Build an amazing portfolio project or startup idea
- Learn from experienced AI engineers
- Join a community of web developers leveling up their AI skills
Perfect for web developers who want to become AI engineers.
Built for learning about AI agents