Synced Templates

Synced Templates

What are synced templates?

Synced templates are templates (opens in a new tab) that are created from a GitHub repository, or a folder in a GitHub repository. A synced template stays in sync with its source, so when you create a commit in the GitHub repository, the template will automatically update with the new contents on the next access.


Because synced templates stay in sync with their source, you can't edit a synced template in CodeSandbox. If you want to edit the template, you must commit to the source repository. You could consider that GitHub is the "owner" of the template.

How is a synced template different from CodeSandbox Repositories?

CodeSandbox also has Repositories (opens in a new tab), which are also imported from GitHub repositories. However, there is a key difference between synced templates and repositories.

Repositories are meant for working on a repository. We introduce a workflow to create new branches and pull requests. Synced templates allow you to create a sandbox template from a repository (or folder), and are meant to be used as a template for new sandboxes (or for sharing as an example with others).

A good rule of thumb is that if you want to work on a repository, you should import a repository. If you want to create a template from a repository, you should create a synced template from a GitHub repository.

Creating a synced template

A synced template URL is essentially the same as the GitHub URL, but is replaced with Because of this, you can go to your GitHub repository, and replace with to create a synced template. We have also introduced three helpers to do this more easily: (opens in a new tab)

Directly from the GitHub URL

First, visit the GitHub repository or folder from which you want to create a synced template. The URL should look something like for a repository and for a folder.

Then, replace with and press Enter.

This will redirect you to a URL that looks like or, which is the location of the newly created synced template!

Using our GitHub importer

Go to our "New Sandbox" modal (opens in a new tab) and click on the "Import template" button. Enter the GitHub URL you want to import in the input field and press "Open URL". This will redirect you to the location of the synced template.

Using a Browser Extension

We have browser extensions for Chrome (opens in a new tab) and Firefox (opens in a new tab), which add an 'Open in CodeSandbox' button to GitHub repo pages. This makes it easy to import existing projects from GitHub into CodeSandbox.

Configuring a title, icon & description

By default, we try to infer a synced template's name, description and icon based on the files in the repository. However, you can also configure this manually.

You can configure a title, description and template icon for your synced template in a file called .codesandbox/template.json in your synced template. This file is a JSON file that contains the following properties:

  • title: The title of the template
  • description: The description of the template
  • iconUrl: The icon of the template. This should be a URL to a 64x64 PNG or JPEG image.
  • tags: The tags that will be used for search results. This should be an array of strings.
  • published: Whether the template is published. If this is set to false, the template will not be visible in the template search.

An example template.json could look like this:

// .codesandbox/template.json
  "title": "My Template",
  "description": "This is my template",
  "iconUrl": "",
  "tags": ["react", "typescript"],
  "published": true

All fields are optional—we will infer the missing fields from the repository contents.

After you've created this file and opened the synced template at least once, you can find it in the template search (opens in a new tab) by searching for the title or description.

VM behavior of synced templates

For our Devboxes (opens in a new tab), we run your sandbox in a microVM. We try to automatically detect from your repository contents whether your project is more suited for a Devbox than a browser sandbox. To force the template to load as a Devbox, you can create a .devcontainer/devcontainer.json file in your repository. This file should contain a valid Devcontainer configuration (opens in a new tab) that we'll use to build your Devbox.

We use memory snapshotting to resume a VM quickly when someone visits it. To ensure that visitors of your sandbox will always get the latest contents of your GitHub repository, we base the memory snapshot on the latest commit of your repository or folder.

This means that if you create a new commit in your repository, we will discard the memory snapshot of the synced template and will start the sandbox from scratch on next visit. During the VM boot, we will download the latest file contents from the repository. This ensures that visitors to your sandbox will always get the latest contents of your GitHub repository, but it also means that the first visit of your sandbox after a commit can be slower than usual (only for memory; we do still keep the filesystem between invalidations).