🚀 Serverpod integration for Jaspr
This package provides an integration between Jaspr and Serverpod.
It provides:
JasprRouteto use in your Serverpod webserver to server-side render Jaspr components.context.sessionextension to get theSessioninside a componentsbuild()method.JasprConnectivityMonitorfor your generated Serverpod client.
Follow the setup below or check out one of our examples:
Setup
Refer to our official Setup Guide on how to integrate Jaspr with Serverpod.
Running during development
After you have setup the integration, simply run jaspr serve in your terminal to start both the Jaspr development server and run Serverpod in debug mode.
This fully replaces the need to run dart bin/main.dart during development. To pass additional arguments to Serverpod, use an additional -- before the arguments, for example: jaspr serve -- --apply-migrations.
Building and deploying
To build your project, run jaspr build in your terminal.
If you are using docker to deploy your project, modify the Dockerfile like this:
FROM dart:3.2.5 AS build
...
+ RUN dart pub global activate jaspr_cli
RUN dart pub get
- RUN dart compile exe bin/main.dart -o bin/main
+ RUN jaspr build -v
...
FROM busybox:1.36.1-glibc
...
COPY --from=build /runtime/ /
- COPY --from=build /app/bin/main /app/bin/main
+ COPY --from=build /app/build/jaspr/app /app/bin/main
COPY --from=build /app/config/ config/
- COPY --from=build /app/web/ web/
+ COPY --from=build /app/build/jaspr/web/ web/
...