By default, Aleph.js pre-renders every page. This means that Aleph.js generates HTML for each page in advance, instead of having it all done by client-side JavaScript. SSR (server-side rendering) can result in better performance and SEO.

Each generated HTML is associated with minimal JavaScript code necessary for that page. When a page is loaded by the browser, its JavaScript code runs and makes the page fully interactive. (This process is called hydration.)

You can disable the SSR function in aleph.config.js:

export default {
  "ssr": false, // SPA mode

or specify exclude paths:

export default {
  "ssr": {
    "exclude": [

SSR Data Fetching

To fetch data during build (SSR) time, you can use the useDeno hook that can get the Deno runtime in your component:

import React from ""
import { useDeno } from ""

export default function Page() {
  const version = useDeno(() => {
    return Deno.version

  return (
    <p>Powered by Deno v{version.deno}</p>

or fetching data asynchronously:

import React from ""
import { useDeno, useRouter } from ""

export default function Post() {
  const { params } = useRouter()
  const post = useDeno(async () => {
    return await (await fetch(`https://.../post/${}`)).json()
  }, true, [params]) // true means to refetch data in the browser deps the `params`

  return (

To learn more useDeno, check the useDeno Hook documentation.

Static Site Generation (SSG)

Aleph.js allows you to build your app to a static site, which can be hosted as static html pages on any server or CDN.

$ aleph build

For dynamic routes, your can define the staticPaths in the aleph.config.js:

export default async () => {
  const posts = await (await fetch("https://.../posts")).json()
  return {
    ssr: {
      exclude: [...],
      staticPaths:{id}) => `/post/${id}`)

See the hello-world example on Vercel.