← All posts

Loaders and Server Functions

2026-05-14

Each route can declare a loader that runs on the server during SSR and on the client during navigation. createServerFn wraps logic that should only ever run on the server — like reading from the filesystem or hitting a private API.

In this app, listPosts and getPost are server functions that read posts.json directly.