Energy-focused FastAPI learning repository with a React tutorial frontend and FastAPI backend examples.
- GitHub Pages (tutorial app): https://niranjanxprt.github.io/Pythonfast/
- Repository: https://github.com/niranjanxprt/Pythonfast
.
├── fastapi-tutorial/ # React + Vite interactive FastAPI tutorial (deployed to GitHub Pages)
├── my-fastapi-app/ # FastAPI example backend and Pydantic models
└── .github/workflows/ # CI/CD workflows (Pages deployment)
- FastAPI basics: routing, request validation, query/path params
- Pydantic models and validation patterns
- Energy-domain examples (panels, readings, monitoring)
- Pandas and NumPy examples for energy data analysis
- React tutorial UI deployed to GitHub Pages
cd fastapi-tutorial
npm ci
npm run devOpen: http://localhost:5173
cd my-fastapi-app
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install fastapi "uvicorn[standard]"
uvicorn main:app --reloadOpen:
- API root: http://127.0.0.1:8000
- Swagger UI: http://127.0.0.1:8000/docs
The frontend is deployed automatically with GitHub Actions:
- Workflow:
.github/workflows/deploy-fastapi-tutorial-pages.yml - Trigger: push to
mainfor files underfastapi-tutorial/** - Publish target:
gh-pagesbranch - Vite base path:
/Pythonfast/
- Keep frontend and backend concerns separated by directory.
- Deploy only static frontend assets to Pages; keep API runtime separate.
- Use lockfiles (
package-lock.json) for reproducible frontend builds. - Use CI/CD workflow for repeatable deployment on every push.
- Keep secrets out of source code and use environment variables in real deployments.
- This repository is tutorial-oriented and optimized for learning.
- For production APIs, add authentication, persistent storage, tests, and observability.