Prerequisites
- TerminusDB running locally (install guide)
- Access to the remote database you want to clone
What you'll achieve By the end of this guide, you will have cloned a remote database to your local TerminusDB instance — like git clone for databases.
Cloning creates a full local copy of a remote database, including all documents, schema, and commit history. You can then modify your clone independently and synchronise changes with pull or push.
Clone a public database
Clone the Star Wars database from the public data server:
Example: TypeScript
const clonePublicDb = async () => {
client.remoteAuth({ type: "basic", user: "public", key: "public" })
const cloneDetails = {
remote_url: "https://data.terminusdb.org/public/star-wars",
label: "Star Wars",
comment: "Cloned from public data server",
}
await client.clonedb(cloneDetails, "star-wars")
console.log("Database cloned successfully")
}Example: Python
from terminusdb_client import Client
client = Client("http://localhost:6363")
client.connect(user="admin", key="root", team="admin")
client.clone(
"https://data.terminusdb.org/public/star-wars",
"star-wars",
remote_auth={"type": "basic", "user": "public", "key": "public"},
)curl -u admin:root -X POST \
"http://localhost:6363/api/clone/admin/star-wars" \
-H "Content-Type: application/json" \
-H "Authorization-Remote: Basic cHVibGljOnB1YmxpYw==" \
-d '{
"remote_url": "https://data.terminusdb.org/public/star-wars",
"label": "Star Wars",
"comment": "Cloned from public data server"
}'You now have a local copy of the Star Wars database with its full commit history.
Clone a private database
If the database is not public, provide an API token. For example, to clone from a DFRNT Hub team:
Example: TypeScript
const clonePrivateDb = async () => {
client.remoteAuth({ type: "token", key: "YOUR_API_TOKEN_HERE" })
const cloneDetails = {
remote_url: "https://cloud.dfrnt.com/MyTeam/MyTeam/mydb",
label: "My Database",
comment: "Cloned from DFRNT Hub",
}
await client.clonedb(cloneDetails, "my_local_copy")
console.log("Private database cloned successfully")
}Example: Python
from terminusdb_client import Client
client = Client("http://localhost:6363")
client.connect(user="admin", key="root", team="admin")
client.clone(
"https://cloud.dfrnt.com/MyTeam/MyTeam/mydb",
"my_local_copy",
remote_auth={"type": "token", "key": "YOUR_API_TOKEN_HERE"},
)curl -u admin:root -X POST \
"http://localhost:6363/api/clone/admin/my_local_copy" \
-H "Content-Type: application/json" \
-H "Authorization-Remote: Token YOUR_API_TOKEN_HERE" \
-d '{
"remote_url": "https://cloud.dfrnt.com/MyTeam/MyTeam/mydb",
"label": "My Database",
"comment": "Cloned from DFRNT Hub"
}'Next steps
- Pull updates — fetch new commits from the remote
- Push changes — send your local changes to the remote
- Branch — create a feature branch on your clone