flaskr-tdd: the official Flask tutorial app, rebuilt test-first and pinned to Python 3.12.0
Flaskr: Intro to Flask, Test-Driven Development (TDD), and JavaScript
At a glance
- What is it?
- mjhea0/flaskr-tdd turns the Flaskr mini-blog from the Flask tutorial into a pytest-driven walkthrough that ends with JavaScript, SQLAlchemy, a search page and a Heroku Postgres deployment. This article covers the pinned stack, the order of the chapters and the cost of a tutorial last revised in October 2023.
- Who is it for?
- Pick flaskr-tdd if you know basic HTTP and want to see one small Flask app grown test-first with pytest, then moved to SQLAlchemy and Postgres. Skip it if you need current dependency versions, because everything is pinned to the October 2023 stack and the last push was on 13 April 2026.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Activity is slowing. The repository last received commits 7 months ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 25, 2026, and from our analysis. They are not legal advice.
Star history
- mjhea0/flaskr-tdd2,337 ★ · -7
| Repository | 2026-10-11 | 2026-11-25 |
|---|---|---|
| mjhea0/flaskr-tdd | 2.3k | 2.3k |
-7 Stars in the last 45 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
The tutorial starts with a failing test for a hello world route
The first coding step is a test, not a route. After creating `project/__init__.py`, `project/app.py` and `tests/app_test.py`, you install pytest and write `test_index` in `tests/app_test.py`. It builds a client with `app.test_client()`, requests `/`, and asserts a status code of 200 and a body of `b"Hello, World!"`. The route that satisfies it comes after.
This follows the Red-Green-Refactor cycle that the README spells out in four steps: write a test, run it and watch it fail, write just enough code to pass, then refactor and retest. The README also claims that TDD indirectly evolves the design of the project, which is the author's argument. The practical effect for a reader is that every later chapter, from the database to login, starts from a test you can run.
Python 3.12.0 and Flask 3.0.0 are pinned in requirements.txt
The requirements are exact: Python 3.12.0, Flask 3.0.0, Flask-SQLAlchemy 3.1.1, Gunicorn 21.2.0, Psycopg2 2.9.9, Flake8 6.1.0, Black 23.10.0 and pytest 7.4.2. In `requirements.txt` the database driver is `psycopg2-binary==2.9.9`, which differs slightly from the plain Psycopg2 name in the README list.
Setup uses venv:
$ python3.12 -m venv env
$ source env/bin/activate
(env)$Flask is then installed with `pip install flask==3.0.0`, and pytest with `pip install pytest==7.4.2`. The README tells you to always use a virtual environment and says Poetry or Pipenv can replace virtualenv and pip. The pins are a strength for reproducing the tutorial and a cost for anyone on a newer Python or Flask, because the README does not test or mention any version above these.
Seventeen chapters grow one app from routes to Heroku Postgres
The table of contents runs in a fixed order: Download Python, Project Setup, First Test, Flaskr Setup, Second Test, Database Setup, Templates and Views, Add Some Style, JavaScript, Deployment, Bootstrap, SQLAlchemy, Search Page, Login Required, Postgres Heroku, and Linting and Code Formatting.
The order matters. The app first uses a database setup and plain views, then gets Bootstrap and JavaScript, then deployment, and only afterwards switches to SQLAlchemy and adds search and login-required behavior. Someone who wants only the SQLAlchemy part still has to read the earlier chapters, because the README presents them as one continuous build. The top-level `create_db.py` and a committed `test.db` hint at the database stage of that build, but the README text available here is cut off before the database chapters, so the exact schema is not described.
The tutorial assumes you already know GET, POST, requests and rendering
The README opens by listing three concepts a complete beginner must grasp first: the difference between HTTP GET and POST requests and how the app's functions handle each, what HTTP requests and responses are, and how HTML pages are rendered and returned to the end user. None of these is taught inside the tutorial.
The author says the project is the next step after the official Flask tutorial, and that he has gone through that tutorial more times than he cares to admit. So flaskr-tdd is a sequel and not a first Flask lesson. A reader with no web background will hit the first route and have no explanation of why `tester.get("/", content_type="html/text")` returns what it does. The pointer to the official Flask tutorial is the only on-ramp the README offers.
The changelog shows the stack was rewritten many times, and then stopped in October 2023
The changelog goes back to November 2013 and records a long chain of changes. Python moved from 3.5.1 in January 2016 through 3.6, 3.7, 3.8, 3.9 and 3.10.4 to 3.12.0 on 17 October 2023. jQuery was replaced with vanilla JavaScript in November 2019, Bootstrap 4 arrived in October 2017, and `app.test.py` was renamed to `app_test.py` in October 2020 to fix issue 58. Pytest was added, `os.path` was migrated to `pathlib`, and a search feature came in October 2017.
The README states that the tutorial was last updated on 17 October 2023. The repository was last pushed on 13 April 2026, more than six months ago, and it has no GitHub releases, so the project cannot be called actively maintained. Treat the 2023 pins as the supported state and test any newer version yourself.
Postgres on Heroku is the production target, and the Procfile points there
The repository root holds a `Procfile`, a `runtime.txt` and a `requirements.txt` with Gunicorn and the Postgres driver, which together are what a Heroku-style deployment reads. The 2019 changelog entry says Postgres was used in production from then on, and the table of contents ends with a Postgres Heroku chapter before the linting chapter.
Two limits follow. The README text here does not show the deployment commands, so none of them can be quoted. Hosting terms change over time, and the README does not say whether the Heroku steps still work as written. If you want to deploy elsewhere, the Gunicorn and psycopg2-binary pins are the portable part, and the Procfile is the part you would replace.
Black and Flake8 close the tutorial, and the repository carries a TestDriven.io pitch
The last chapter covers linting and code formatting with Flake8 6.1.0 and Black 23.10.0, both of which are pinned in `requirements.txt` next to pytest. They were added in the November 2019 revision. The repository also has a `.github/` folder, though the README does not describe what runs there.
A quoted block in the README says the project is powered by TestDriven.io and asks readers to buy one of its Flask courses, which teach Docker, Flask and React microservices. The tutorial itself is MIT licensed. If you copy the code into your own project, the license allows it. The sales pitch is a reminder that this is a marketing-adjacent tutorial, so check where the course material starts and the free tutorial ends.
Editorial conclusion
Pick flaskr-tdd if you know basic HTTP and want to see one small Flask app grown test-first with pytest, then moved to SQLAlchemy and Postgres. Skip it if you need current dependency versions, because everything is pinned to the October 2023 stack and the last push was on 13 April 2026. Before starting, decide whether you will follow the pins exactly (Python 3.12.0, Flask 3.0.0) or upgrade as you go, since the README gives no guidance for newer releases.
Frequently asked questions
Is TDD still relevant in 2026, according to flaskr-tdd?
The README does not argue relevance for any year. It teaches the Red-Green-Refactor cycle on a Flask app and was last updated for Python 3.12.0 and Flask 3.0.0 in October 2023.
What is the Flask framework in Python, as used in flaskr-tdd?
The tutorial builds Flaskr, a mini-blog app from the official Flask tutorial, with Flask 3.0.0, Flask-SQLAlchemy 3.1.1 and pytest 7.4.2. It does not define Flask beyond that, so beginners should read the official tutorial first.
What is TDD vs BDD, and does flaskr-tdd cover BDD?
The README defines TDD as an iterative cycle of writing tests before the feature code, following Red-Green-Refactor. It does not mention BDD or compare the two.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/mjhea0-flaskr-tdd)Star history chart for your README
[](https://hysenlabs.com/projects/mjhea0-flaskr-tdd)Was this useful?