This is a Next.js template project that's preconfigured to work with Replicate's API.
You can use this as a quick jumping-off point to build a web app using Replicate's API, or you can recreate this codebase from scratch by following the guide at replicate.com/docs/get-started/nextjs
- pages/index.js - The React frontend that renders the home page in the browser
- pages/api/predictions/index.js - The backend API endpoint that calls Replicate's API to create a prediction
- pages/api/predictions/[id].js - The backend API endpoint that calls Replicate's API to get the prediction result
Install dependencies:
npm install
Add your Replicate API token to .env.local
:
REPLICATE_API_TOKEN=<your-token-here>
Run the development server:
npm run dev
Open http://localhost:3000 with your browser.
For detailed instructions on how to create and use this template, see replicate.com/docs/get-started/nextjs
![iguana](https://private-user-images.githubusercontent.com/14149230/256601356-5d1933ec-a083-4de6-90e2-7552e33e4a85.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE5NTQ1MjEsIm5iZiI6MTcyMTk1NDIyMSwicGF0aCI6Ii8xNDE0OTIzMC8yNTY2MDEzNTYtNWQxOTMzZWMtYTA4My00ZGU2LTkwZTItNzU1MmUzM2U0YTg1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA3MjYlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNzI2VDAwMzcwMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA1OGE0MDViNGQ0YmRkYjkwNjljNTM4ZGVhNWNjY2NlNGQ4Mjc2YTljNTVkNDg0ZGFlOGVkMmQ2NjA0ZjVlZmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Ci9LgW1t-R4SqwCF6QPjgW2gyBKkPxjbIJ_YjrouCX0)