Frontend Guide

The frontend is structured to keep static content fast and interactive features focused.

Rendering Strategy

  • Server rendering is the default mode
  • Static generation is used for durable content like docs and blog pages
  • Dynamic rendering is used for auth and user-specific routes

This hybrid approach gives strong baseline performance while preserving dynamic capabilities.

Component Boundaries

  • Layout/content components stay server-first and mostly static
  • Interactive features are isolated as client islands
  • Islands are used only where state or browser APIs are required

Content Model

The project uses content collections for predictable authoring:

  • blog content
  • documentation pages
  • changelog entries

Schemas keep content structured and queryable.

Routing and API

  • File-based routing maps page intent to URLs
  • Dynamic routes support docs/blog details
  • API routes handle server interactions such as auth operations

Middleware Responsibilities

Middleware is responsible for:

  • resolving session context on request
  • attaching user/session to request-local context
  • guarding protected routes
  • skipping unnecessary work for fully public content

Styling and Theming

  • Utility styling consumes semantic tokens
  • Global theme behavior comes from token-generated CSS variables
  • Theme switching affects values, not component markup

Practical Rule of Thumb

Use static routes unless per-request state is required.
When interactivity is needed, add the smallest possible client island instead of hydrating full pages.