refrakt

Package Version Hex Docs

Runtime helpers for Refrakt, a convention-first web framework for Gleam built on Wisp, Lustre and Mist.

This is the small library that Refrakt apps import at runtime. The code generator lives in the separate refrakt_cli package, which apps only need as a dev-dependency.

gleam add refrakt
gleam add --dev refrakt_cli

New to Refrakt? Start with the installation guide and the tutorial.

Modules

ModuleWhat it does
refrakt/validateComposable validators that return List(#(String, String)) errors
refrakt/flashFlash messages on signed cookies
refrakt/migrateRuns SQL migration files and tracks them in a _migrations table
refrakt/testingRequest builders for handler tests
refrakt/dev_errorDevelopment error page
refrakt/jobsBackground jobs in OTP processes, with a concurrency limit (experimental)
refrakt/tokenSigned, expiring tokens bound to a purpose
refrakt/mailerEmail builder with pluggable delivery adapters (experimental)
refrakt/paginatePagination helpers for list views
refrakt/uploadMultipart file upload handling
refrakt/corsCORS middleware (experimental)
refrakt/rate_limitSliding-window rate-limiting middleware (experimental)
refrakt/pubsubTopic-based publish/subscribe (experimental)
refrakt/telemetryRequest counts, response times and error rates (experimental)

Modules marked experimental are lightly used and may change or move to their own package (#28).

import refrakt/validate

pub fn validate_post(title: String, body: String) -> List(#(String, String)) {
  []
  |> validate.required(title, "title", "Title is required")
  |> validate.max_length(title, "title", 200, "Title is too long")
  |> validate.required(body, "body", "Body is required")
}

Further documentation can be found at https://hexdocs.pm/refrakt.

License

MIT

✨ Search Document