Ferrik
Ferrik is an AI-first, full-stack MVC web framework written in Rust, combining Ruby on Rails Convention over Configuration ergonomics with native Agent Experience (AX) alongside human developers.
Installation
Install the ferrik CLI from crates.io:
Quickstart
Starting the development server initializes storage/development.sqlite3, applies pending SeaORM migrations, starts Axum on port 3000, and prints:
Ferrik v0.1.0 running in development mode
-> Human Web UI: http://127.0.0.1:3000
-> JSON API: http://127.0.0.1:3000/index.json
-> AI Agent Entry: http://127.0.0.1:3000/ai
-> Agent Manifest: http://127.0.0.1:3000/.well-known/ferrik-agent.json
Core Architecture
- Single-Handler, Triple-Representation (
ActionResponse<T>): Every controller action runs domain logic once and renders HTML (compile-time checked Askama templates, Zero-JS), JSON, or AI-Native Markdown (.ai//ai/*with YAML frontmatter, compact tables, and JSON Schema action affordances). - Multi-Database Persistence (SeaORM): Zero-config SQLite by default, switchable to PostgreSQL or MySQL via
DATABASE_URLand Cargo feature flags (db-sqlite,db-postgres,db-mysql), with dialect-agnostic Rust migrations and automatic.ferrik/schema.jsonintrospection. - Deterministic AI Operability: Every CLI command supports
--json, maintains.ferrik/manifest.jsonand.ferrik/schema.json, serves/.well-known/ferrik-agent.json, and embeds a native MCP (Model Context Protocol) server (stdioand/mcp). - Test-First by Default: Ships with
ferrik::testing::TestApp(in-memory SQLite per test) and auto-generates test suites fornew,model,controller,scaffold, andagent_auth.
CLI Commands
All commands accept --json for structured, machine-readable output without ANSI codes.
# Project creation & development server
# Code generators (alias: `ferrik g`)
# Database migrations
# Introspection, verification & testing
# Native MCP server & Agent API keys
Application Directory Structure
my_app/
├── .ferrik/ # Auto-managed AI metadata (DO NOT edit manually)
│ ├── manifest.json # Registered routes, controllers, .ai actions & MCP tools
│ └── schema.json # Current DB schema snapshot (updated on db migrate)
├── config/
│ ├── app.toml # Server port, environment, MCP & AI discovery flags
│ └── database.toml # Pool settings and driver configs
├── migration/ # Isolated SeaORM migration crate for fast incremental builds
│ ├── Cargo.toml
│ └── src/
│ ├── lib.rs
│ ├── main.rs
│ └── mYYYYMMDD_HHMMSS_*.rs
├── public/
│ └── styles.css # Minimal semantic/classless CSS
├── storage/ # Local SQLite database files
├── src/
│ ├── main.rs # Entrypoint: config, DB pool, migrations, Axum server
│ ├── lib.rs # Library exports for integration testing (TestApp)
│ ├── routes.rs # Central route registry (.html, .json, .ai, /mcp)
│ ├── controllers/
│ │ ├── mod.rs
│ │ ├── home_controller.rs # Default root (/), /index.json, /ai, healthcheck
│ │ └── posts_controller.rs
│ ├── models/
│ │ ├── mod.rs
│ │ └── post.rs # SeaORM Entity + ActiveModel + InputDTO
│ ├── views/
│ │ ├── mod.rs
│ │ └── posts.rs # Askama #[derive(Template)] structs
│ └── errors.rs # Unified error handler rendering HTML, JSON, or .ai
├── templates/
│ ├── layouts/
│ │ └── application.html # Base HTML5 layout with AI discovery <link> tags
│ ├── shared/
│ │ └── _errors.html # Validation errors partial
│ ├── home/
│ │ └── index.html
│ └── posts/
│ ├── index.html
│ ├── show.html
│ ├── new.html
│ ├── edit.html
│ └── _form.html
├── tests/ # Auto-generated test suite
│ ├── home_test.rs
│ ├── models/
│ ├── controllers/
│ └── scaffolds/
├── .env
├── .env.example
├── Cargo.toml
└── README.md
Documentation
- Directory Structure
- Global AI Discovery Protocol
- Native MCP Server & Agent Authentication
- Testing Framework & Coverage
License
MIT