Next.js Flask Starter
Type: Code
Framework: Next.js
CSS: Tailwind
- Overview: A hybrid application combining Next.js for the frontend and Flask for the API backend, ideal for integrating Python AI libraries into Next.js apps.
- How It Works:
- The Flask server is integrated within the Next.js app under the
/api/path. - Using
next.config.jsrewrites, requests to/api/:path*are directed to the Flask API located in the/apidirectory. - Locally, rewrites target the Flask server at
127.0.0.1:5328. - In production, the Flask server operates as serverless functions on Vercel.
- The Flask server is integrated within the Next.js app under the
- Demo: View the live demo at https://nextjs-flask-starter.vercel.app/.
- Deploying:
- The app can be easily deployed to Vercel with a single click through the provided option.
- Local Development:
- Clone and set up the repository using
npx create-next-appwith the specified example URL.
- Clone and set up the repository using
- Getting Started:
- Install necessary dependencies using npm, yarn, or pnpm.
- Launch the development server with the corresponding start command.
- Access the app locally at
http://localhost:3000and the Flask server athttp://127.0.0.1:5328. - Adjust the Flask server port in
package.jsonandnext.config.jsas needed.
- Learning Resources:
- Explore Next.js documentation and tutorials for more insights on its features.
- Delve into the Flask documentation to understand its capabilities.
- Contributions and feedback are encouraged on the Next.js GitHub repository.