LogoJaspr

๐Ÿ•น Jaspr CLI

Jaspr comes with a cli tool to create, serve and build your website.

  • jaspr create will create a new jaspr project. The cli will prompt you for a project name and setup options.
  • jaspr serve will serve the website in the current directory, including hot-reloading.
  • jaspr build will build the website containing the static assets (compiled js, html, images, etc.) and the optional server executable.

๐Ÿ“Ÿ Rendering Modes#

Jaspr is a full-stack web framework, meaning it can run both on the server and the client. Depending on what you want to build you can choose how your app should be built and executed using jaspr.

  • Static Mode Jaspr can also perform static site generation, meaning it can generate static pages at build time from your server-side components. Jaspr will build a fully static site that you can host at any common website hosting service (like firebase hosting), but you can still use server-side rendering to pre-render pages of your site.

  • Server Mode In this mode jaspr runs both on the server and optionally hydrates on the client. It renders your html on the server for every incoming request, making it possible to use any dynamic data from an api or database to render your components. Additionally you can setup hydration on the client in order to make your site interactive.

  • Client Mode If you want, you can skip the server part of jaspr completely and use it as a client-side only framework. This way you can deploy your built app to any common website hosting service (like firebase hosting) without needing an extra server.

๐Ÿ— Project Scaffolding#

When creating a new project, you will go through a set of questions to configure the project to your liking. The options set your rendering mode, hydration strategy, routing, flutter interoperability strategy and more.

If you are just starting out and are not sure what options to pick, just select the default one for each question (simply press Enter each time).

Choosing a set of options do not lock you into a specific configuration. Starting from one setup you can easily modify your code to behave as any other setup along the way.

๐Ÿ›  Building#

When it's time to deploy your application, you can build it using the following command:

jaspr build

This will build the app inside the build/jaspr directory.

If you build with the server rendering mode, you can choose whether to build a standalone executable or an aot or jit snapshot with the --target option. You can then run your app by starting the executable at build/jaspr/app and deploy it alongside the build/jaspr/web folder.

If you build with the static or client mode, you can deploy the files inside the build/jaspr directory to any static hosting provider.