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>
53 lines
1.2 KiB
Python
53 lines
1.2 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from fastapi.responses import JSONResponse
|
|
import os
|
|
from dotenv import load_dotenv
|
|
|
|
from routes import generation, auth, users
|
|
|
|
load_dotenv()
|
|
|
|
app = FastAPI(
|
|
title="Wan2.1 PWA API",
|
|
description="API for AI video generation using Wan2.1 models",
|
|
version="1.0.0",
|
|
)
|
|
|
|
# CORS configuration
|
|
origins = os.getenv("ALLOWED_ORIGINS", "http://localhost:3000").split(",")
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=origins,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Include routers
|
|
app.include_router(generation.router, prefix="/api/generation", tags=["generation"])
|
|
app.include_router(auth.router, prefix="/api/auth", tags=["auth"])
|
|
app.include_router(users.router, prefix="/api/users", tags=["users"])
|
|
|
|
|
|
@app.get("/")
|
|
async def root():
|
|
return {"message": "Wan2.1 PWA API", "version": "1.0.0"}
|
|
|
|
|
|
@app.get("/health")
|
|
async def health():
|
|
return {"status": "healthy"}
|
|
|
|
|
|
if __name__ == "__main__":
|
|
import uvicorn
|
|
|
|
uvicorn.run(
|
|
"main:app",
|
|
host="0.0.0.0",
|
|
port=int(os.getenv("PORT", 8000)),
|
|
reload=os.getenv("ENV") == "development",
|
|
)
|