DEV Community

Moon Light
Moon Light

Posted on

πŸš€ Build a Full-Stack Python Web App (No JS Framework Needed)

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
Enter fullscreen mode Exit fullscreen mode

Create a new project:

reflex init task_app
cd task_app
reflex run
Enter fullscreen mode Exit fullscreen mode

πŸ“ Project Structure (Simplified)

task_app/
β”œβ”€β”€ task_app/
β”‚   β”œβ”€β”€ state.py
β”‚   β”œβ”€β”€ pages/
β”‚   β”‚   └── index.py
β”‚   └── components/
Enter fullscreen mode Exit fullscreen mode

🧩 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)
Enter fullscreen mode Exit fullscreen mode

πŸ‘‰ 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)
                )
            )
        )
    )
Enter fullscreen mode Exit fullscreen mode

πŸ”₯ Step 3: Run the App

reflex run
Enter fullscreen mode Exit fullscreen mode

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)