Most developers assume you need React, Next.js, or Vue for modern web apps.
But what if you could build a full-stack app using just Python?
In this post, Iβll show you how to build a real web app using Reflex β a framework that lets you create frontend + backend entirely in Python.
π§ What Youβll Build
Weβll create a simple Task Manager App with:
- Add tasks
- Delete tasks
- Reactive UI (auto updates)
- Clean component-based structure
βοΈ Setup
First, install Reflex:
pip install reflex
Create a new project:
reflex init task_app
cd task_app
reflex run
π Project Structure (Simplified)
task_app/
βββ task_app/
β βββ state.py
β βββ pages/
β β βββ index.py
β βββ components/
π§© Step 1: Create State (Backend Logic)
import reflex as rx
class State(rx.State):
tasks: list[str] = []
def add_task(self, task: str):
if task:
self.tasks.append(task)
def remove_task(self, task: str):
self.tasks.remove(task)
π This is your backend + state management in one place.
π¨ Step 2: Build UI (Frontend in Python)
import reflex as rx
from task_app.state import State
def index():
return rx.container(
rx.heading("Task Manager", size="lg"),
rx.input(
placeholder="Enter a task...",
on_blur=State.add_task
),
rx.foreach(
State.tasks,
lambda task: rx.hstack(
rx.text(task),
rx.button(
"Delete",
on_click=lambda: State.remove_task(task)
)
)
)
)
π₯ Step 3: Run the App
reflex run
Open your browser β
You now have a fully working web app π
π‘ Why This Is Interesting
- π One language (Python) for everything
- β‘ Reactive UI without writing JavaScript
- π§± Component-based design
- π Faster prototyping for startups
β οΈ When NOT to Use This
Be realistic:
- Large-scale frontend apps β still better with React/Next.js
- Highly custom UI/animations β JS ecosystem is stronger
π§ͺ Bonus: Improve the App
Try extending it:
- β Add persistence (SQLite / Postgres)
- π Add authentication
- π Deploy it (Railway, Vercel backend, etc.)
π§ Final Thoughts
Frameworks like Reflex are changing how we think about web development.
For:
- indie hackers
- MVP builders
- AI startup founders
This can be a huge speed advantage.
π What do you think?
Would you build a full-stack app using only Python?
Let me know in the comments π
Top comments (0)