Headshot AI Starter

Open-source SaaS starter for generating professional AI headshots using Astria, Next.js, and Supabase.

https://github.com/davidbmar/headshots-starter-clone  ·  private  ·  shipped

Headshot AI Starter screenshot

What it is

A full-stack application template that allows users to upload sample photos, train a custom AI model via Astria, and generate professional headshots. It includes authentication, database management, webhook handling for async AI tasks, and optional email notifications and billing integration.

Features

Quickstart

git clone https://github.com/davidbmar/headshots-starter-clone.git
cd headshots-starter-clone
npm install
npm run dev

Architecture

flowchart TD
    User[User Browser] -->|Upload Images| NextJS[Next.js App]
    NextJS -->|Auth Check| SupabaseAuth[Supabase Auth]
    NextJS -->|Store Images| VercelBlob[Vercel Blob Storage]
    NextJS -->|Trigger Training| Astria[Astria AI API]
    Astria -->|Webhook: Train Complete| WebhookTrain[Train Webhook Route]
    WebhookTrain -->|Update Status| SupabaseDB[Supabase Database]
    WebhookTrain -->|Send Email| Resend[Resend Email Service]
    User -->|View Results| NextJS
    NextJS -->|Fetch Data| SupabaseDB

How it's built

Built with Next.js (App Router) for the frontend and API routes, Supabase for PostgreSQL database and Authentication, Astria for AI model training/inference, Vercel Blob for image storage, and Tailwind/Shadcn for UI. It uses webhooks to handle long-running AI training jobs asynchronously.

How it runs

sequenceDiagram
    participant U as User
    participant N as Next.js API
    participant S as Supabase
    participant V as Vercel Blob
    participant A as Astria AI
    
    U->>N: POST /train-model (images)
    N->>S: Verify User Session
    S-->>N: User Valid
    N->>V: Upload Images
    V-->>N: Image URLs
    N->>A: POST /tunes (Train Model)
    A-->>N: Tune ID & Status
    N->>S: Save Model Record (pending)
    N-->>U: Training Started
    
    Note over A, N: Async Processing...
    
    A->>N: POST /astria/train-webhook
    N->>S: Update Model Status (completed)
    N->>S: Generate Prompts/Images
    N-->>A: 200 OK

How to apply & reuse

Fork the repository, deploy to Vercel using the provided button to set up Supabase integrations automatically, configure environment variables (Astria API Key, Webhook Secret), and customize the UI/branding for your specific SaaS offering.

At a glance

CapabilitiesAI Model TrainingImage GenerationUser AuthenticationWebhook ProcessingFile StorageEmail Notifications
ComponentsNext.js App RouterSupabase ClientAstria API ClientVercel Blob ClientResend Email ClientStripe Billing (Optional)
TechTypeScriptReactTailwind CSSShadcn UIPostgreSQLServerless Functions
Depends onNode.jsnpm/yarnVercel AccountSupabase AccountAstria Account
Integrates withAstria.aiSupabaseVercelResendStripe
PatternsWebhook-driven Async ProcessingServerless API RoutesRow Level Security (RLS)Magic Link AuthenticationPresigned URL Uploads
Reuse tagsai-saas-starternextjs-templatesupabase-authastria-integrationvercel-deployment

⚠ Needs attention