Zulip-shield Coverage Status FAQ-shield dev-status
Note
This software is not yet ready to be used.
sonata
A robust, performant implementation of a polyproto home server.
Important
What is the difference between this project and symfonia?
Tip
sonata is a standalone polyproto home server, taking care of all the routes and behaviors defined in the polyproto-core specification.
Symfonia is a polyproto-chat server, exclusively caring about the polyproto-chat extension and the routes and behaviors defined by it.
About
sonata is a robust, performant polyproto home server implementation built with Rust. It provides a complete implementation of the polyproto-core specification, handling all the routes and behaviors defined therein.
Development Setup (Without Nix)
Prerequisites
Before setting up the development environment, you’ll need to install the following dependencies:
- Rust: Install Rust and Cargo from https://rustup.rs
- PostgreSQL: Install PostgreSQL from https://www.postgresql.org/download
- pre-commit: Install pre-commit from https://pre-commit.com
Environment Configuration
-
Copy the example environment file:
cp .example.env .env -
Edit the
.envfile with your database credentials and configuration.
Database Setup
-
Create a PostgreSQL database for sonata:
CREATEDATABASEsonata;CREATEUSERsonataWITHPASSWORD'sonata';GRANTALLPRIVILEGESONDATABASEsonataTOsonata;ALTERDATABASEsonataOWNERTOsonata; -
The database migrations will be automatically applied when you run the application.
Building and Running
Release Builds
sonata is configured with aggressive optimizations for production releases. This significantly reduces binary size while maintaining performance.
To build sonata for release:
cargo build --release --config .cargo/release.toml
This will create an optimized executable in target/release/sonata.
For development and testing, use the standard debug build:
cargo build
Development Tools
Pre-commit Hooks
This project uses pre-commit hooks to ensure code quality. Install and set up the hooks:
pre-commit install
The hooks will automatically:
- Format rust code
- Run
clippyfor linting - Check for common issues like trailing whitespace and adding a newline at the end of files
- Prepare sqlx queries for offline mode
Development Setup (With Nix)
- Install
direnv - Add a
.envrcto the root of the project, containing the lineuse flake - Run
direnv allowif you trust the contents of/flake.nix - Start a development database by using the db script: Run
dbin your bash compatible shell for information.
Configuration
sonata uses a TOML configuration file (sonata.toml) for its settings. The configuration includes:
- API settings: Port, host, and TLS configuration for the API server
- Gateway settings: Port, host, and TLS configuration for the gateway server
- Database settings: Connection parameters for PostgreSQL
- Logging: Log level configuration
See sonata.toml for the default configuration and available options.
License
This project is licensed under the Mozilla Public License 2.0. See the LICENSE file for details.
Community
- Zulip: Join our community on Zulip
- Website: Visit polyproto.org
- Email: Contact us at info@polyphony.chat
- IRC: See our FAQ at the "IRC" section for information on how to connect.