fastreact 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,211 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastreact
3
+ Version: 0.1.0
4
+ Summary: FastAPI + React unified stack — zero config, one server, Python tracebacks in browser
5
+ Author-email: Mohammad Ramiz <your@email.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/RamizMohammad/fastreact
8
+ Project-URL: Issues, https://github.com/RamizMohammad/fastreact/issues
9
+ Project-URL: Portfolio, https://www.mohammadramiz.in
10
+ Project-URL: LinkedIn, https://www.linkedin.com/in/mohammad-ramiz
11
+ Project-URL: Source Code, https://github.com/RamizMohammad/fastreact
12
+ Keywords: fastapi,react,fullstack,vite,uvicorn,flask,spa,single-page-app,python,javascript
13
+ Classifier: Development Status :: 3 - Alpha
14
+ Classifier: Framework :: FastAPI
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Internet :: WWW/HTTP
23
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
24
+ Requires-Python: >=3.9
25
+ Description-Content-Type: text/markdown
26
+ Requires-Dist: fastapi>=0.100.0
27
+ Requires-Dist: uvicorn>=0.23.0
28
+ Requires-Dist: httpx>=0.24.0
29
+ Provides-Extra: flask
30
+ Requires-Dist: flask>=2.3.0; extra == "flask"
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=7.0; extra == "dev"
33
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
34
+ Requires-Dist: httpx>=0.24.0; extra == "dev"
35
+
36
+ # ⚡ FastReact
37
+
38
+ > **FastAPI + React = One Unified Stack**
39
+ > Zero config. One server. Python tracebacks in your browser.
40
+
41
+ 📖 **[Full Usage Guide →](USAGE.md)**
42
+
43
+ ---
44
+
45
+ ## What is FastReact?
46
+
47
+ FastReact is a Python library that bridges **FastAPI** and **React** into a single seamless stack.
48
+
49
+ - 🐍 FastAPI thinks it's serving Jinja templates — it's actually serving React
50
+ - ⚡ React thinks it's a normal Vite app — it's tunneled through FastAPI
51
+ - 🔴 Python errors appear as beautiful overlays in the browser (just like React's own error screen)
52
+ - 🔒 Python is the gatekeeper — React can only visit routes you register
53
+ - 🚀 One `uvicorn` instance serves everything — in dev AND production
54
+
55
+ ---
56
+
57
+ ## Install
58
+
59
+ ```bash
60
+ # FastAPI + React
61
+ pip install fastreact
62
+
63
+ # Flask + React
64
+ pip install fastreact[flask]
65
+ ```
66
+
67
+ ---
68
+
69
+ ## Quick Start
70
+
71
+ ```bash
72
+ # 1. Scaffold React inside your FastAPI project
73
+ fastreact create frontend
74
+
75
+ # 2. Start both servers together with live request monitor
76
+ fastreact dev main:app --reload --call
77
+
78
+ # 3. Build for production
79
+ cd frontend && npm run build
80
+ uvicorn main:app --host 0.0.0.0 --port 8000
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Usage
86
+
87
+ ```python
88
+ # main.py
89
+ from fastreact import FastReact
90
+
91
+ app = FastReact()
92
+
93
+ # React page routes — /api/ prefix — browser only
94
+ # Postman/curl → 405 Not Allowed
95
+ @app.get("/api/")
96
+ def home(): pass
97
+
98
+ @app.get("/api/users")
99
+ def users_page(): pass
100
+
101
+ # Normal data routes — everyone can call
102
+ @app.get("/users")
103
+ def get_users():
104
+ return {"users": ["Alice", "Bob"]}
105
+ ```
106
+
107
+ ```bash
108
+ uvicorn main:app --reload
109
+ ```
110
+
111
+ ---
112
+
113
+ ## Flask Support
114
+
115
+ ```python
116
+ from fastreact import FlaskReact
117
+
118
+ app = FlaskReact()
119
+
120
+ @app.route("/api/users")
121
+ def users_page(): pass
122
+
123
+ @app.route("/users")
124
+ def get_users():
125
+ return {"users": ["Alice", "Bob"]}
126
+
127
+ if __name__ == "__main__":
128
+ app.run()
129
+ ```
130
+
131
+ ---
132
+
133
+ ## Routing Rules
134
+
135
+ | Route | Browser | Postman/curl |
136
+ |-------|---------|--------------|
137
+ | `/api/users` (react prefix) | ✅ React renders | ❌ 405 Not Allowed |
138
+ | `/users` (normal route) | ✅ JSON | ✅ JSON |
139
+ | `/api/unknown` (unregistered) | ❌ 404 | ❌ 404 |
140
+
141
+ ### Custom prefix
142
+
143
+ ```python
144
+ app = FastReact(react_prefix="ui") # /ui/... becomes React routes
145
+ ```
146
+
147
+ ---
148
+
149
+ ## CLI
150
+
151
+ ```
152
+ fastreact create <n> Scaffold a new React (Vite) app
153
+ fastreact dev <file:app> [opts] Start FastAPI + React dev servers together
154
+
155
+ --reload Auto-restart on file save
156
+ --port <number> Port number default: 8000
157
+ --host <address> Host address default: 127.0.0.1
158
+ --call Live HTTP request monitor
159
+ ```
160
+
161
+ ---
162
+
163
+ ## Traceback Overlay
164
+
165
+ Python errors render as a beautiful browser overlay instead of JSON:
166
+
167
+ ```
168
+ 🔴 FastAPI Traceback — AttributeError
169
+ 'NoneType' object has no attribute 'id'
170
+
171
+ File main.py, line 24, in get_user
172
+ return user.id
173
+ ^^^^^^^^^^^^^^
174
+ ```
175
+
176
+ ---
177
+
178
+ ## Roadmap
179
+
180
+ - [x] FastAPI + React unified stack
181
+ - [x] Flask + React support
182
+ - [x] CLI dev mode — one command starts everything
183
+ - [x] Live request monitor (`--call`)
184
+ - [x] Python traceback overlay in browser
185
+ - [x] Route protection — browser-only React routes
186
+ - [x] Auto path normalization
187
+ - [ ] `--globalname` — instant public URL via SSH tunnel (v0.2.0)
188
+
189
+ ---
190
+
191
+ ## Documentation
192
+
193
+ | Guide | Description |
194
+ |-------|-------------|
195
+ | [USAGE.md](USAGE.md) | Full usage guide with all examples |
196
+ | [PUBLISH.md](PUBLISH.md) | How to publish to PyPI |
197
+
198
+ ---
199
+
200
+ ## Author
201
+
202
+ **Mohammad Ramiz**
203
+ - 🌐 [mohammadramiz.in](https://www.mohammadramiz.in)
204
+ - 💼 [LinkedIn](https://www.linkedin.com/in/mohammad-ramiz)
205
+ - 🐙 [GitHub](https://github.com/RamizMohammad)
206
+
207
+ ---
208
+
209
+ ## License
210
+
211
+ MIT
@@ -0,0 +1,10 @@
1
+ fastreact/__init__.py,sha256=HCLIKryBbWsX-BWrQAhkwArK4-WrfmfXhiziDGpP-7g,432
2
+ fastreact/cli.py,sha256=MfGGGbIEAj-sNrgBuW03uCwun7jFRS9mIkChFYAHijY,22892
3
+ fastreact/core.py,sha256=hoCcnk3XrRzE8QwRItboJB8-eg546X7YoufTGEJApOA,10000
4
+ fastreact/flask_core.py,sha256=vXdLMNPAN1kf-M4kD01CaSxWAuye4SbOyfCoeDQ2vK0,6816
5
+ fastreact/utils.py,sha256=YDKkWNdouXIHoYXhK8h737P23kLQ7iRG5sYjB4zZ_mQ,6902
6
+ fastreact-0.1.0.dist-info/METADATA,sha256=y5RD_mjGq24Ql1M8BtgiZrSTmLEwpYkQwTh3V8AdNHQ,5428
7
+ fastreact-0.1.0.dist-info/WHEEL,sha256=YCfwYGOYMi5Jhw2fU4yNgwErybb2IX5PEwBKV4ZbdBo,91
8
+ fastreact-0.1.0.dist-info/entry_points.txt,sha256=AODFPG-XcE3SVqbmdC9bEOhvpm7lgSjMUb434Z_kBNA,49
9
+ fastreact-0.1.0.dist-info/top_level.txt,sha256=3GF1qKl898h0xJS7iOuP0aCagkdIkIrI-QGOinpvne0,10
10
+ fastreact-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ fastreact = fastreact.cli:main
@@ -0,0 +1 @@
1
+ fastreact