Project reference 7 min read

Code map

Find the files and domain responsible for each application workflow.

Documentation · Português · Architecture

Use this map to find the owner of a behavior before editing it. Most Django apps follow models.py for persistence, services.py for domain rules, views.py and urls.py for HTTP, and tests/ or tests.py for behavior checks. Migrations describe schema history; they are not the place to document or change current service logic.

Start here

LocationWhat it does
manage.pyDjango management entry point.
main.pyStarts the ASGI development server using the configured host and port.
scripts/gravewright_runner.pyPrepares the personal configuration/database/assets and runs the local Daphne server for Gravewright Runner.
Install Windows.batWindows installer: prepares tools, dependencies, frontend and configuration, then generates Gravewright Runner.bat for startup only.
scripts/prepare_frontend.pyPlans frontend preparation from dependency/source/output fingerprints and records verified build outputs for the batch launcher.
scripts/windows/create_shortcut.pyCreates the Windows icon shortcut through standard-library ctypes and Windows COM.
config/runner.py, config/runner_asgi.py, config/runner_urls.pyDedicated local execution profile, collected static assets and runner routes; see the Windows guide.
pyproject.toml, uv.lockPython requirements and locked dependency resolution.
config/environment.pyEnvironment loading and parsing of booleans, paths and the public origin.
config/engine.pyFeature flags and validated engine limits.
config/settings.pyInstalled apps, SQLite, sessions, templates, media and Channels configuration.
config/marketplace_apps.py, gravewright/modules/server_apps.pyVerified Django package selection, startup imports and owner-authorized activation jobs.
scripts/update_supervisor.pyCore updates and Django app activation, isolated environments, backups, migrations, restart and rollback.
config/asgi.py, config/wsgi.pyServer entry points; ASGI includes the tabletop WebSocket transport.
config/proxy.pyRestores HTTP/WebSocket schemes from one valid forwarded-proto header sent by a trusted socket peer.
config/urls.pyAggregates app HTTP routes.
config/jinja2.pyTemplate environment shared by the Jinja2 interface.
api/Supported Python extension imports, reexporting authorized domain entry points.
scripts/generate_frontend_api.pyRegenerates the browser method registry from its transport contract.

Application domains

Paths below are relative to gravewright/.

AppMain modelsRead firstRelated implementation
accounts/User, AuthAttempt, UserPreferenceservices.py, models.pyforms.py validates account input; managers.py normalizes identities; client_ip.py resolves trusted proxies; middleware.py bounds auth bodies and sets response security policy.
campaigns/Campaign, Membership, AccessCode, JoinAttempt, Onboarding, StreamerLinkservices.py, streamer.pyonboarding.py prepares first-use guidance; catalog.py describes the native ruleset; views handle invitations, membership and covers.
web/Noneinside.py, responses.pyComposes account/campaign/settings pages; iconography.py supplies template icons; jinja2/ and static/ contain shared UI.
table/LobbyStatedomain.py, views.py, services.pymedia.py uploads/serves audio and cards; events.py declares trusted change signals; dock.json and message JSON configure the table interface.
actors/Actor, Folder, Assetservices.pyViews implement sheet reads and authenticated PDF/image uploads and delivery.
pdf_system/Noneschema.pyNative PDF sheet defaults and validation; browser sheet behavior lives in static/.
tokens/Tokenservices.pyActor linkage, snapshots, movement, vision and filtered drag previews; views.py exposes state.
maps/Scene, Tile, Broadcast, SceneState, SceneObject, Folder, Receipt, MapAsset, AssetFolderservices.py, objects.py, views.pyassets.py handles the asset library; extra_objects.py, markers.py, zones.py validate specialized layers; render scheduling/prefetch helpers prioritize tiles.
journals/Journal, Folder, Access, Asset, Receipt, BoardEntryservices.py, data.py, types.pydocuments.py validates structured text and secret blocks; presentations.py manages handout tickets; views protect uploads and downloads.
chat/Message, Recipient, SendWindow, CardAttachmentservices.py, context.pycard_attachments.py captures immutable card faces; templates render stored chat/roll data.
dice/Submissionservices.py, engine.pygrammar/parser.py, compiler.py, runtime.py own native notation and evaluation; grammar documentation and deterministic fixture tests live beside them.
items/Item, Folderservices.pyPermission-filtered item documents; types() currently returns no native types.
combat/Encounterservices.py, effects.pyactive_effects.py provides effect helpers; formula_engine.py is a separate declarative formula interpreter.
cards/Deck, Card, CardAsset, DeckDefinitionservices.pyControls deck lifecycle, draws, ownership and visibility; card file routes live in table/media.py.
audio/Track, Playlist, Playbackservices.py, transport.pymetadata.py inspects audio; soundtrack.py schedules music; geometry.py calculates attenuation through walls.
compendiums/Pack, Entry, EntryAsset, ContentAccessservices.py, catalog.pygraph.py selects portable dependencies; assets.py copies/restores linked files; signals.py cleans owned files.
realtime/PresenceConnectionconsumers.py, services.py, dispatch.pyrouting.py, security.py, scene_stream.py, gm_guided_prefetch.py own sockets, origin checks and viewport scheduling.
administration/HostSettings, Snapshot, AuditEventviews.py, archives.py, preferences.pyupdates.py discovers source releases; release_metadata.py validates/fetches release metadata.
modules/Package/catalog statepackages.py, operations.py, contracts/Extension installation, marketplace and transport contracts; inspect this app when changing package capabilities or generated API declarations.

