2016-06-22 19:58:16 +02:00
|
|
|
# Directory structure
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
This page documents the Zulip directory structure, where to find
|
|
|
|
things, and how to decide where to put a file.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
You may also find the [new application feature
|
2019-09-30 19:37:56 +02:00
|
|
|
tutorial](../tutorials/new-feature-tutorial.md) helpful for understanding the
|
2016-06-28 05:54:18 +02:00
|
|
|
flow through these files.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
### Core Python files
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
Zulip uses the [Django web
|
2021-11-05 20:09:57 +01:00
|
|
|
framework](https://docs.djangoproject.com/en/3.2/), so a lot of these
|
2016-06-22 20:26:34 +02:00
|
|
|
paths will be familiar to Django developers.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `zproject/urls.py` Main
|
2021-11-05 20:09:57 +01:00
|
|
|
[Django routes file](https://docs.djangoproject.com/en/3.2/topics/http/urls/).
|
2017-01-05 23:23:16 +01:00
|
|
|
Defines which URLs are handled by which view functions or templates.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2023-12-05 19:29:58 +01:00
|
|
|
- `zerver/models/*.py`
|
2021-11-05 20:09:57 +01:00
|
|
|
[Django models](https://docs.djangoproject.com/en/3.2/topics/db/models/)
|
2023-12-05 19:29:58 +01:00
|
|
|
files. Defines Zulip's database tables.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `zerver/lib/*.py` Most library code.
|
2020-05-13 18:06:17 +02:00
|
|
|
|
2022-04-14 00:48:36 +02:00
|
|
|
- `zerver/actions/*.py` Most code doing writes to user-facing
|
2021-08-20 21:53:28 +02:00
|
|
|
database tables lives here. In particular, we have a policy that
|
2020-05-13 18:06:17 +02:00
|
|
|
all code calling `send_event` to trigger [pushing data to
|
|
|
|
clients](../subsystems/events-system.md) must live here.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2021-11-05 20:09:57 +01:00
|
|
|
- `zerver/views/*.py` Most [Django views](https://docs.djangoproject.com/en/3.2/topics/http/views/).
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
- `zerver/webhooks/` Webhook views and tests for [Zulip's incoming webhook integrations](https://zulip.com/api/incoming-webhooks-overview).
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `zerver/tornado/views.py` Tornado views.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2024-04-16 20:49:37 +02:00
|
|
|
- `zerver/worker/` [Queue workers](../subsystems/queuing.md).
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `zerver/lib/markdown/` [Backend Markdown processor](../subsystems/markdown.md).
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2021-11-05 20:09:57 +01:00
|
|
|
- `zproject/backends.py` [Authentication backends](https://docs.djangoproject.com/en/3.2/topics/auth/customizing/).
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
---
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2020-08-11 01:47:54 +02:00
|
|
|
### HTML templates
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2019-10-17 00:42:54 +02:00
|
|
|
See [our docs](../subsystems/html-css.md) for details on Zulip's
|
2016-06-28 05:54:18 +02:00
|
|
|
templating systems.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `templates/zerver/` For [Jinja2](http://jinja.pocoo.org/) templates
|
2018-04-22 07:02:19 +02:00
|
|
|
for the backend (for zerver app; logged-in content is in `templates/zerver/app`).
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2023-02-22 23:03:47 +01:00
|
|
|
- `web/templates/` [Handlebars](https://handlebarsjs.com/) templates for the frontend.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
---
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2023-02-22 23:03:47 +01:00
|
|
|
### JavaScript, TypeScript, and other frontend assets
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2023-02-22 23:03:47 +01:00
|
|
|
- `web/src/` Zulip's own JavaScript and TypeScript sources.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2023-02-22 23:03:47 +01:00
|
|
|
- `web/styles/` Zulip's own CSS.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2023-02-22 23:03:47 +01:00
|
|
|
- `web/images/` Images bundled with webpack.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2023-02-22 23:03:47 +01:00
|
|
|
- `static/images/` Images served directly to the web.
|
|
|
|
|
|
|
|
- `web/third/` Third-party JavaScript and CSS that has been vendored.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2023-03-20 19:52:59 +01:00
|
|
|
- `node_modules/` Third-party JavaScript installed via pnpm.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2023-02-22 23:03:47 +01:00
|
|
|
- `web/shared/icons/` Icons placed in this directory are compiled
|
2022-03-22 11:00:28 +01:00
|
|
|
into an icon font.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
---
|
2016-06-22 19:59:20 +02:00
|
|
|
|
|
|
|
### Tests
|
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `zerver/tests/` Backend tests.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2023-02-22 23:04:10 +01:00
|
|
|
- `web/tests/` Node Frontend unit tests.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2023-02-22 23:04:11 +01:00
|
|
|
- `web/e2e-tests/` Puppeteer frontend integration tests.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `tools/test-*` Developer-facing test runner scripts.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
---
|
2016-06-22 19:59:20 +02:00
|
|
|
|
|
|
|
### Management commands
|
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
These are distinguished from scripts, below, by needing to run a
|
|
|
|
Django context (i.e. with database access).
|
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `zerver/management/commands/`
|
2019-09-30 19:37:56 +02:00
|
|
|
[Management commands](../subsystems/management-commands.md) one might run at a
|
2016-06-22 19:59:20 +02:00
|
|
|
production deployment site (e.g. scripts to change a value or
|
2016-06-22 20:26:34 +02:00
|
|
|
deactivate a user properly).
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `zilencer/management/commands/` includes some dev-specific
|
2021-08-20 22:54:08 +02:00
|
|
|
commands such as `populate_db`, which are not included in
|
|
|
|
the production distribution.
|
2020-05-13 18:08:25 +02:00
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
---
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2016-06-22 19:58:16 +02:00
|
|
|
### Scripts
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `scripts/` Scripts that production deployments might run manually
|
2016-05-15 18:28:38 +02:00
|
|
|
(e.g., `restart-server`).
|
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `scripts/lib/` Scripts that are needed on production deployments but
|
2016-06-22 19:56:23 +02:00
|
|
|
humans should never run directly.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `scripts/setup/` Scripts that production deployments will only run
|
2016-05-15 18:28:38 +02:00
|
|
|
once, during installation.
|
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `tools/` Scripts used only in a Zulip development environment.
|
2016-06-22 19:56:23 +02:00
|
|
|
These are not included in production release tarballs for Zulip, so
|
|
|
|
that we can include scripts here one wouldn't want someone to run in
|
|
|
|
production accidentally (e.g. things that delete the Zulip database
|
|
|
|
without prompting).
|
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `tools/setup/` Subdirectory of `tools/` for things only used during
|
2016-06-22 19:56:23 +02:00
|
|
|
the development environment setup process.
|
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `tools/ci/` Subdirectory of `tools/` for things only used to
|
2021-08-20 21:53:28 +02:00
|
|
|
set up and run our tests in CI. Actual test suites should
|
2016-06-22 19:56:23 +02:00
|
|
|
go in `tools/`.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
---
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2020-08-11 01:47:54 +02:00
|
|
|
### API and bots
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- See the [Zulip API repository](https://github.com/zulip/python-zulip-api).
|
2017-08-01 01:25:10 +02:00
|
|
|
Zulip's Python API bindings, a number of Zulip integrations and
|
|
|
|
bots, and a framework for running and testing Zulip bots, used to be
|
|
|
|
developed in the main Zulip server repo but are now in their own repo.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `templates/zerver/integrations/` (within `templates/zerver/`, above).
|
2017-08-01 01:25:10 +02:00
|
|
|
Documentation for these integrations.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
---
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2020-10-23 02:43:28 +02:00
|
|
|
### Production Puppet configuration
|
2016-06-22 20:26:34 +02:00
|
|
|
|
|
|
|
This is used to deploy essentially all configuration in production.
|
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `puppet/zulip/` For configuration for production deployments.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `puppet/zulip/manifests/profile/standalone.pp` Main manifest for Zulip standalone deployments.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
---
|
2016-06-22 20:26:34 +02:00
|
|
|
|
|
|
|
### Additional Django apps
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `confirmation` Email confirmation system.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `analytics` Analytics for the Zulip server administrator (needs work to
|
2016-06-22 20:26:34 +02:00
|
|
|
be useful to normal Zulip sites).
|
|
|
|
|
2021-08-20 21:53:28 +02:00
|
|
|
- `corporate` The old Zulip.com website. Not included in production
|
2016-06-22 20:26:34 +02:00
|
|
|
distribution.
|
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `zilencer` Primarily used to hold management commands that aren't
|
2021-08-20 21:53:28 +02:00
|
|
|
used in production. Not included in production distribution.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
---
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2020-08-11 01:47:54 +02:00
|
|
|
### Jinja2 compatibility files
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `zproject/jinja2/__init__.py` Jinja2 environment.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
---
|
2016-06-22 20:26:34 +02:00
|
|
|
|
|
|
|
### Translation files
|
|
|
|
|
2021-08-20 21:45:39 +02:00
|
|
|
- `locale/` Backend (Django) and frontend translation data files.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
---
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 19:58:16 +02:00
|
|
|
### Documentation
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
- `docs/` Source for this documentation.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2021-08-20 22:54:08 +02:00
|
|
|
---
|
2016-05-15 18:28:38 +02:00
|
|
|
|
|
|
|
You can consult the repository's `.gitattributes` file to see exactly
|
|
|
|
which components are excluded from production releases (release
|
|
|
|
tarballs are generated using `tools/build-release-tarball`).
|