Skip to content

Commit d6f6ef5

Browse files
committed
Improve repository documentation and GitHub metadata
1 parent aa28659 commit d6f6ef5

2 files changed

Lines changed: 100 additions & 13 deletions

File tree

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Pythonfast
2+
3+
Energy-focused FastAPI learning repository with a React tutorial frontend and FastAPI backend examples.
4+
5+
## Live Links
6+
7+
- GitHub Pages (tutorial app): https://niranjanxprt.github.io/Pythonfast/
8+
- Repository: https://github.com/niranjanxprt/Pythonfast
9+
10+
## Repository Layout
11+
12+
```text
13+
.
14+
├── fastapi-tutorial/ # React + Vite interactive FastAPI tutorial (deployed to GitHub Pages)
15+
├── my-fastapi-app/ # FastAPI example backend and Pydantic models
16+
└── .github/workflows/ # CI/CD workflows (Pages deployment)
17+
```
18+
19+
## What This Repo Includes
20+
21+
- FastAPI basics: routing, request validation, query/path params
22+
- Pydantic models and validation patterns
23+
- Energy-domain examples (panels, readings, monitoring)
24+
- Pandas and NumPy examples for energy data analysis
25+
- React tutorial UI deployed to GitHub Pages
26+
27+
## Quick Start
28+
29+
### 1. Frontend tutorial app
30+
31+
```bash
32+
cd fastapi-tutorial
33+
npm ci
34+
npm run dev
35+
```
36+
37+
Open: http://localhost:5173
38+
39+
### 2. FastAPI backend examples
40+
41+
```bash
42+
cd my-fastapi-app
43+
python -m venv .venv
44+
source .venv/bin/activate # Windows: .venv\Scripts\activate
45+
pip install fastapi "uvicorn[standard]"
46+
uvicorn main:app --reload
47+
```
48+
49+
Open:
50+
51+
- API root: http://127.0.0.1:8000
52+
- Swagger UI: http://127.0.0.1:8000/docs
53+
54+
## Deployment
55+
56+
The frontend is deployed automatically with GitHub Actions:
57+
58+
- Workflow: `.github/workflows/deploy-fastapi-tutorial-pages.yml`
59+
- Trigger: push to `main` for files under `fastapi-tutorial/**`
60+
- Publish target: `gh-pages` branch
61+
- Vite base path: `/Pythonfast/`
62+
63+
## Best Practices Followed
64+
65+
- Keep frontend and backend concerns separated by directory.
66+
- Deploy only static frontend assets to Pages; keep API runtime separate.
67+
- Use lockfiles (`package-lock.json`) for reproducible frontend builds.
68+
- Use CI/CD workflow for repeatable deployment on every push.
69+
- Keep secrets out of source code and use environment variables in real deployments.
70+
71+
## Notes
72+
73+
- This repository is tutorial-oriented and optimized for learning.
74+
- For production APIs, add authentication, persistent storage, tests, and observability.

fastapi-tutorial/README.md

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,36 @@
1-
# React + Vite
1+
# FastAPI Tutorial Frontend
22

3-
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3+
Interactive React + Vite frontend for learning FastAPI with energy-data examples.
44

5-
Currently, two official plugins are available:
5+
## Live URL
66

7-
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8-
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
7+
- https://niranjanxprt.github.io/Pythonfast/
98

10-
## React Compiler
9+
## Local Development
1110

12-
The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
11+
```bash
12+
npm ci
13+
npm run dev
14+
```
1315

14-
## Expanding the ESLint configuration
16+
Open: http://localhost:5173
1517

16-
If you are developing a production application, we recommend using TypeScript with type-aware lint rules enabled. Check out the [TS template](https://github.com/vitejs/vite/tree/main/packages/create-vite/template-react-ts) for information on how to integrate TypeScript and [`typescript-eslint`](https://typescript-eslint.io) in your project.
18+
## Production Build
1719

18-
## GitHub Pages
20+
```bash
21+
npm run build
22+
npm run preview
23+
```
1924

20-
This app is configured for GitHub Pages deployment from the repository root workflow.
25+
## Deployment Notes
2126

22-
- Live URL: https://niranjanxprt.github.io/Pythonfast/
23-
- Build base path: `/Pythonfast/`
27+
- This app is deployed via repository workflow:
28+
- `.github/workflows/deploy-fastapi-tutorial-pages.yml`
29+
- GitHub Pages project URL requires Vite base path:
30+
- `base: "/Pythonfast/"`
31+
32+
## Best-Practice Notes
33+
34+
- Keep static docs/tutorial UI on Pages and backend API runtime separate.
35+
- Use `npm ci` in CI for deterministic installs from `package-lock.json`.
36+
- Use path-based workflow triggers to deploy only when frontend-related files change.

0 commit comments

Comments
 (0)