Following a feature through the code

A character sheet save

  1. Browser/API submits actors.command with action sheet.save.

  2. realtime/consumers.py or api.actors.command reaches actors/services.py:command.

  3. The command locks the campaign, reloads membership and checks its receipt.

  4. save_sheet() resolves actor versus token snapshot, checks revisions and calls pdf_system/schema.py:normalize.

  5. The service saves data/revisions and calls realtime/dispatch.py:changed.

  6. Committed actor/token/layer invalidations cause each subscribed socket to read its own authorized state.

A map viewport update

  1. The socket receives scene.viewport.

  2. scene_stream.py:resolve checks scene access, LOD, coordinates, generation and configured viewport bounds.

  3. SceneStreamMixin feeds maps/render_scheduler.py and, when appropriate, exchanges GM samples through Channels.

  4. The consumer emits tile-ready/prefetch hints. The browser downloads raster bytes from the authenticated tile route in maps/views.py.

A new chat roll

  1. realtime/consumers.py:roll validates the payload and asks dice/services.py for a durable claim.

  2. dice/engine.py:evaluate parses, compiles and executes the expression outside the database executor. A replay skips evaluation.

  3. dice/services.py:complete rechecks membership/session and commits the message.

  4. realtime/dispatch.py:message publishes committed data; each receiver checks current authorization, scene and audience before delivery.

A reusable content import

  1. compendiums/services.py checks pack visibility, command permission and system.

  2. Bundled entries pass through administration/archives.py:import_campaign.

  3. The importer validates the manifest and allowlisted graph, rewrites resource/file references and merges into the destination campaign.

  4. table/domain.py records the command result and schedules dependent state refreshes after commit.

Where a contributor should make a change

ChangeLikely ownerReview alongside it
Campaign or resource permissionOwning service, often journals.services.member or maps.services.sceneHTTP file views, socket delivery projections, streamer checks and retries.
New resource commandOwning services.py and command transport contractValidation, request identity, revisions, dispatch, Python API and browser wrapper generation.
New database field/modelOwning models.py and a new migrationProjections, defaults, import/export graph and test fixtures.
New scene objectmaps/objects.py or a specialized helperRecipient filtering, version checks, token/vision/audio interactions and renderer support.
Dice notationdice/grammar/Compiler bounds, runtime facts, stored result compatibility and deterministic fixtures.
New upload formatOwning upload view and format inspectorFile ownership, authenticated download, cleanup on failure and archive extension allowlist.
Shared table UItable/jinja2/, table/static/, table/dock.jsonBrowser state/API contract and corresponding server capabilities.
Host settingconfig/engine.py or administration/preferences.pyEnvironment validation, UI exposure, docs and feature-gated behavior.
Extension/package behaviormodules/ and api/Installed manifest contracts, supported imports, license notice and transport generation.

Reading and documentation conventions

Code docstrings use English, matching the primary documentation. They explain the boundary or invariant rather than repeat assignments. Public entry-point docstrings are available through Python's help(); domain rules and cross-file interactions are explained in Architecture.

Names such as who usually mean a freshly resolved Membership; campaign/user parameters in public services may be IDs, while internal helpers accept model instances. Read the signature and caller before passing a value. Similarly, table.domain.module() selects one of five built-in resource services; it is not the installer for third-party packages under gravewright/modules/.

Keep English and Portuguese guides in sync when changing behavior. Preserve upstream license/comments in vendored assets and avoid editing generated frontend wrappers directly. See Development and Testing for the contributor workflow.