Project Directory Guide¶
This document explains the purpose of the main directories in the project.
The project follows a Domain-Driven Development approach. The domain logic is kept separate from technical integrations such as Discord, CI/CD, containers, and development tooling.
Directory Overview¶
.
├── assets
│ └── images
├── ci
│ └── includes
├── containers
├── dev
│ ├── patches
│ └── profiles
├── docs
│ ├── architecture
│ ├── classes
│ ├── constants
│ └── modules
├── sources
│ ├── bot
│ ├── discord_api
│ ├── domain
│ ├── ressources
│ └── shared
├── tests
│ ├── integration
│ ├── standalone
│ └── unit
└── tools
assets¶
The assets directory contains static assets used by the project.
assets/images¶
The images directory contains image files used by the documentation, README files, architecture diagrams, screenshots, logos, or other visual material related to the project.
This directory should not contain application logic.
ci¶
The ci directory contains CI/CD-related files.
ci/includes¶
The includes directory contains reusable GitLab CI configuration fragments.
This keeps the main .gitlab-ci.yml file easier to read and maintain by splitting the pipeline into focused parts such as linting, tests, SonarQube analysis, Dependency-Track integration, SBOM generation, and package publication.
containers¶
The containers directory contains container-related files.
It may include Dockerfiles, Compose files, or container definitions used by the development environment, CI jobs, integration tests, or local tooling.
This directory helps provide reproducible environments for both contributors and automation.
dev¶
The dev directory contains development-specific code and configuration.
It is used to run the project in development mode with:
python -m dev
This command executes the __main__.py file from the dev package.
The development mode runs the production code with other GameSettings (short phases, test accounts, forced roles...), built from a profile. It never patches the production code: everything it changes is a setting the production code accepts.
dev/profile.py¶
Loads a profile: local.json, then the extends chain, then the profile itself, merged and validated against profiles/schema.json, then turned into GameSettings.
dev/profiles¶
The profiles directory contains the development profiles (default, hourly, prod-like...), the JSON schema they follow, and local.json, your own IDs (server, developer, test accounts), ignored by git. The Discord token is not in the profiles, it comes from .env.
docs¶
The docs directory contains the technical documentation, built by Zensical (zensical.toml) and published under https://garulf-dev.hwlann.fr/bot/ (documentation of the last release; see CI). Preview it locally with zensical serve.
The player documentation (role rules, guides) lives in its own project, garulf-guide, published on https://garulf.hwlann.fr/. The bot links each role name to its page there (sources/shared/docs_links.py): keep the page names of both projects in sync.
docs/architecture¶
The architecture directory contains documentation about the architecture of the project.
This is the place to explain the Domain-Driven Development approach, the separation between domain logic and technical integrations, the runtime flow, and the relationship between the main packages.
docs/classes¶
The classes directory contains documentation related to important classes.
It can be used for generated or manually written class documentation, including responsibilities, relationships, and usage examples.
docs/constants¶
The constants directory contains documentation related to project constants.
This may include runtime constants, configuration values, domain constants, Discord-related constants, or development-specific constants.
docs/modules¶
The modules directory contains documentation for the main project modules.
It can be used to describe the responsibilities of packages such as bot, discord_api, domain, and shared.
sources¶
The sources directory contains the main application code.
The project is organized to keep domain rules independent from external systems. Technical integrations, runtime behavior, and application orchestration are placed around the domain instead of inside it.
sources/domain¶
The domain package contains the core business logic of the project.
In a Domain-Driven Development approach, this package should contain the concepts and rules of the Werewolf game itself, such as roles, teams, tags, domain models, value objects, domain services, invariants, and domain-specific errors.
The domain layer should stay as independent as possible from technical details. It should not directly depend on Discord, the bot runtime, CI tooling, containers, or external APIs.
Main sub-packages:
enums: roles, teams, tags, phases, actions, statesmodels: players, characters, lobby, session, game statevalues: immutable results and events (results,events,vote)factories: character creation and transformationgame: the game engine, role dispatcher and vote urnrules: time rules and win conditionsroles: role composition — the declarative catalog (catalog.py, mapping eachRoleto aRoleSpec), role specs, game profiles, and the distribution engine with its constraints and validator
sources/bot¶
The bot package contains the game orchestration layer.
It coordinates use cases (game lifecycle and its scheduler, phases, cache, registry) by using the domain model, and exposes the controller that the Discord layer calls. It also holds the runtime entry point (python -m sources.bot).
sources/discord_api¶
The discord_api package contains the technical integration with Discord.
It should isolate Discord-specific API calls, adapters, helpers, and protocol details from the rest of the application.
Main sub-packages:
client.py,cogs: Discord runtime;cogs/guild_events.pyholds the gateway event listeners,cogs/narrator_commands.pythe slash commandsviews: interactive Discord views (lobby, game, roles)gateway: outgoing adapters (messages, roles, game notifications)guild: server structure — constants, permissions, overwrites, layout, setup and integrity check, with low-levelbuildersfor categories, channels and roles
sources/shared¶
The shared package contains cross-cutting technical tools (logging, configuration) that any layer may import. It contains no game rules and no Discord code.
sources/ressources¶
The ressources package contains internal resources used by the application.
It may include templates, schemas, default data files, static configuration files, localization files, or other non-code resources required at runtime.
This directory is different from assets, which is intended for project-level visual assets such as documentation images or diagrams.
tests¶
The tests directory contains the automated test suite.
Tests are organized by scope to make it clear what kind of behavior each test validates.
tests/unit¶
The unit directory contains unit tests.
Unit tests should focus on isolated behavior, especially domain rules and core logic. They should be fast, deterministic, and should not require Discord, network access, containers, or external services.
tests/integration¶
The integration directory contains integration tests.
Integration tests validate that several parts of the application work correctly together. They may cover interactions between domain, bot, discord_api, shared, configuration loading, or other internal components.
tests/standalone¶
The standalone directory contains standalone tests or executable validation scenarios.
These tests are useful for checks that can run independently from the rest of the test suite, such as local smoke tests, manual scenarios, or development validation scripts.
tools¶
The tools directory contains project utility scripts.
These scripts support development, maintenance, CI/CD, documentation, release preparation, SBOM generation, validation, or other automation tasks.
Tools in this directory are not part of the main application runtime unless explicitly documented.