A website to generate scale ticket reports and manage crop storage
This is a hybrid Next.js + Python app that uses Next.js as the front end and FastAPI as the API backend allowing the use of Python libraries on the backend.
The Python/FastAPI server is mapped into to Next.js app under /api/
.
This is implemented using next.config.js
rewrites to map any request to /api/:path*
to the FastAPI API, which is hosted in the /api
folder.
On localhost, the rewrite will be made to the 127.0.0.1:8000
port, which is where the FastAPI server is running.
In production, the FastAPI server is hosted as Python serverless functions on Vercel.
You can clone & create this repo with the following command
git clone https://github.com/kalenwallin/wallinfarms
First, create and activate a virtual environment:
python3.9 -m venv .venv
python3.9 .venv/bin/activate
Then install the Python dependencies:
pip install -r requirements.txt
Also install the node dependencies:
npm install
Then, run the development server:
npm run dev
Open http://localhost:3000 with your browser to see the result.
The FastApi server will be running on http://127.0.0.1:8000.
To learn more about Next.js + FastAPI, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
- FastAPI Documentation - learn about FastAPI features and API.