ποΈ Building βTodo Proβ β My First Flask Project Using Blueprints
Based on everything I studied earlier, I wanted to build a more detailed and scalable version of a Todo application. This project is still in its early stage, but the architecture is now prepared for real features such as authentication, database integration, and service layers.
With this project, Iβm finishing my Flask learning journey β and next, I will move on to **FastAPI** to understand modern, async-friendly API development. I think comparing Flask and FastAPI side-by-side will help me understand backend architecture more clearly.
π§± 1. Project Overview
This project focuses on creating a clean, modular Flask structure using Blueprints.
What this minimal version demonstrates:
- Application Factory Pattern (
create_app()) - Clean routing separation with Blueprints
- Independent template folders per module
- URL prefix structure (e.g.,
/todos,/auth) - A scalable foundation for real features
Even though the app is simple now, the architecture is ready to grow.
π 2. Project Structure
todo_pro/
β
βββ app.py
β
βββ auth/
β βββ routes.py
β βββ templates/
β βββ auth/
β βββ login.html
β
βββ todo/
βββ routes.py
βββ templates/
βββ todo/
βββ index.html
A clean and realistic folder layout β just like real production Flask apps.
π₯οΈ 3. app.py β Application Factory + Blueprint Registration
from flask import Flask
from todo.routes import todo_bp
from auth.routes import auth_bp
def create_app():
app = Flask(__name__)
app.config['SECRET_KEY'] = "sabin_secret"
# Register Blueprints
app.register_blueprint(todo_bp, url_prefix="/todos")
app.register_blueprint(auth_bp, url_prefix="/auth")
return app
app = create_app()
if __name__ == "__main__":
app.run(debug=True)
π 4. Auth Blueprint β auth/routes.py
from flask import Blueprint, render_template
auth_bp = Blueprint("auth", __name__, template_folder="templates")
@auth_bp.route("/login")
def login():
return render_template("auth/login.html")
auth/templates/auth/login.html
<h1>Login Page</h1>
<p>Login functionality will be implemented here.</p>
π 5. Todo Blueprint β todo/routes.py
from flask import Blueprint, render_template
todo_bp = Blueprint("todo", __name__, template_folder="templates")
@todo_bp.route("/")
def index():
return render_template("todo/index.html")
todo/templates/todo/index.html
<h1>Todo Pro Home</h1>
<p>Todo Pro features will be added here.</p>
π 6. How to Run
Install dependencies:
pip install flask
Run the project:
python app.py
Open in browser:
http://127.0.0.1:5000/todos
http://127.0.0.1:5000/auth/login
π 7. What I Learned
- How to structure a real Flask application
- How Blueprints separate responsibilities
- How to prepare an app for authentication and database layers
- Why scaling requires modular architecture
- How Flask project architecture influences FastAPI later
Even a minimal setup teaches a lot when the folder structure is correct.
π 8. Future Improvements (Beginner-Friendly Tasks)
Here are simple tasks you can try if you want to extend this project:
- Add a real login system
- Add a signup page
- Connect SQLite with SQLAlchemy
- Build full CRUD for Todo items
- Add session management for logged-in users
- Add a clean UI using TailwindCSS
These are perfect next steps on the journey to becoming a full-stack developer.
Step by step, project by project β thatβs how Iβm learning backend development. Now that the Flask foundation is complete, itβs time to move on to FastAPI.
Top comments (0)