Crate perseus[][src]

Expand description

Perseus is a blazingly fast frontend web development framework built in Rust with support for major rendering strategies, reactivity without a virtual DOM, and extreme customizability. It wraps the lower-level capabilities of Sycamore and provides a NextJS-like API!

  • ✨ Supports static generation (serving only static resources)
  • ✨ Supports server-side rendering (serving dynamic resources)
  • ✨ Supports revalidation after time and/or with custom logic (updating rendered pages)
  • ✨ Supports incremental regeneration (build on demand)
  • ✨ Open build matrix (use any rendering strategy with anything else, mostly)
  • ✨ CLI harness that lets you build apps with ease and confidence

This is the documentation for the core Perseus crate, but there’s also a CLI and integrations to make serving apps easier!

Resources

These docs will help you as a reference, but the book should be your first port of call for learning about how to use Perseus and how it works.

Re-exports

pub use http;
pub use crate::build::build_template;
pub use crate::build::build_templates;
pub use crate::config_manager::ConfigManager;
pub use crate::config_manager::FsConfigManager;
pub use crate::errors::err_to_status_code;
pub use crate::errors::ErrorCause;
pub use crate::serve::get_page;
pub use crate::serve::get_render_cfg;
pub use crate::shell::app_shell;
pub use crate::shell::ErrorPages;
pub use crate::template::States;
pub use crate::template::StringResult;
pub use crate::template::StringResultWithCause;
pub use crate::template::Template;
pub use crate::template::TemplateMap;

Modules

Utilities for building your app.

Utilities for creating custom config managers, as well as the default FsConfigManager.

Utilities for serving your app. These are platform-agnostic, and you probably want an integration like perseus-actix-web.

Utilities to do with the app shell. You probably don’t want to delve into here.

Utilities to do with templating. This is where the bulk of designing apps lies.

Macros

Defines the components to create an entrypoint for the app. The actual entrypoint is created in the .perseus/ crate (where we can get all the dependencies without driving the user’s Cargo.toml nuts). This also defines the template map. This is intended to make compatibility with the Perseus CLI significantly easier.

An internal macro used for defining a function to get the user’s preferred config manager (which requires multiple branches).

Gets a HashMap of the given templates by their paths for serving. This should be manually wrapped for the pages your app provides for convenience.

Structs

Rendering backend for the DOM.

Represents an HTTP request.

Rendering backend for Server Side Rendering, aka. SSR.

Traits

Abstraction over a rendering backend.

Trait that is implemented for enums that can match routes.

Type Definitions

All HTTP requests use empty bodies for simplicity of passing them around. They’ll never need payloads (value in path requested).

Derive Macros

The Route procedural macro.