Skip to main content
Repos is now in Public Beta! Reach out to us at info@relace.ai if you have any questions or need help with the integration.
If you have a base repo as a starting point for your agent, it’s recommended to turn it into a template Relace repo.
1

Make a Template Repo

Create a Relace repo from your base codebase and save the repo_id:
import { Relace } from "@relace-ai/relace";

const client = new Relace({ apiKey: "YOUR_API_KEY" });

const templateRepo = await client.repo.create({
    source: {
        type: "git",
        url: "https://github.com/relace-ai/vite-template",
        branch: "main"
    },
    auto_index: true // Required for semantic search
});

const templateRepoId = templateRepo.repo_id;
console.log(`Template repository created with ID: ${templateRepoId}`);
2

Create Repo from Relace Template

Now you can use the saved template_repo_id to quickly create new Relace repos:
import { Relace } from "@relace-ai/relace";

const client = new Relace({ apiKey: "YOUR_API_KEY" });

const newRepo = await client.repo.create({
    source: {
        type: "relace",
        repo_id: templateRepoId,
    },
    auto_index: true, // Required for semantic search
    metadata: {} // Optional: add any custom properties
});

console.log(`New repository created with ID: ${newRepo.repo_id}`);
Repo creation with a Relace template is nearly instantaneous, as you no longer pay the latency cost of transferring these base files over the network.