Using the CLI to export builder spaces to your filesystem

There are many reasons why you may want to import a space to your filesystem:

  • Archiving a snapshot of your space at a moment in time that you can spin to a new space
  • Building space templates for specific codebases

To import a space to your filesystem:

  1. Copy your space private key from account settings ( or generate one if you don’t have one already)

  2. Install @builder.io/cli globally using npm:

npm install @builder.io/cli -g
  1. Use the cli to import your space from the command line, by passing the private key and your output directory in the next command
builder import -k [PRIVATE KEY] -o [OUTPUT DIRECTORY]

And now you’re done! You can take this space and commit it along your code if you’re building a starter template, or just save it for archiving purposes.

Then you can create a new space out of this template using:

builder create --key [ROOT ORG Private Key] --name [NEW SPACE NAME] --debug

Thanks for sharing. But it seems like the builder create command requires the flag input so that Builder know which directory to create a new space.

For example, this command:

builder create --key <ORG PRIVATE KEY> --name <SPACE NAME> --debug

will result in ENOENT error: “no such file or directory, open ‘./builder/settings.json’”

becuase builder assumes that the space directory is ./builder, but my directory is named differently.