Codebase maps / pallets/flask

The Flask codebase, as a map.

Flask is a small framework: its whole source is one folder, src/flask, with a file for each job. Here is what each one does - and the whole repository as a map you can open and explore.

Explore Flask in 3D — free →pallets/flask on GitHub
The Flask repository as a map: every folder and file, grouped by package

How Flask is organized

Flask is a lightweight WSGI web application framework for Python, built on Werkzeug and Jinja. These are the parts of its repository, and what each one does.

src/flask/app.py

The Flask class - the WSGI application and the central object: "a central registry for the view functions, the URL rules, template configuration and much more."

src/flask/sansio

The parts that do no input or output, so other Flask implementations such as Quart can share them. scaffold.py holds what apps and blueprints have in common: route(), get(), post(), before_request and errorhandler.

src/flask/blueprints.py

Blueprints: "a collection of routes and other app-related functions that can be registered on a real application later."

src/flask/ctx.py

Contexts. One is pushed at the start of each request and CLI command and popped at the end; globals.py gives you current_app, g, request and session from it.

src/flask/wrappers.py

Request and Response - Werkzeug's, with a few things Flask adds, such as the matched endpoint and view arguments.

src/flask/templating.py

render_template and render_template_string, using Jinja.

src/flask/sessions.py

Sessions, stored by default in signed cookies through the itsdangerous library.

src/flask/cli.py

The flask command, built on Click: it finds your app and runs it.

Where to start reading

Open these in the live map - click a file to read it beside the map, and point at it to see what it imports.

  1. src/flask/app.py - the Flask class and how it handles a request (wsgi_app, full_dispatch_request)
  2. src/flask/sansio/scaffold.py - route() - where @app.route comes from
  3. src/flask/ctx.py - the app and request contexts
  4. src/flask/globals.py - where request, session, g and current_app come from

Good to know

Is this the official Flask repository?

Yes: github.com/pallets/flask, where Flask is developed by the Pallets team. Werkzeug and Jinja, which Flask is built on, live in their own repositories.

Is the map up to date?

The live map reads the repository when you open it, so it always shows the current code. The picture on this page was made on October 29, 2026.

Can I map my own project like this?

Yes. Paste any public GitHub link, or open a folder on your computer - your own code never leaves your device.