Start guest sessions
AddSessions.middleware to browser routes. Session.init() skips paths under /api/, creates or restores a persisted session, tracks it in the container’s List<Session>, and uses the archery_guest_session cookie.
lib/src/http/routes/web.dart
request.thisSession. Session records hold data, errors, flashMessages, an optional user, and the CSRF token.
Enable CSRF verification
PlaceVerifyCsrfToken.middleware in the global kernel. It bypasses /api/, allows reading methods, and validates state-changing requests against the archery_csrf_token cookie.
example/main.dart
@csrf inside each state-changing HTML form. request.view() prepares the session token for the template engine, which replaces the directive with a hidden _token input.
lib/src/http/views/profile.html
_token from form input and compares it with the CSRF cookie. It returns a 403 response when either value is missing or they do not match. Header token lookup is not enabled in the current source.
Flash short-lived values
lib/src/http/routes/profile.dart
FlashMessageType.data or FlashMessageType.error to select the session map. Install FlashMessaging.middleware so short-lived values advance and clear across requests.