/curi

A router that doesn't care how you render

Primary LanguageJavaScriptMIT LicenseMIT

Curi Travis

Curi lets you create a simple, configurable routing object to render your single-page application. Please check out the documentation website for more information.

You can read more about the design goals of Curi here.

Learn

Just getting started? Please check out these Curi guides.

Examples

You can test Curi out with these small demos:

There are also a number of examples that you can learn from. Many of these provide links to CodeSandbox demos so that you can test them in your browser.

Packages:

Name About Documentation Source
@curi/core npm Documentation Source
The core package provides the core routing functionality for the application. It is used to create a configuration object using a history object and a routes array.

Addons:

Name About Documentation Source
@curi/addon-active npm Documentation Source
The active addon allows you to determine if a route is "active" (its name/params match the current response's name/params).. This can be useful for giving an element a specific style when it is "active".
@curi/addon-ancestors npm Documentation Source
The ancestors addon allows you to get the names of ancestor routes for a particular route. You can either get the ancestor at a specific level (the parent route is 1 level up, the gradnparent route is 2, etc.) or you can get a list of all ancestor routes (the list is ordered from furthest to closest).

Side Effects:

Name About Documentation Source
@curi/side-effect-title npm Documentation Source
The title side effect exports a side effect factory. The factory returns a function that will use a response object's title property to set document.title.
@curi/side-effect-scroll npm Documentation Source
The scroll side effect exports a side effect factory. The factory returns a function that will scroll to the top of the page when you push/replace a location, but will let the browser restore the scroll location when popping (forward/back buttons) to a location.

Renderers

While you can use vanilla JavaScript to render your application, most modern apps use a rendering library. Currently, there are Curi integrations for React, Vue, and Svelte, but Curi is rendered agnostic and should work with most rendering libraries.

Name About Documentation Source
@curi/react npm Documentation Source
@curi/react provides a communication layer between the curi configuration object and your React application.
@curi/redux npm Documentation Source
A complement to @curi/react, @curi/redux can be used to have Redux pass response/location information to your components.
@curi/vue npm Documentation Source
A Vue plugin that adds Curi routing support to a Vue application. This is currently experimental and in addition to the plugin, just adds <Link> and <Redirect> components. So far it seems to work well, but is missing a lot of the functionality that the React packages provide.
@curi/svelte npm Documentation Source