Next.js Integration
Add Visgate to your Next.js application with the server proxy.
A step-by-step guide to integrating Visgate into a Next.js application using the App Router.
1. Install Packages
2. Set Environment Variables
Add your Visgate API key to .env.local:
3. Create the Proxy Route
Create the catch-all route handler that forwards requests to Visgate:
maxDuration = 300 gives 5 minutes for video generation. Adjust based on your needs.
4. Use the Client
In any client component or server action:
5. Video Generation
For video generation, use a longer timeout and async mode:
6. Session Auth (Firebase)
If your app uses Firebase authentication:
The proxy forwards the Bearer token to the Visgate API.