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
|
|
|
|
framework](https://docs.djangoproject.com/en/1.8/), so a lot of these
|
|
|
|
paths will be familiar to Django developers.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2017-01-05 23:23:16 +01:00
|
|
|
* `zproject/urls.py` Main
|
|
|
|
[Django routes file](https://docs.djangoproject.com/en/1.8/topics/http/urls/).
|
|
|
|
Defines which URLs are handled by which view functions or templates.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2017-01-05 23:23:16 +01:00
|
|
|
* `zerver/models.py` Main
|
|
|
|
[Django models](https://docs.djangoproject.com/en/1.8/topics/db/models/)
|
|
|
|
file. Defines Zulip's database tables.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2020-05-13 18:06:17 +02:00
|
|
|
* `zerver/lib/*.py` Most library code.
|
|
|
|
|
|
|
|
* `zerver/lib/actions.py` Most code doing writes to user-facing
|
|
|
|
database tables lives here. In particular, we have a policy that
|
|
|
|
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
|
|
|
|
|
|
|
* `zerver/views/*.py` Most [Django views](https://docs.djangoproject.com/en/1.8/topics/http/views/).
|
|
|
|
|
2018-05-31 01:56:18 +02:00
|
|
|
* `zerver/webhooks/` Webhook views and tests for [Zulip's incoming webhook integrations](
|
2020-06-08 23:04:39 +02:00
|
|
|
https://zulip.com/api/incoming-webhooks-overview).
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2016-11-27 06:50:54 +01:00
|
|
|
* `zerver/tornado/views.py` Tornado views.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2019-09-30 19:37:56 +02:00
|
|
|
* `zerver/worker/queue_processors.py` [Queue workers](../subsystems/queuing.md).
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2020-06-25 15:00:33 +02:00
|
|
|
* `zerver/lib/markdown/` [Backend Markdown processor](../subsystems/markdown.md).
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2016-07-27 04:00:29 +02:00
|
|
|
* `zproject/backends.py` [Authentication backends](https://docs.djangoproject.com/en/1.8/topics/auth/customizing/).
|
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
|
|
|
|
2017-01-05 23:23:16 +01: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
|
|
|
|
2020-03-21 18:17:19 +01:00
|
|
|
* `static/templates/` [Handlebars](https://handlebarsjs.com/) templates for the frontend.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
|
|
|
----------------------------------------
|
|
|
|
|
2019-03-28 20:55:05 +01:00
|
|
|
### JavaScript, TypeScript, and other static assets
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2019-03-28 20:55:05 +01:00
|
|
|
* `static/js/` Zulip's own JavaScript and TypeScript sources.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
|
|
|
* `static/styles/` Zulip's own CSS.
|
|
|
|
|
|
|
|
* `static/images/` Zulip's images.
|
|
|
|
|
2016-07-13 04:22:21 +02:00
|
|
|
* `static/third/` Third-party JavaScript and CSS that has been vendored.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2017-07-27 23:22:52 +02:00
|
|
|
* `node_modules/` Third-party JavaScript installed via `yarn`.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2016-08-26 05:06:07 +02:00
|
|
|
* `static/assets/` For assets not to be served to the web (e.g. the system to
|
|
|
|
generate our favicons).
|
2016-06-22 19:59:20 +02:00
|
|
|
|
|
|
|
-----------------------------------------------------------------------
|
|
|
|
|
|
|
|
### Tests
|
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
* `zerver/tests/` Backend tests.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
* `frontend_tests/node_tests/` Node Frontend unit tests.
|
2016-06-22 19:59:20 +02:00
|
|
|
|
2020-08-31 00:10:57 +02:00
|
|
|
* `frontend_tests/puppeteer_tests/` Puppeteer frontend integration tests.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
|
|
|
* `tools/test-*` Developer-facing test runner scripts.
|
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).
|
|
|
|
|
2017-07-28 03:00:53 +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
|
|
|
|
2020-05-13 18:08:25 +02:00
|
|
|
* `zilencer/management/commands/` includes some dev-specific
|
|
|
|
commands such as `populate_db`, which are not included in
|
|
|
|
the production distribution.
|
|
|
|
|
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
|
|
|
|
|
|
|
* `scripts/` Scripts that production deployments might run manually
|
|
|
|
(e.g., `restart-server`).
|
|
|
|
|
|
|
|
* `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
|
|
|
|
2016-06-22 19:56:23 +02:00
|
|
|
* `scripts/setup/` Scripts that production deployments will only run
|
2016-05-15 18:28:38 +02:00
|
|
|
once, during installation.
|
|
|
|
|
2016-06-22 19:56:23 +02:00
|
|
|
* `tools/` Scripts used only in a Zulip development environment.
|
|
|
|
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).
|
|
|
|
|
|
|
|
* `tools/setup/` Subdirectory of `tools/` for things only used during
|
|
|
|
the development environment setup process.
|
|
|
|
|
2018-12-10 08:05:16 +01:00
|
|
|
* `tools/ci/` Subdirectory of `tools/` for things only used to
|
2020-08-11 01:47:54 +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
|
|
|
|
|
|
|
---------------------------------------------------------
|
|
|
|
|
2020-08-11 01:47:54 +02:00
|
|
|
### API and bots
|
2016-06-22 20:26:34 +02:00
|
|
|
|
2017-08-01 01:25:10 +02:00
|
|
|
* See the [Zulip API repository](https://github.com/zulip/python-zulip-api).
|
|
|
|
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
|
|
|
|
2017-08-01 01:25:10 +02:00
|
|
|
* `templates/zerver/integrations/` (within `templates/zerver/`, above).
|
|
|
|
Documentation for these integrations.
|
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.
|
|
|
|
|
|
|
|
* `puppet/zulip/` For configuration for production deployments.
|
|
|
|
|
2020-10-20 03:49:23 +02:00
|
|
|
* `puppet/zulip/manifests/profile/standalone.pp` Main manifest for Zulip standalone deployments.
|
2016-06-22 20:26:34 +02:00
|
|
|
|
|
|
|
-----------------------------------------------------------------------
|
|
|
|
|
|
|
|
### Additional Django apps
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
* `confirmation` Email confirmation system.
|
|
|
|
|
2016-07-27 04:00:29 +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).
|
|
|
|
|
|
|
|
* `corporate` The old Zulip.com website. Not included in production
|
|
|
|
distribution.
|
|
|
|
|
|
|
|
* `zilencer` Primarily used to hold management commands that aren't
|
|
|
|
used in production. Not included in production distribution.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 19:59:20 +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
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
* `zproject/jinja2/__init__.py` Jinja2 environment.
|
2016-05-15 18:28:38 +02:00
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
-----------------------------------------------------------------------
|
|
|
|
|
|
|
|
### Translation files
|
|
|
|
|
2019-07-02 22:38:09 +02:00
|
|
|
* `locale/` Backend (Django) and frontend translation data files.
|
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
|
|
|
|
2016-06-22 20:26:34 +02:00
|
|
|
* `docs/` Source for this documentation.
|
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`).
|