griffin-web
Griffin web framework: router, LiveView, templates and controllers on axum, inspired by Phoenix. Placeholder release while the framework is being designed.
Install
Run this in your project folder. cargo add griffin-web
Griffin
A batteries-included web framework for Rust, inspired by Elixir's Phoenix.
Griffin aims to give Rust developers what Phoenix gives Elixir developers: one coherent framework that ships with everything a real web application needs, so you spend your time building the product rather than gluing libraries together.
Why Griffin?
The Rust web ecosystem has excellent building blocks: fast HTTP servers, async runtimes, database drivers, template engines. What it lacks is a single, opinionated home for them. Starting a new project means picking a dozen crates, wiring them together, and making the same decisions every team has made before.
Phoenix showed that a framework can be productive and fast at the same time. It gives you real-time features by default, server-rendered interactive UIs without a JavaScript framework, and a clear way to organise an application. Griffin brings that philosophy to Rust and adds what Rust does well: safety, performance and compile-time guarantees.
Vision
- One framework, one way. Sensible defaults and conventions, with escape hatches when you need them.
- Real-time by default. Live, interactive pages should be the normal case, not a special project.
- Everything included. Mail, background jobs, scheduling, state machines, auth, and more are part of the framework, not left to third parties.
- Compile-time confidence. Templates, routes and data shapes are checked before your app runs.
- Fast feedback. Generators, live reload and clear error pages make development enjoyable.
- Production ready. Observability, configuration and deployment are first-class concerns.
Guiding Principles (borrowed from Phoenix)
| Phoenix idea | What it means for Griffin |
|---|---|
| LiveView | Rich, interactive UIs rendered on the server and kept in sync with the browser over a persistent connection. Most of your logic stays in Rust. |
| HEEx templates | HTML-aware templates that are validated at compile time, with reusable function components and slots. |
| Contexts | Business logic grouped into clear domain boundaries, kept apart from the web layer. |
| Plugs / pipelines | Requests flow through small, composable steps, such as auth, sessions or rate limiting, arranged into named pipelines. |
| Channels & PubSub | Built-in real-time messaging between server and clients, and between parts of the app. |
| Presence | Track who is online and what they are doing, across a cluster. |
| Supervision & fault tolerance | Long-running work is isolated and supervised, so one failure doesn't take the app down. |
| Generators | Scaffold resources, auth, live pages and more from the command line. |
What's in the Box
Web Layer
- Router: expressive routes, scopes, pipelines and path helpers that the compiler checks.
- Controllers: classic request/response handlers for pages and APIs.
- LiveView: stateful, server-driven interactive pages with events, forms, uploads, navigation and streams.
- Components: reusable UI building blocks with typed attributes and slots.
- Templates: a HEEx-style template language for HTML, checked at compile time.
- Forms & Validation: form helpers tied to data validation, with friendly error messages.
- Static Assets: an asset pipeline with live reload during development.
- JSON APIs: first-class support for building APIs alongside HTML pages.
Real-time
- Channels: two-way messaging over WebSockets with topics and authorization.
- PubSub: publish and subscribe within a node and across a cluster.
- Presence: distributed tracking of connected users.
Data
- Database layer: schemas, queries, migrations and transactions.
- Changesets: a structured way to filter, cast and validate data before it is persisted.
- Seeds & Fixtures: easy setup of development and test data.
Background Work
- Job Queue: durable background jobs with retries, priorities, uniqueness and backoff.
- Scheduler: recurring jobs on a cron-like schedule.
- Workflows / State Machines: model processes such as orders, approvals or onboarding as explicit states and transitions, with history and guards.
Communication
- Mailer: compose emails with templates, preview them in development, and deliver them through pluggable providers.
- Notifications: one way to reach users by email, in-app, push or webhook.
Security & Identity
- Authentication: a generator for a complete auth system covering registration, login, sessions, password reset and email confirmation.
- Authorization: policies for deciding who may do what.
- Built-in protections: CSRF, secure headers, safe-by-default HTML escaping and rate limiting.
Platform
- Configuration: environment-aware config with runtime secrets.
- Caching: a simple, unified caching interface.
- File Storage & Uploads: local and cloud storage behind one interface.
- Internationalization: translations and locale handling.
- Telemetry & Observability: structured logging, metrics and tracing hooks throughout the framework.
- Live Dashboard: a built-in admin view of requests, jobs, queues, processes and system health.
- Testing Tools: helpers for testing controllers, LiveViews, channels, jobs and mail.
- CLI & Generators: create projects, scaffold features, run migrations and manage the app.
- Deployment: build a single, self-contained release that is easy to ship.
Who Is It For?
- Rust developers who want to build full web products, not just APIs.
- Phoenix and Rails developers who want Rust's performance and safety without giving up productivity.
- Teams who would rather follow strong conventions than reinvent their stack on every project.
Roadmap (high level)
- Foundation: HTTP core, router, pipelines, controllers, templates.
- Interactivity: LiveView, components, channels, PubSub.
- Data: database layer, changesets, migrations, generators.
- Background & Communication: job queue, scheduler, mailer, state machines.
- Identity: auth generator, authorization, security defaults.
- Operations: telemetry, live dashboard, releases and deployment.
- Ecosystem: documentation, guides, example apps and community plugins.
Status
🚧 Early concept. Griffin is in the idea and design stage. Nothing here is usable yet. Feedback and ideas are welcome.
Inspiration
- Phoenix Framework
- Phoenix LiveView
- Ruby on Rails, Laravel and Django, for the batteries-included approach
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.