MVC::Keayl
Every page of the MVC::Keayl manual, in reading order.
- Overview MVC::Keayl is a Model-View-Controller web framework for Raku. The manual covers requests, routing, controllers, views, sessions, security, caching, and configuration.
- Application & configuration MVC::Keayl::Application and MVC::Keayl::Config: layered JSON configuration, environments, draw-routes, boot initializers, and dispatch to controller actions.
- Command-line interface The keayl command-line tool: new, server, routes, console, and generate for controllers, scaffolds, models, migrations, mailers, jobs, channels, and helpers.
- Request MVC::Keayl::Request, the read-only request wrapper: method predicates, path and query-params, headers, scheme, host, port, remote-ip, lazy body reading, and variants.
- Response MVC::Keayl::Response, the outgoing response builder: status, case-insensitive headers, content-type and location shortcuts, body buffering, and finish.
- Middleware The middleware stack and endpoint protocol: writing middleware, MiddlewareStack ordering and build, the Static file middleware, and per-request database connections.
- Server adapters Server adapters connect an HTTP server to the framework: the MVC::Keayl::Adapter handle contract, the in-memory Test adapter, and the Cro production adapter.
- Routing The routes DSL in config/routes.raku: verb helpers, path patterns, resources, nesting, namespaces and scopes, concerns, constraints, redirects, mount, URL helpers, and recognition.
- Engines MVC::Keayl::Engine packages routes, controllers, views, and initializers under an isolated namespace to mount in a host app, with host route and view overrides.
- Controllers MVC::Keayl::Controller: params, render, redirect-to, head, send-file, before-action and other callbacks, strong parameters, rescue-from, helper-method, and trait forms.
- Views MVC::Keayl::View template rendering: resolution by format and variant, handlers, caching, layouts, content-for and yield, partials, collections, and output safety helpers.
- View helpers View helpers: content-tag and tag, link-to and url-for, asset tags, form-with and FormBuilder fields, select helpers, simple-form-for, and text, number, and date formatting.
- Asset pipeline Asset fingerprinting with digested names and a Manifest, manifest-resolver and digested-resolver for view helpers, AssetsController serving, import maps, and assets-precompile.
- Internationalization MVC::Keayl::I18n: locale files, translate with interpolation and pluralization, fallbacks, localize for dates and numbers, per-request locale resolution, and form labels.
- Content negotiation MIME type registry with mime-type, register-mime, and negotiate, respond-to format blocks, request variants, and the JSON-first APIController with serializers.
- Cookies MVC::Keayl::Cookies, the cookie jar: reading, writing, and deleting cookies, attributes such as http-only and same-site, and signed and encrypted cookies.
- Sessions MVC::Keayl::Session, the per-request session: reading and writing keys, reset-session, the signed or encrypted CookieStore, and ServerSideStore with pluggable backends.
- Flash The flash carries messages across one redirect: flash<key>, flash.now for the current request, keep and discard, and named types registered with add-flash-types.
- CSRF protection CSRF protection with protect-from-forgery: masked csrf-token values, the X-CSRF-Token header, exception, reset-session, and null-session strategies, and skip-forgery-protection.
- Parameter filtering MVC::Keayl::ParameterFilter redacts sensitive parameters as [FILTERED] for logs, with default filter names, the also and filters options, and filter-parameters on controllers.
- Transport & host security Three security middleware: SSL redirects to HTTPS with HSTS, HostAuthorization limits requests to allowed hosts, and SecureHeaders adds default response headers.
- HTTP authentication HTTP Basic, Token, and Digest authentication helpers on controllers, such as authenticate-or-request-with-http-basic, http-basic-authenticate-with, and secure-compare.
- Secrets MVC::Keayl::Secrets resolves the secret key base from config or the environment and derives purpose-specific keys with derive-key, signing-key, and encryption-key.
- Encrypted credentials MVC::Keayl::Credentials: an encrypted YAML file read with a master key, resolve, read, per-environment files, keayl credentials-edit, and generate-master-key.
- Caching & streaming Conditional GET with fresh-when and is-stale, expires-in cache headers, cache store backends, fragment caching, rate-limit, streamed bodies, and Range requests.
- Live streaming & SSE Live responses written incrementally with live and a stream, client disconnect handling, and Server-Sent Events through sse with event, id, retry, and comment.
- Mailer MVC::Keayl::Mailer: actions that call mail with HAML html and text views, defaults, callbacks, attachments, deliver-later, interceptors, previews, and Test, File, and SMTP delivery.
- Background jobs MVC::Keayl::Job background jobs: perform-now and perform-later, Inline, Test, Async, and Database queue adapters, scheduling with set, retry-on, callbacks, and Global IDs.
- WebSockets MVC::Keayl::Cable real-time messaging: connections with identified-by, channels with stream-from, transmit, and broadcast-to, model broadcasts, and pub/sub backends.
- Action Mailbox Action Mailbox routes inbound email to Mailbox classes: parse-message, InboundEmail states, processing callbacks, bounce, rescue-from, Router rules, and ingresses.
- Active Storage Active Storage attaches files to records: blobs, Disk, External, and Mirror services, has-one-attached, has-many-attached, signed URLs, variants, and direct upload.
- Action Text Action Text stores sanitized rich-text HTML on models with has-rich-text, edits it with rich-text-area and Trix, renders it with rich-text, and embeds blobs.
- Logging Per-request log lines with timings and filtered params, log-level settings per environment, MVC::Keayl::Logger, and the request-logging middleware.
- Instrumentation MVC::Keayl::Notifications pub/sub: subscribe, notify, and instrument, the dispatch.keayl and render.keayl events, bridging ORM SQL events, and request ids.
- Error reporting How unhandled errors become 500 responses: the development ExceptionPage, terse production errors, and ErrorReporter classes registered with report-errors-with.
- Health checks & PWA HealthController serves a /up health check, and PWAController serves a web app manifest and service worker, both wired into a generated app by keayl new.
- Test support MVC::Keayl::TestSupport: IntegrationSession requests and response assertions, LiveServer, routing assertions, RecordingRenderer, and mailer, job, and cable assertions.