What does Realm do?

In Realm, the routing only happens in backend. Realm backend is powered by Rust, backend analyses the URL and HTTP Method etc to figure out what rust function to call.

These rust function return a struct implementing realm::Page trait. Page trait is responsible for two things: conveying what Elm app is responsible for serving this page and what data does that Elm need.

The Elm side of project is composed of “pages”. Each page is a standalone Elm app, and on page load (or page navigation), gets loaded. The Elm pages receive the data generated by backend, so they do not have to make API call on load.

Regarding bundling: Realm supports two modes, 1. single bundle, and 2. dynamic Elm.

Note: Dynamic Elm code is not yet ported to open source Realm.

In single bundle mode, all Elm files are compiled into a single js file, this mode makes first JS request larger, but subsequent API calls are smaller as we will see.

In dynamic elm mode, the subsequent calls/navigation/page changes, the backend returns both data and javascript as response.

A note on dynamic loading in Elm: Elm itself doesnt support dynamic loading or modules, to work around that in Realm, we compile A.elm to a.js, B.elm to B.js and Main.elm to elm.js, and instead of returning a.js etc, we return “a.js minus elm.js” since elm.js is already available to frontend. Once we get a.js-elm.js, we combine it with elm.js to get a.js (this reduces 20-50% download size).

Realm SSR Advantage

In this approach, SSR implementation becomes much faster, since javascript on backend gets entire data in one go, no API is to be called during SSR phase.

Inline Data Advantage

In tradition approach, if one is trying to inject data in HTML, the logic of what page needs what API call/data is duplicated between the backend code and frontend code, and they can go out of sync. In Realm approach, they can never go out of sync.

Table Of Content

What is Realm?

A Bit On Motivation

Routing is Hard

What does Realm do?

Backend Data And Type Safety


Quick Start Realm Tutorial

In Depth Tutorial (not ready)

Hello Rust
Hello Elm
Hello Static Files
Hello Server Side Rendering
Pre-Commit Hooks

Routing, Request And Response

Frontend, Data, Navigation, And APIs

How To Guides

File Upload

Backend: S3 File Upload
Authenticated File Serving
Frontend: Uploading Files From Elm

How to use storybook?

How to implement “loading..”?









Environment Variables

Internals - Only for Realm Developers, not Users

“Realm DATA”
iFrame Controller
Shutdown Routine
Testing Internals

Change Log

Get Realm Starter Working

Transparent Offline Feature

How to make http requests in Realm?


Replay Testing

Tutorial: ToDo App

Realm Testing

Enhance Realm Starter

Double Load Issue

Deploy To Heroku Button

End failure

Realm-Starter Github Template

Proposal: Tracker And Visit

Proposal: Activity Store

Proposal: Bundling

Proposal: Retry On Network Error

Storybook: Editable JSON

Storybook: Notes

Storybook: Reference



Change Log

How to Publish


Code Snippets

Skip rustfmt For Some Section

Close Modal Dialog When Clicked Outside

Ignoring Lints In Python

Ignoring Lints (clippy and rustc warnings) In Rust

Handle DateTime in Rust & Elm

Handle CiText value read in Rust

Transport Enum Type to and fro Rust/Elm through JSON