🚧 This documentation is not complete yet as Lagon is in Alpha.
Examples

We have set up many examples using different libraries and frameworks. Each example has a lagon-dev script that uses lagon dev to start the example locally, in a few seconds.

Basics

Fetch an API

This example uses fetch() to fetch an API and return the result. See the code (opens in a new tab)

Reply with HTML

This example replies with HTML, setting the proper Content-Type header. See the code (opens in a new tab)

Reply with JSON

This example replies with JSON, setting the proper Content-Type header. See the code (opens in a new tab)

Libraries

Drizzle with Turso

This example uses Drizzle (opens in a new tab), a TypeScript ORM that has a SQL-like syntax with Turso (opens in a new tab) as a distributed SQLite database, with typesafe queries and migrations. See the code (opens in a new tab)

HatTip

This example uses HatTip (opens in a new tab), a minimalist express-like library that runs anywhere, via Lagon's adapter. See the code (opens in a new tab)

Hono

This example uses Hono (opens in a new tab), a small, simple, and ultrafast web framework, via Lagon's adapter. See the code (opens in a new tab)

Nitro

This example uses Nitro (opens in a new tab), a library to build and deploy universal JavaScript servers, via Lagon's preset. See the code (opens in a new tab)

Neon

This example uses Neon (opens in a new tab) with their Serverless driver (@neondatabase/serverless) to make PostgreSQL queries on the edge. See the code (opens in a new tab)

PlanetScale Serverless Driver

This example uses PlanetScale (opens in a new tab) with their Serverless Driver (@planetscale/database) to make SQL queries on the edge. See the code (opens in a new tab)

Preact CSR

This example uses Preact (opens in a new tab) to client-side render an app. See the code (opens in a new tab)

Preact SRR

This example uses Preact (opens in a new tab) to server-side render an app and hydrate on the client. See the code (opens in a new tab)

React CSR

This example uses React (opens in a new tab) to client-side render an app. See the code (opens in a new tab)

React SSR

This example uses React (opens in a new tab) to server-side render an app and hydrate on the client. See the code (opens in a new tab)

React SSR with streaming

This example uses React (opens in a new tab) to server-side render an app, stream the HTML, and hydrate on the client. See the code (opens in a new tab)

Satori

This example uses Satori (opens in a new tab) to render React and HTML/CSS to SVG. See the code (opens in a new tab)

Sidra

This example uses Sidra (opens in a new tab), a library to create servers using TypeScript decorators with NestJS-like API. See the code (opens in a new tab)

Turso

This example uses Turso (opens in a new tab) to make SQLite queries on the edge. See the code (opens in a new tab)

tRPC

This example uses tRPC (opens in a new tab) server, to build typesafe APIs. See the code (opens in a new tab)

Upstash Redis

This example uses Upstash Redis (opens in a new tab) to make Redis requests over HTTP. See the code (opens in a new tab)

Upstash Rate Limit

This example uses Upstash Rate Limit (opens in a new tab) to easily create rate limits via Redis over HTTP. See the code (opens in a new tab)

vite-plugin-ssr

This example uses vite-plugin-ssr (opens in a new tab) to render static and dynamic React pages. See the code (opens in a new tab)

Xata

This example uses Xata (opens in a new tab), a modern serverless type-safe database. See the code (opens in a new tab)

Frameworks

Astro

This example uses Astro (opens in a new tab), a static site generator, with both SSR via Lagon's adapter and prerendering. See the code (opens in a new tab)

Nuxt

This example uses Nuxt (opens in a new tab), the intuitive web framework for Vue, with SSR via Lagon's preset. See the code (opens in a new tab)

Nuxt Complex

This example uses Nuxt (opens in a new tab) with multiple pages, layouts, api routes and more. See the code (opens in a new tab)

Rakkas

This example uses Rakkas (opens in a new tab), a React framework powered by Vite, with SSR via Lagon's adapter. See the code (opens in a new tab)

Remix

This example uses Remix (opens in a new tab), a full-stack React framework, with SSR via Lagon's integration. See the code (opens in a new tab)

SvelteKit

This example uses SvelteKit (opens in a new tab), the Svelte framework, with SSR via Lagon's adapter. See the code (opens in a new tab)