Preview. .sola is still in development and can change between versions. Readers skip sections they don't know, so files keep loading across minor versions.
Why a page format
Every visit to an ordinary web page repeats the same work: parse the HTML, parse every style sheet, parse and translate every script. A .sola file ships the result of that work. solac compiles a page once; the browser decodes it straight into the DOM.
It is served as a normal content type, application/sola, negotiated with Accept (Sola sends application/sola;q=0.95). So one URL can serve HTML to every browser and .sola to Sola.
What it gains
Measured on a large production Angular app (6.6 MB of minified JavaScript) over a 10 Mbit/s, 50 ms link:
| Bytes by load end | First visit | Repeat visit | |
|---|---|---|---|
| HTML + Brotli 11 | 1.41 MB | 2094 ms | 782 ms |
.sola (default) | 0.91 MB | 1417 ms | 643 ms |
- First paint after about 30 KB of a multi-megabyte file.
- A repeat visit to an unchanged page: one request of 51 bytes.
- After a deploy that changed one component: 137 KB, against 1.45 MB for HTML + gzip.
File layout
Header and table integers are little-endian. Inside sections, integers are LEB128 varints and strings are length-prefixed UTF-8.
header 32 bytes magic "SOLA\r\n\x1a\n" (8) | u16 major | u16 minor | u32 flags
| u32 section count | 12 reserved bytes
table 40 bytes per section: u32 id | u32 codec | u64 offset | u64 stored length
| u64 raw length | u32 CRC-32 of the raw bytes | u32 reserved
sections back to back at their offsets
digest 32 bytes SHA-256 of everything before it (also the HTTP ETag)Versioning
The current version is 1.1. Readers skip unknown section ids. A new section is a minor version; a change to an existing section is a major version.
Header flags
| Bit | Name | Meaning |
|---|---|---|
1 | STREAM | Sections are in streaming order, HASHES first. |
2 | SPLIT | Some sections live in separate files (EXTERNAL). |
4 | SIGNED | The file carries a SIG section. |
Section codecs
| Codec | Meaning |
|---|---|
0 | raw |
1 | one Horizon stream at the web level (built-in web dictionary) |
2 | chunked: parts over 256 KB cut by content into 16–256 KB chunks, each raw, hz, or hz primed by the previous four chunks |
3 | primed: hz coded after the last 1 MB of earlier sections of its group (tree parts) |
Sections
| Id | Section | Content |
|---|---|---|
| 1 | META | key/value strings: source, title, generator, versions |
| 2 | STRINGS | deduplicated string table: tags, attributes, text |
| 3 | TREE | pre-order node stream (elements, text, comments, doctype; shadow roots inline) |
| 4 | STYLES | per style sheet: hash, length, rules in binary form |
| 5 | SCRIPTS | per script: source hash, kind, strict mode, precompiled code |
| 6 | ASSETS | same-origin resources: URL relative to the page, MIME type, body |
| 7 | SOURCE | optional original HTML (fallback) |
| 8 | HASHES | first in 1.1: per section its codec, lengths, CRC-32 and SHA-256 |
| 9 | ASSETS_LATE | images, video, audio |
| 10 | SIG | optional Ed25519 signature |
| 11 | EXTERNAL | sections stored in separate .solas files: (id, URL) |
| 12 | ASSET_URLS | the URLs the file carries, so other requests aren't held back |
| 13 | BLOB_INDEX | per blob: key, codec, lengths, CRC-32, offset, SHA-256 |
| 14 | SCRIPT_URLS | scripts whose source is in LAZY |
| 15 | LAZY | sources and stack positions, fetched blob by blob with HTTP Range |
| 256 + k | tree part k | continuation of the node stream (up to 40 parts) |
Container sections (SCRIPTS, ASSETS, ASSETS_LATE, LAZY) are stored raw with a packed index. Each blob is compressed on its own, and only if that makes it smaller, so images and fonts stay as they are.
Streaming
With the STREAM flag, sections come in this order, so the browser can paint the head before the rest arrives:
HASHES SIG? EXTERNAL? META ASSET_URLS SCRIPT_URLS? BLOB_INDEX STRINGS TREE STYLES
(the head: enough to paint)
tree parts... ASSETS ASSETS_LATE SCRIPTS SOURCE? LAZY? digestEvery resource is used as soon as its own bytes match their SHA-256. With --split, big sections go to content-addressed files (_sola/<kind>-<sha256>.solas) that can be cached forever and are never fetched twice.
Signatures
A file can be signed with Ed25519 over its section hashes. The signed message is:
"sola-signature-v1\0" origin "\0" key-id "\0" signed-at (u64 LE) SHA-256(HASHES section)Public keys are published at /.well-known/sola-keys:
{"keys":[{"id":"k1","alg":"Ed25519","key":"<base64url>"}]}Updates as deltas
Sola supports Compression Dictionary Transport (RFC 9842): the previous version of a page is the dictionary for the next. Besides Brotli deltas (dcb) there is an hz variant, dch: magic FF 44 43 48, the dictionary's SHA-256, version 1, then long copies from the dictionary and the remaining literals as one hz stream.
Compiling with solac
solac loads a page once, headless, and records what the engine parsed: the DOM before scripts run, every style sheet, the code of each script and all same-origin resources. The page behaves exactly as the source: same script order, same events, same stack-trace positions.
solac page.html -o page.sola # one page
solac site/ -o out/ --split # a folder, big sections as separate files
solac http://localhost:8080/ -o index.sola # a running dev server
solac --code startup|full|none # how much code to precompile (default: startup)
solac --embed-source # keep the HTML as a fallback
solac --info page.sola # what's inside
solac keygen -o site # signing keys
solac sign page.sola --key site.key --origin https://example.org
solac delta old.sola new.sola -o new.dch # a delta between versionsWith the default --code startup, only functions that ran while recording are precompiled; the rest compile from source on their first call.
Safety limits
Readers treat every .sola file as untrusted. Sola's reader caps a file at 512 MB, a decoded section at 256 MB, all decoded data at 1 GB, 64 sections, 4 million nodes and a tree depth of 4096. Precompiled code goes through a verifier before it runs, and a script whose code fails the checks is compiled from its source instead. Malformed input is an error, never a crash.