Messages

Messages is the all-in-one collaborative inbox for La Suite territoriale.

It is built on top of Django Rest Framework and Next.js.

Getting started

Prerequisite

Make sure you have a recent version of Docker and Docker Compose installed on your machine:

$ docker -v
  Docker version 27.5.1, build 9f9e405

$ docker compose version
  Docker Compose version v2.32.4

⚠️ You may need to run the following commands with sudo but this can be avoided by assigning your user to the docker group.

Bootstrap project

The easiest way to start working on the project is to use GNU Make:

$ make bootstrap

This command builds the backend-dev container, installs dependencies, performs database migrations and compile translations. It's a good idea to use this command each time you are pulling code from the project repository to avoid dependency-related or migration-related issues.

Your Docker services should now be up and running! 🎉

Note that if you need to run them afterward, you can use the eponym Make rule:

$ make run

You can check all available Make rules using:

$ make help

Django admin

You can access the Django admin site at http://localhost:8071/admin.

You first need to create a superuser account:

$ make superuser

You can then login with email admin@example.com and password admin.

Run frontend

Run the front with:

$ make run-with-frontend

Then access http://localhost:3000 with : user: user{1,2,3} password: user{1,2,3}

OpenAPI client

The frontend API client is generated with Orval. It consumes the OpenAPI schema generated from the backend through drf-spectacular.

The JSON OpenAPI schema is located in src/backend/core/api/openapi.json.

To update the schema then the frontend API client, run:

$ make api-update

You can also generate the schema only with:

$ make backend-api-update

And the frontend API client only with:

$ make frontend-api-update

Sending test emails

There are a couple ways of testing the email infrastructure locally.

These examples use swaks, a simple command-line SMTP client.

# First, make sure services are running
make run

# Send a test message to the MTA-out, which will then relay it to mailcatcher. Read it on http://localhost:1081/
swaks -tls --to=test@example.com --server 127.0.0.1:8587 --auth-user testuser --auth-password=testpass

# Send a test message to the MTA-in, which will relay it to the Django MDA.
# The domain must be MESSAGES_TESTDOMAIN if you want the mailbox created automatically.
# You can then read it on the frontend on http://localhost:3000/ (login as user1/user1) and reply to it there.
# The replies will then be sent through the MTA-out to the mailcatcher on http://localhost:1081/
swaks --to=user1@example.local --server 127.0.0.1:8025

Contributing

This project is intended to be community-driven, so please, do not hesitate to get in touch if you have any question related to our implementation or design decisions.

License

This work is released under the MIT License (see LICENSE).

S
Description
No description provided
Readme MIT
86 MiB
Languages
Python 58.4%
TypeScript 25.8%
JavaScript 9.7%
SCSS 2.9%
CSS 1.8%
Other 1.4%