Heavily customized version of smokesignal - https://whtwnd.com/kayrozen.com/3lpwe4ymowg2t
Rust 39.2%
HTML 29.1%
CSS 27.0%
JavaScript 2.2%
Fluent 1.8%
Shell 0.2%
Dockerfile 0.1%
Other 0.5%
46 1 0

Clone this repository

https://tangled.org/kayrozen.com/plaquetournante-dev
git@tangled.org:kayrozen.com/plaquetournante-dev

For self-hosted knots, clone URLs may differ based on your setup.

README.md

smokesignal#

An event and RSVP management system based on ATproto

  • Backend: Rust with Axum web framework
  • Database: PostgreSQL with SQLx
  • Cache: Redis/Valkey for session management
  • Templates: Minijinja with fluent-templates for i18n
  • Frontend: HTMX + Bulma CSS
  • Containerization: Docker with devcontainer supportent application built with Rust, featuring modern internationalization and unified template rendering.

Features#

  • Event Management: Create, view, and manage events
  • RSVP System: Allow users to respond to events
  • Internationalization: Full i18n support with fluent-templates (English, French Canadian)
  • Modern UI: HTMX-powered interactive interface with Bulma CSS
  • Template System: Unified template rendering with automatic context enrichment
  • Authentication: OAuth-based user authentication
  • Real-time Updates: Dynamic content updates with HTMX

Architecture#

I18n System#

smokesignal uses a modern i18n architecture built on fluent-templates for high-performance, compile-time translation loading:

  • Static Loading: Translations are compiled into the binary for zero runtime overhead
  • Automatic Fallbacks: Graceful fallback to English when translations are missing
  • Gender Support: Full support for gendered translations (French Canadian)
  • Template Integration: Seamless integration with minijinja templates

Template Rendering#

The application features a centralized template rendering system that automatically enriches templates with:

  • Internationalization: Automatic locale detection and translation injection
  • HTMX Context: Smart detection of HTMX requests for partial rendering
  • Gender Context: Personalized content based on user gender preferences
  • Error Handling: Consistent error templates with proper context

Technology Stack#

  • Backend: Rust with Axum web framework
  • Database: PostgreSQL with SQLx
  • Cache: Redis/Valkey for session management
  • Templates: Minijinja with fluent-templates for i18n
  • Frontend: HTMX + Bulma CSS
  • Containerization: Docker with devcontainer support

Quick Start#

  1. Install Visual Studio Code and the Dev Containers extension
  2. Clone this repository
  3. Open in VS Code and select "Reopen in Container"
  4. Run database migrations: sqlx migrate run
  5. Start the server: cargo run --bin smokesignal

Local Development#

Prerequisites:

  • Rust 1.86+
  • PostgreSQL
  • Redis or Valkey
# Install dependencies
cargo build

# Set up database
sqlx migrate run

# Run the application
cargo run --bin smokesignal

# Run tests
cargo test

Configuration#

Copy keys.example.json to keys.json and configure:

  • Database connection strings
  • OAuth provider credentials
  • Redis/Valkey connection
  • External service URLs

Internationalization#

Supported Languages#

  • en-us: English (United States)
  • fr-ca: French (Canada) with gender support

Adding Translations#

  1. Add .ftl files to i18n/{locale}/ directories
  2. Use Fluent syntax for translations
  3. Test with cargo test i18n

Translation Structure#

i18n/
├── en-us/
│   ├── common.ftl     # Common UI strings
│   ├── errors.ftl     # Error messages
│   ├── forms.ftl      # Form labels and validation
│   ├── actions.ftl    # Button and action text
│   └── ui.ftl         # Interface elements
└── fr-ca/
    └── (same structure with French translations)

Development#

Common Commands#

# Build
cargo build

# Run tests
cargo test

# Run specific test suites
cargo test i18n
cargo test template
cargo test middleware_i18n

# Format and lint
cargo fmt
cargo clippy

# Run with debug logging
RUST_LOG=debug cargo run --bin smokesignal

Build Features#

  • embed: Embed templates in binary (production)
  • reload: Enable template reloading (development)
# Production build with embedded templates
cargo build --release --no-default-features --features embed

# Development build with template reloading
cargo build --no-default-features --features reload

Template Development#

Template Renderer#

The TemplateRenderer provides a unified API for rendering templates with automatic context enrichment:

use smokesignal::http::template_renderer::TemplateRenderer;

// Create renderer with automatic context
let renderer = TemplateRenderer::new(template_engine, i18n_context, language, is_htmx)
    .with_gender_context(gender_context);

// Render template with enriched context
let html = renderer.render("template_name", &context)?;

Template Macros#

Convenient macros for common operations:

// Create renderer quickly
let renderer = create_renderer!(engine, i18n, lang, htmx, gender);

// Render error templates with context preservation
contextual_error!(renderer, "error_template", error_context);

API Documentation#

Core Modules#

  • src/http/template_renderer.rs: Unified template rendering system
  • src/i18n/: Internationalization with fluent-templates
  • src/http/middleware_i18n.rs: Language detection and context injection
  • src/http/macros.rs: Convenience macros for handlers

I18n API#

use smokesignal::i18n::{get_translation, I18nTemplateContext};

// Get translation with arguments
let message = get_translation(&locale, "message-key", Some(args));

// Template context for dynamic locale support
let context = I18nTemplateContext::new(loader);

Contributing#

  1. Fork the repository
  2. Create a feature branch
  3. Make changes with tests
  4. Run cargo test and cargo clippy
  5. Submit a pull request

Translation Contributions#

Translation improvements are welcome! Please ensure:

  • Complete coverage across all .ftl files
  • Gender variants for French Canadian
  • Consistent terminology and tone

License MIT#

This project is licensed under the terms specified in the LICENSE file.

Documentation#