Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Sway Reel Intelligence Agent MVP

FastAPI + Gemini-first backend for analyzing YouTube Shorts, Instagram links with user-provided context, and uploaded videos. It generates a structured content report, creates a PDF, and can create shareable report links through Supabase Storage without user login or report history.

What this MVP does now

  • FastAPI backend
  • No login
  • 100 MB video upload limit
  • Gemini-first AI report generation
  • YouTube Shorts metadata through YouTube Data API
  • Instagram link intake with manual context first
  • Uploaded video metadata through FFmpeg / ffprobe
  • Uploaded video analysis through Gemini Files API when key is configured
  • PDF report generation
  • Shareable links through Supabase Storage, no database table required
  • Report languages: English, Hindi, Tamil, Telugu, Spanish, French

What this MVP does not honestly do yet

  • It does not scrape every Instagram, TikTok, LinkedIn, or Facebook reel from a public link.
  • It does not access private analytics like saves, shares, audience retention, reach, or watch time unless the platform API and permissions allow it or the user provides them.
  • It does not store user accounts or report history.

Local setup

1. Install prerequisites

  • Python 3.11+
  • FFmpeg
  • Git

Check FFmpeg:

ffmpeg -version
ffprobe -version

2. Create environment

cd backend
python -m venv .venv

Windows PowerShell:

.\.venv\Scripts\Activate.ps1

Mac/Linux:

source .venv/bin/activate

3. Install backend packages

pip install -r requirements.txt

4. Add keys

copy .env.example .env

On Mac/Linux:

cp .env.example .env

Open .env and paste your keys.

5. Run backend

uvicorn app.main:app --reload

Open:

http://127.0.0.1:8000

API docs:

http://127.0.0.1:8000/docs

Where to get every key

Gemini API key

  1. Go to Google AI Studio.
  2. Sign in with your Google account.
  3. Open API Keys.
  4. Click Create API key.
  5. Copy the key.
  6. Put it in .env:
GEMINI_API_KEY=your_key_here
GEMINI_MODEL=gemini-3.5-flash

Use this only on the backend. Never put the key inside frontend JavaScript.

YouTube Data API key

  1. Go to Google Cloud Console.
  2. Create a new project, for example sway-reel-agent.
  3. Go to APIs & Services.
  4. Enable APIs and Services.
  5. Search for YouTube Data API v3.
  6. Click Enable.
  7. Go to Credentials.
  8. Click Create Credentials.
  9. Choose API key.
  10. Copy the key.
  11. Restrict the key to YouTube Data API v3 if possible.
  12. Put it in .env:
YOUTUBE_API_KEY=your_key_here

Supabase URL, anon key, service role key

  1. Go to Supabase.
  2. Create a new project.
  3. Open Project Settings.
  4. Go to API Keys.
  5. Copy Project URL.
  6. Copy anon public key.
  7. Copy service_role key.
  8. Put them in .env:
SUPABASE_URL=https://your-project-ref.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key_here
SUPABASE_PUBLIC_BUCKET=reports

The anon key is useful for frontend apps later. This MVP does not need it because the backend handles uploads.

Supabase Storage bucket for shareable links

  1. Open Supabase dashboard.
  2. Go to Storage.
  3. Create a bucket named reports.
  4. For easy public share links, make the bucket public.
  5. Keep the service role key only on the backend.

If you keep the bucket private, change the backend to generate signed URLs instead of public URLs.

Meta developer app for Instagram/Facebook later

  1. Go to Meta for Developers.
  2. Create a Business type app.
  3. Add Instagram and Facebook products needed for your use case.
  4. Use Instagram Login for Business or Facebook Login depending on the API path.
  5. Connect an Instagram professional account.
  6. Generate an access token from the app dashboard for testing.
  7. For public production use and advanced permissions, complete App Review.
  8. Put future values in .env:
META_APP_ID=your_app_id
META_APP_SECRET=your_app_secret
META_ACCESS_TOKEN=your_access_token

For MVP, Instagram works best when the user uploads the video or pastes caption, transcript, visible stats, and comments.

TikTok developer app later

  1. Go to TikTok for Developers.
  2. Create an app.
  3. Add the TikTok API product that matches your use case.
  4. Complete required review or research/commercial access steps.
  5. Copy Client Key and Client Secret.
  6. Put them in .env:
TIKTOK_CLIENT_KEY=your_client_key
TIKTOK_CLIENT_SECRET=your_client_secret

LinkedIn developer app later

  1. Go to LinkedIn Developers.
  2. Create an app.
  3. Connect it to your LinkedIn Page or organization if required.
  4. Request the required products and permissions.
  5. Copy Client ID and Client Secret.
  6. Put them in .env:
LINKEDIN_CLIENT_ID=your_client_id
LINKEDIN_CLIENT_SECRET=your_client_secret

LinkedIn video data requires approved access and ownership or admin context for many operations.

Recommended build order

  1. Uploaded video analyzer
  2. YouTube Shorts metadata and Gemini analysis
  3. PDF report generation
  4. Supabase Storage public share links
  5. Instagram manual context mode
  6. Instagram/Facebook Meta API integration
  7. TikTok integration
  8. LinkedIn integration
  9. Admin prompt editor
  10. Paid usage limits and authentication

Deploy free now

Backend on Render

  1. Push this folder to GitHub.
  2. Go to Render.
  3. Create New Web Service.
  4. Connect GitHub repo.
  5. Root directory: backend.
  6. Build command:
pip install -r requirements.txt
  1. Start command:
uvicorn app.main:app --host 0.0.0.0 --port $PORT
  1. Add environment variables from .env inside Render dashboard.

Render free is enough for testing. Upgrade when video uploads and Gemini calls get heavier.

Frontend on Cloudflare Pages

For the current static frontend, the FastAPI backend also serves it. If you want separate frontend hosting:

  1. Upload the frontend folder to Cloudflare Pages.
  2. Set the frontend API base URL to your Render backend URL in app.js.
  3. Deploy.

Important security rules

  • Never put GEMINI_API_KEY, YOUTUBE_API_KEY, or SUPABASE_SERVICE_ROLE_KEY in frontend code.
  • Never commit .env to GitHub.
  • Use backend environment variables only.
  • Restrict Google API keys where possible.
  • Rotate keys immediately if leaked.

Next change I would add

Add an admin-only prompt editor later. Since you chose no login for MVP, changing agent rules should be done in backend prompt files first. Admin mode needs authentication.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages