Synchronization
This page explains how Nuxt Studio keeps your content synchronized between the browser (your production site) and your GitHub repository.
Architecture Overview
The self-hosted Nuxt Studio module uses a three-tier system for storage:
Production Database (SQLite WASM)
When the application loads in the browser, Nuxt Content v3 downloads a SQLite database dump from the server and initializes a local WASM database.
This local database contains all content from the content/ directory of your deployed branch.
Draft Storage (IndexedDB)
Studio maintains a separate draft layer using unstorage, backed by IndexedDB.
When you edit content, your changes are stored as drafts in this layer.
Each time the Studio app loads, these drafts are merged with the SQLite database to render a drafted version of your production site.
GitHub Repository
When you publish, Studio commits your draft changes directly to your GitHub repository through the GitHub API.
Your CI/CD pipeline then rebuilds and redeploys your site automatically.
How Synchronization Works
Initial Load
Database Initialization
Nuxt Content downloads the SQLite database dump generated during the build process.
This file contains all parsed content from your content/ directory.
Draft Recovery
Studio checks IndexedDB for any existing drafts from previous sessions and loads them into the SQLite database.
Preview
Studio refreshes the site preview so you can view your latest drafts and edits directly on your production website.
Editing Content
When you modify content in Studio:
Draft Modification
Changes are saved immediately in IndexedDB as draft items with a status of created, modified, or deleted.
Database Update
The local SQLite database is updated to include your draft content, allowing instant visual preview.
Conflict Detection
Studio compares your draft content against the latest version on GitHub to detect possible conflicts.
Conflicts can occur when:
- Someone pushes a commit that modifies the same file and its version is currently building.
- A deployment fails or hasn’t completed, leaving the production database out of date and unsync with GitHub.
Publishing Changes
When you publish your edits:
Draft Collection
Studio gathers all draft items that contain changes.
GitHub Commit
Using the GitHub API, Studio creates a new commit with all updated files.
Deployment Trigger
Your CI/CD platform detects the commit and automatically rebuilds and redeploys your website.
Deployment Wait
After publication, Studio clears the local drafts and waits for the deployment to complete.
During this time, a loading state is shown while the production SQLite database catches up with your latest commit.