Explanation
RavenDB
How Strife keeps your content in RavenDB and how your site reads it: a database per team, a read-only client certificate, the Content/ByUrl index that strife push deploys, and what Strife leaves to you.
Strife stores content in RavenDB, a document database. Your site reads its content straight from RavenDB, usually through one of Strife's SDKs, so it helps to know how the pieces fit together.
A database per team
Each team in Strife has its own RavenDB database. Every page and other document your editors create in Studio is stored as a document in that database. Editors write to it through Studio; your site only reads from it.
How your site connects
Your site needs four values:
- the RavenDB node URLs (
STRIFE_DATABASE_URLS) - the name of your team's database (
STRIFE_DATABASE) - a client certificate, as a base64-encoded PFX bundle (
STRIFE_CERTIFICATE), and its password (STRIFE_CERTIFICATE_PASSWORD)
When you set up a project with the Strife CLI, it issues the certificate and writes all four values to .env as a single STRIFE_SECRET. @strifeapp/astro reads either form, and uses STRIFE_SECRET when both are set. The certificate can read your team's database and nothing else: it can't change content, and it can't reach another team's data. See step 6 of the Astro tutorial for the values in full.
STRIFE_SECRET and STRIFE_CERTIFICATE contain the certificate's private key, so treat them like a password:
- Keep them out of version control. The CLI adds
.envto.gitignorefor you. - Set them as server-side secrets in your host's environment settings when you deploy.
- Never send them to the browser.
@strifeapp/astroreads them on the server when a page is requested, and never builds them into your site's files. With another framework, read them only in server code.
What your site reads
Your site doesn't look documents up one by one. It queries the content index Content/ByUrl, which has one row per document and language, with the page's address resolved from the pages it sits under. You find a page by its url, docId or collection.
Drafts, working copies and snapshots are rows in the same index, each marked by its status, so the index tells your site which version a row is. Index URL describes the rows, and Label Groups how to query by label.
What strife push deploys
strife push compiles your schemas and deploys them to your team: first the templates, then the content index, and, if you have configured them, the team's language settings. Studio builds the editor panel from the templates, and your site queries the index.
With an SDK or without
- Astro:
@strifeapp/astroconnects and queries for you. See Astro. - Node.js: the
ravendbpackage, with the values above. See Node.js. - .NET: the RavenDB .NET client. See .NET.
Any RavenDB client can read the database with the certificate. For queries beyond what the guides show, see RavenDB's documentation.
Search
Strife doesn't provide a full-text search index for your site, and the read-only certificate your site uses can't add one. Contact Strife if your site needs search.