Repo map

Mastodon architecture.

Mastodon is a self-hosted, federated microblogging server. Nodeway mapped the mastodon/mastodon repository at commit b883ea2, from 27 November 2026, and found 2,934 source files, 13,511 functions, classes and components, 692 routes and 118 database tables. This page is drawn from that map.

Free to start. macOS (Apple silicon and Intel), Windows and Linux.
Source files
2,934
Functions and classes
13,511
Confirmed calls
13,111
Routes
692
Tables
118

How the code is laid out

Most of it is Ruby: 2,102 files of 2,934, followed by TypeScript (684), JavaScript (146) and Shell (2).

These are its top-level folders by number of source files, with 5 more files at the root. The biggest ones show their own largest folders underneath.

  • app/2,105 files22 routes · 118 tables
  • javascript/806 files22 routes
  • controllers/355 files
  • models/265 files118 tables
  • lib/159 files
  • serializers/149 files
  • workers/123 files
  • db/642 files
  • migrate/553 files
  • post_migrate/82 files
  • seeds/5 files
  • lib/86 files
  • mastodon/33 files
  • tasks/12 files
  • paperclip/11 files
  • config/80 files666 routes
  • initializers/61 files
  • routes/5 files553 routes
  • vite/4 files
  • streaming/package9 files4 routes
  • .storybook/4 files
  • bin/2 files
  • public/1 file

Where the code starts

Nodeway looked for files that define a main function, and for files named like a starting point (main, server, app, cli and similar) that at most one other file imports, then for index files that nothing imports. Ranked that way, then by how many files each one reaches through its imports:

FileReaches
app/javascript/entrypoints/application.ts446 files
app/javascript/mastodon/main.tsxdefines main445 files
lib/mastodon/cli/main.rb52 files
config/application.rb32 files
app/javascript/mastodon/reducers/server.ts26 files
streaming/index.js6 files

Routes

Nodeway found 692 routes and linked 586 to the function that handles them. They by HTTP method: GET 345, POST 210, DELETE 72, PUT 63, PATCH 2. Most are under config/routes (553), config (113) and app/javascript (22).

Some of them

RouteMethod
/inboxcreate · config/routes.rbPOST
/metricssetupMetrics · streaming/index.jsGET
/admin/tagsindex · config/routes/admin.rbGET
/api/v1/appscreate · config/routes/api.rbPOST
/api/v2/mediauploadCompose · app/javascript/mastodon/actions/compose.jsPOST
/api/v2/filterscreateFilter · app/javascript/mastodon/actions/filters.jsPOST
/api/v1/markerssubmitMarkersAction · app/javascript/mastodon/actions/markers.tsPOST
/api/v1/reportssubmitReport · app/javascript/mastodon/actions/reports.jsPOST

Data model

Nodeway found 118 database tables, defined with Active Record. Code in the repository reads or writes 103 of them. The most used:

TableUsed by
accounts56 columns · app/models/account.rb137 read4 write
statuses28 columns · links to accounts, conversations and polls · app/models/status.rb73 read2 write
users36 columns · links to accounts, invites and user_roles · app/models/user.rb35 read1 write
follows9 columns · links to accounts · app/models/follow.rb25 read0 write
tags13 columns · app/models/tag.rb17 read0 write
follow_requests9 columns · links to accounts · app/models/follow_request.rb15 read2 write
user_roles10 columns · app/models/user_role.rb14 read1 write
preview_cards30 columns · links to accounts · app/models/preview_card.rb13 read1 write

One request, traced

Nodeway followed GET /media_proxy/:id/(*any) from its route to the code that handles it, then along confirmed calls until it reached the accounts table.

  1. GET /media_proxy/:id/(*any)route · config/routes.rb
  2. showmethod · app/controllers/media_proxy_controller.rb:17
  3. with_redis_lockmethod · app/models/concerns/lockable.rb:8
  4. with_redismethod · app/models/concerns/redisable.rb:8
  5. blockmethod · app/controllers/api/v1/accounts_controller.rb:57
  6. accountmethod · app/controllers/api/v1/follow_requests_controller.rb:27
  7. accountstable · read here

The most-called code

Ranked by how many different functions call each one, counting only calls the analyzer could confirm from the code. These are often the helpers worth reading first.

FunctionCallers
tmethod · app/serializers/rest/admin/server_check_serializer.rb211
rolemethod · app/policies/application_policy.rb145
redismethod · app/models/concerns/redisable.rb125
log_actionmethod · app/controllers/concerns/accountable_concern.rb107
accountmethod · app/models/severed_relationship.rb103
apifunction · app/javascript/mastodon/api.ts96
recordmethod · app/lib/activity_tracker.rb88
idmethod · app/models/async_refresh.rb88

Open this repo in Nodeway

Nodeway is a desktop app that draws this map on your own computer, so you can click into any folder, read the code beside the map and trace a request yourself. Clone the repository:

git clone https://github.com/mastodon/mastodon.git
  • Install Nodeway for macOS, Windows or Linux: the getting started guide has every installer.
  • Open the cloned folder. The first map is drawn on your machine and nothing is uploaded.
  • Search for t and trace what it calls, or pick a route and follow it to the database.

New to reading a codebase this size? See how to understand a large codebase and how to read a call graph.

Questions

What language is Mastodon written in?

Mostly Ruby: 2,102 of its 2,934 source files at commit b883ea2, then TypeScript with 684.

Where does the Mastodon code start?

The entry point that reaches the most code is app/javascript/entrypoints/application.ts, which leads to 446 files through its imports.

How many routes does Mastodon have?

Nodeway found 692 routes, 586 of them linked to a handler. The most are under config/routes.

What database tables does Mastodon use?

118 tables, defined with Active Record. The most used are accounts, statuses and users.

How this page was made

Generated from a map Nodeway's analyzer (version 18) made of mastodon/mastodon at commit b883ea2, committed on 27 November 2026. Tests, dependencies and build output are mostly left out. A call counts only when the analyzer could confirm its target from the code, so real totals are higher. The project will have changed since.

More codebases, mapped

All repo maps

See your whole codebase in minutes.

Open a folder and Nodeway maps it on your own computer. No account, and nothing is uploaded.

More guides