High-Performance Backend Platform for Media Processing and Real-Time Communication
Armoricore is a distributed backend system that leverages Rust and Elixir to deliver scalable, efficient services for media processing, real-time communication, notifications, and AI workflows.
Armoricore combines the best of both worlds:
- Rust β CPU-intensive, performance-critical tasks (media transcoding, notifications, AI processing)
- Elixir/Phoenix β High-concurrency real-time WebSocket connections (chat, live comments, presence)
These components communicate asynchronously via a distributed message bus, enabling independent scaling and deployment.
| Service | Responsibility |
|---|---|
| Media Processor | Consumes media upload events, runs FFmpeg workflows for transcoding/segmentation, generates thumbnails, uploads to object storage |
| Notification Worker | Consumes notification events, sends push notifications and emails asynchronously |
| AI/Captioning Workers | Performs transcription and AI-based tasks (optional) |
| Message Bus Client | Publishes and consumes events from distributed message bus (NATS JetStream/RabbitMQ) |
| Feature | Responsibility |
|---|---|
| WebSocket Management | Manages persistent WebSocket connections for chat, live comments, and presence tracking |
| Authentication | Validates JWT tokens issued by PHP backend |
| PubSub Broadcasting | Broadcasts messages and presence state changes using Phoenix PubSub |
| Message Bus Integration | Subscribes to message bus for cross-service communication |
Both Rust and Elixir services connect to a shared message bus (NATS JetStream or RabbitMQ):
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β PHP API ββββββββββΆβ Message Bus βββββββββββ Elixir β
β (Backend) β β (NATS/Rabbit)β β (Phoenix) β
βββββββββββββββ ββββββββββββββββ βββββββββββββββ
β²
β
βββββββ΄ββββββ
β Rust β
β Services β
βββββββββββββ
- Rust β Elixir:
media.ready,notification.sent,transcription.complete - Elixir β Rust:
chat.message,presence.update(for moderation workflows) - PHP β Rust/Elixir:
media.uploaded,notification.requested
1. User uploads video
β
2. PHP backend issues presigned URL
β
3. Upload completes β PHP publishes `media.uploaded` event
β
4. Rust Media Processor consumes event
β
5. Transcodes video, generates thumbnails, uploads to object storage
β
6. Rust publishes `media.ready` event
β
7. Elixir subscribes to `media.ready` β notifies connected users via WebSocket
β
8. Akamai CDN serves processed video segments
1. Event triggers notification request
β
2. `notification.requested` event published to message bus
β
3. Rust Notification Worker consumes event
β
4. Sends push notification or email asynchronously
β
5. Rust publishes `notification.sent` event
β
6. Elixir may broadcast notification status to realtime clients
- PHP Backend issues JWT tokens on user login
- Elixir Phoenix validates JWT on WebSocket connection for realtime authentication
- Rust Services receive JWT or event metadata for authorization in workflows
- Rust (latest stable version)
- Elixir (1.14+) and Erlang/OTP (25+)
- Phoenix Framework (1.7+)
- NATS Server or RabbitMQ (for message bus)
- FFmpeg (for media processing)
- Docker (optional, for containerized deployment)
git clone <repository-url>
cd Armoricorecd rust-services
cargo build --releasecd elixir-realtime
mix deps.get
mix compileSet up NATS JetStream or RabbitMQ and configure connection strings in:
rust-services/.envelixir-realtime/config/dev.exs(orprod.exs)
Rust Services:
cd rust-services
cargo run --bin media-processor
cargo run --bin notification-workerElixir Phoenix:
cd elixir-realtime
mix phx.serverArmoricore/
βββ README.md
βββ ARCHITECTURE.md
βββ rust-services/
β βββ Cargo.toml
β βββ media-processor/
β β βββ src/
β β βββ Cargo.toml
β βββ notification-worker/
β β βββ src/
β β βββ Cargo.toml
β βββ ai-workers/
β β βββ src/
β β βββ Cargo.toml
β βββ message-bus-client/
β βββ src/
β βββ Cargo.toml
βββ elixir-realtime/
β βββ mix.exs
β βββ config/
β βββ lib/
β β βββ armoricore_realtime/
β β β βββ application.ex
β β β βββ endpoint.ex
β β β βββ channels/
β β βββ armoricore_realtime_web/
β βββ priv/
βββ docs/
βββ deployment.md
βββ api.md
βββ development.md
Rust:
cd rust-services
cargo testElixir:
cd elixir-realtime
mix test- Start NATS server:
nats-server -js - Start Rust services in separate terminals
- Start Elixir Phoenix:
mix phx.server - Connect WebSocket clients to
ws://localhost:4000/socket
- Rust Workers: Scale independently based on queue depth
- Elixir Nodes: Add Phoenix nodes behind a load balancer; Phoenix PubSub handles distribution
- Message Bus: NATS JetStream supports clustering for high availability
- Rust: Metrics via Prometheus exporters
- Elixir: Phoenix LiveDashboard for real-time metrics
- Message Bus: NATS monitoring endpoints or RabbitMQ management UI
Rust Services:
MESSAGE_BUS_URL=nats://localhost:4222
OBJECT_STORAGE_ENDPOINT=s3://...
OBJECT_STORAGE_ACCESS_KEY=...
OBJECT_STORAGE_SECRET_KEY=...Elixir:
# config/prod.exs
config :armoricore_realtime, ArmoricoreRealtime.Endpoint,
http: [port: 4000],
url: [host: "realtime.example.com"]
config :armoricore_realtime, :message_bus,
url: "nats://nats-server:4222"- JWT Validation: All WebSocket connections require valid JWT tokens
- Event Authorization: Rust services validate event metadata
- TLS/SSL: All external communications use TLS
- Secrets Management: Use environment variables or secret management services
- Architecture Plan - Detailed system architecture
- API Documentation - API endpoints and WebSocket protocols
- Deployment Guide - Production deployment instructions
- Development Guide - Development setup and workflows
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Copyright 2025 Francisco F. Pinochet
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
- Rust community for excellent FFmpeg and async libraries
- Phoenix Framework team for robust real-time capabilities
- NATS and RabbitMQ communities for reliable message bus solutions
For questions and support, please open an issue or contact the developer.