A modern, full-stack movie streaming app (Netflix-like) built with Next.js App Router, TypeScript, Tailwind CSS, Prisma (SQLite), NextAuth, and TMDB API.
- π¬ Real movie data from TMDB API
- π Authentication (email/password) with NextAuth
- π¨ Modern Netflix-style UI with Tailwind CSS
- π± Responsive design
- π Movie search functionality
- β€οΈ Personal watchlist
- π₯ Video player with sample videos
- π Movie details, ratings, and trailers
- π§ Password reset via email
- Next.js 14 (App Router)
- TypeScript
- Tailwind CSS + Framer Motion
- Prisma + SQLite
- NextAuth.js
- TMDB API
- Radix UI + Lucide React icons
- SendGrid (Email service)
- Go to TMDB and create an account
- Go to Settings > API and request an API key
- Copy your API key
# Copy environment file
cp .env.example .env.local
# Edit .env.local and add your configuration:
TMDB_API_KEY="your-tmdb-api-key-here"
TMDB_BASE_URL="https://api.themoviedb.org/3"
# Database
DATABASE_URL="file:./dev.db"
# NextAuth.js
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key-here"
# Email Configuration (Optional - for password reset)
EMAIL_USER="[email protected]"
EMAIL_PASS="your-16-digit-app-password"
# SendGrid (Recommended for production)
SENDGRID_API_KEY="SG.your-api-key-here"
SENDGRID_FROM_EMAIL="[email protected]"npm installnpx prisma db pushnpm run devOpen http://localhost:3000 in your browser.
- Home (
/) - Featured movies, trending, and popular - Movies (
/movies) - Browse popular, top-rated, and now playing - Search (
/search) - Search movies by title - Movie Detail (
/movie/[id]) - Movie details, trailer, and related movies - Watch (
/watch/[id]) - Video player (requires login) - Watchlist (
/watchlist) - Personal movie list (requires login) - Auth (
/auth/signin,/auth/signup) - Authentication pages
npm run devβ Start development servernpm run buildβ Build for productionnpm run startβ Start production servernpm run db:pushβ Push Prisma schema to databasenpm run db:studioβ Open Prisma Studionpm run fetch:moviesβ Fetch movies from TMDB APInpm run fetch:movies:testβ Test TMDB connection
- Enable 2-Factor Authentication on your Google Account
- Generate App Password:
- Go to Google Account Settings > Security > App passwords
- Select "Mail" and "Other (custom name)"
- Enter "Screenly App" as name
- Copy the 16-digit password
- Add to
.env.local:EMAIL_USER="[email protected]" EMAIL_PASS="your-16-digit-app-password"
- Create account at SendGrid.com
- Get API Key:
- Settings β API Keys β Create API Key
- Select "Restricted Access"
- Set Mail Send to "Full Access"
- Setup Domain Authentication (Recommended):
- Settings β Sender Authentication β Authenticate Your Domain
- Add DNS records to your domain
- Add to
.env.local:SENDGRID_API_KEY="SG.your-api-key-here" SENDGRID_FROM_EMAIL="[email protected]"
- Use your own domain for better deliverability
- Setup SPF, DKIM, and DMARC records
- Avoid spam trigger words in email content
- Use professional from address (not Gmail/Yahoo)
The app can automatically populate your database with movies from TMDB:
# Test connection first
npm run fetch:movies:test
# Fetch movies (adjust pages in script if needed)
npm run fetch:moviesEdit scripts/fetch-tmdb-movies.ts to adjust:
- Number of pages per category (default: 5 pages = ~100 movies per category)
- Rate limiting (default: 250ms delay between requests)
- Categories: Popular, Top Rated, Now Playing, Upcoming, Discover
- Duplicate Prevention - Skips movies already in database
- Rate Limiting - Respects TMDB API limits
- Error Handling - Retry mechanism for failed requests
- Progress Tracking - Real-time progress display
The app uses SQLite with Prisma ORM. Key models:
- User - User accounts and authentication
- Movie - Movie data from TMDB
- Watchlist - User's saved movies
- PasswordResetToken - Password reset functionality
# Required
TMDB_API_KEY="your-tmdb-api-key-here"
TMDB_BASE_URL="https://api.themoviedb.org/3"
DATABASE_URL="file:./dev.db"
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key-here"
# Email (Optional)
EMAIL_USER="[email protected]"
EMAIL_PASS="your-app-password"
SENDGRID_API_KEY="SG.your-api-key-here"
SENDGRID_FROM_EMAIL="[email protected]"- Not sending: Check console logs, verify credentials
- Spam folder: Setup domain authentication, use professional domain
- Rate limits: Gmail: 500/day, SendGrid: 100/day (free tier)
- API key invalid: Verify key in TMDB dashboard
- Rate limited: Script handles this automatically with delays
- Database errors: Run
npx prisma db push
- Build errors: Check TypeScript errors, run
npm run build - Database connection: Ensure
.env.localhas correct DATABASE_URL - Authentication: Verify NEXTAUTH_SECRET is set
- Email Service: Use SendGrid or AWS SES for reliable delivery
- Database: Consider PostgreSQL for production
- Domain: Setup proper domain with SSL
- Environment: Use proper environment variables
- Monitoring: Setup error tracking and analytics
- Movie data is fetched from TMDB API with 1-hour caching
- Video playback uses sample videos for demo purposes
- Watchlist data is stored in local SQLite database
- Images are served from TMDB CDN
- Email templates are responsive and professional
- Search prioritizes local database over TMDB API
This project is for educational purposes. Please respect TMDB's terms of service and use appropriate licensing for production use.