mirror of
https://github.com/Wan-Video/Wan2.1.git
synced 2025-11-03 13:54:30 +00:00
This commit adds a production-ready Progressive Web App for AI-powered video generation using Wan2.1 models. Features: - Next.js 15 frontend with App Router and PWA support - FastAPI backend with Replicate integration - 50+ prompt templates across 7 categories - Supabase authentication and database - Credit system with usage tracking - Text-to-Video and Image-to-Video generation - Complete documentation (setup, deployment, contributing) Project Structure: - apps/web: Next.js frontend with shadcn/ui components - apps/api: FastAPI backend with GPU processing via Replicate - packages/db: Database schema and migrations for Supabase Tech Stack: - Frontend: Next.js 15, shadcn/ui, Tailwind, Zustand, React Hook Form, Zod - Backend: FastAPI, Replicate, Supabase - Database: Supabase (Postgres) with RLS - Infrastructure: Turborepo monorepo, Vercel/Modal deployment Documentation: - README.md: Project overview and features - SETUP.md: Complete setup guide (5-minute quickstart) - DEPLOYMENT.md: Production deployment instructions - CONTRIBUTING.md: Contribution guidelines - PROJECT_SUMMARY.md: Comprehensive project documentation Ready for development and deployment. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
66 lines
1.7 KiB
Python
66 lines
1.7 KiB
Python
from fastapi import APIRouter, HTTPException
|
|
from pydantic import BaseModel, EmailStr
|
|
from core.supabase import get_supabase
|
|
|
|
router = APIRouter()
|
|
|
|
|
|
class SignUpRequest(BaseModel):
|
|
email: EmailStr
|
|
password: str
|
|
|
|
|
|
class SignInRequest(BaseModel):
|
|
email: EmailStr
|
|
password: str
|
|
|
|
|
|
@router.post("/signup")
|
|
async def sign_up(request: SignUpRequest):
|
|
"""Sign up a new user"""
|
|
supabase = get_supabase()
|
|
|
|
try:
|
|
result = supabase.auth.sign_up({"email": request.email, "password": request.password})
|
|
|
|
if result.user:
|
|
# Initialize user with free credits
|
|
supabase.table("users").insert(
|
|
{
|
|
"id": result.user.id,
|
|
"email": request.email,
|
|
"credits": 100, # Free tier credits
|
|
"subscription_tier": "free",
|
|
}
|
|
).execute()
|
|
|
|
return {"user": result.user, "session": result.session}
|
|
except Exception as e:
|
|
raise HTTPException(status_code=400, detail=str(e))
|
|
|
|
|
|
@router.post("/signin")
|
|
async def sign_in(request: SignInRequest):
|
|
"""Sign in an existing user"""
|
|
supabase = get_supabase()
|
|
|
|
try:
|
|
result = supabase.auth.sign_in_with_password(
|
|
{"email": request.email, "password": request.password}
|
|
)
|
|
return {"user": result.user, "session": result.session}
|
|
except Exception as e:
|
|
raise HTTPException(status_code=401, detail="Invalid credentials")
|
|
|
|
|
|
@router.post("/signout")
|
|
async def sign_out():
|
|
"""Sign out the current user"""
|
|
supabase = get_supabase()
|
|
|
|
try:
|
|
supabase.auth.sign_out()
|
|
return {"message": "Signed out successfully"}
|
|
except Exception as e:
|
|
raise HTTPException(status_code=400, detail=str(e))
|