A robust, performant polyproto home server. https://polyproto.org
  • Rust 94.5%
  • Shell 2.5%
  • Nix 2.4%
  • PLpgSQL 0.6%
2025-12-22 00:34:16 +01:00
.cargo feat: steal release config from microsoft/edit 2025-06-21 21:12:44 +02:00
.github fix: install nightly and stable toolchain in ci 2025-07-12 14:18:59 +02:00
.sqlx feat: continue work on insert_id_unchecked 2025-07-29 23:02:06 +02:00
.vscode fix: db script 2025-11-01 18:24:13 +01:00
fixtures chore: add tests, fix tests 2025-07-20 00:26:29 +02:00
migrations squashme: pushing my shit here also 2025-08-03 11:40:59 +02:00
scripts fix: db script 2025-11-01 18:24:13 +01:00
src fix: use bound variable 2025-09-05 18:36:27 +02:00
tests chore: rustfmt 2025-07-19 23:43:06 +02:00
yaak chore: update yaak workspace 2025-07-17 21:07:39 +02:00
.example.env feat(change): add example env, change database config 2025-06-21 00:54:32 +02:00
.gitignore feat: ignore direnv and .cargo related files 2025-10-26 15:42:57 +01:00
.mailmap chore: add mailmap 2025-12-22 00:32:30 +01:00
.pre-commit-config.yaml feat: impl get_valid_token, write docs 2025-07-12 13:50:48 +02:00
Cargo.lock feat: nix flake with postgres 2025-10-03 18:36:33 +02:00
Cargo.toml feat: nix flake with postgres 2025-10-03 18:36:33 +02:00
flake.lock feat: db script time! 2025-11-01 17:58:37 +01:00
flake.nix chore: Add rust-src to fenix toolchain (switched to complete toolchain) 2025-12-22 00:18:37 +01:00
LICENSE Initial commit 2025-06-20 12:50:45 +02:00
README.md fix(doc): add owner to database 2025-11-19 22:28:30 +01:00
rustfmt.toml feat: change hard_tabs to false 2025-07-19 23:41:42 +02:00
sonata.toml fix: db script 2025-11-01 18:24:13 +01:00

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:

Environment Configuration

  1. Copy the example environment file:

    cp .example.env .env
    
  2. Edit the .env file with your database credentials and configuration.

Database Setup

  1. Create a PostgreSQL database for sonata:

    CREATE DATABASE sonata;
    CREATE USER sonata WITH PASSWORD 'sonata';
    GRANT ALL PRIVILEGES ON DATABASE sonata TO sonata;
    ALTER DATABASE sonata OWNER TO sonata;
    
  2. 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 clippy for 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 .envrc to the root of the project, containing the line use flake
  • Run direnv allow if you trust the contents of /flake.nix
  • Start a development database by using the db script: Run db in 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