Create a project from a template

Optional path: use it when you want a ready-made scaffold. To create a project from scratch and submit an Issue, see Step 1.

Choose a built-in template, create a repository on your Git platform, and have Grape host it and apply a scene automatically; includes the Mood Tracker example.

Create from template creates a new code repository under your GitCode / GitHub / Gitee account, writes the template code into it, hosts it in Grape automatically, and applies the scene that corresponds to the template.

What it creates is not an empty "Grape project", but:

New code repository (template files)
  + Grape hosting record
  + Template scene (Agent × Skill)
  + Project analysis task

1. When to use it

Your situation Suitable
First experience; you want to see a complete pipeline as soon as possible Yes; choose the Hello World template
You want to create a new project from scratch without writing the scaffold by hand Yes; choose the template for the matching technology stack
You already have a repository and only want to connect it to Grape No; use Host an existing repository
You want to modify existing code No; clone or host the original repository directly

2. Where templates are

The template library is in the console after you sign in, not on the website home page. The home page only introduces the product and does not show templates you can create.

Entry points:

  1. Sign in to the console.
  2. Open any repository, then click Back to Repository Hall at the top.
  3. The top has three tabs: My projects / Project templates / Workbench.
  4. Click Project templates.

You can also open:

https://<your-domain>/app/#repos

At the bottom of the My projects page there is also a Create from template section, which also leads to the template cards.

The current template library has 8 categories by purpose:

Category Suitable for
Hello World starter templates A first run-through; includes small projects such as Mood Tracker
General project templates General engineering scaffolds
Mobile development project templates Mobile projects
Cloud-native development Containers, K8s, microservices
IaC development Infrastructure code such as Terraform
Skill development project templates Writing and validating Skills
AI application project templates Agent / AI applications
Content creation project templates Documentation and content projects

If the Project templates tab is not visible in the Repository Hall, first confirm that you are signed in and have bound at least one Git platform. If it is still missing, check whether a template library is configured in the current environment.

3. Example: create a project with Mood Tracker

Walk through the built-in Hello World starter template → Mood Tracker.

This template is a Flask mood-tracking application that contains:

  • Home page: record a mood, view the list and statistics
  • 5 HTTP endpoints
  • Unit tests
  • README and quick-start instructions

After creation you get a new code repository, for example:

<your-space>/mood-tracker/
├── app.py
├── requirements.txt
├── test_app.py
├── onboarding-tasks.json
├── README.md
└── preview.html

The repository automatically uses the hello-world scene; the template code and README come from the built-in template, so you do not need to start from an empty directory.

4. Procedure

1. Prepare code platform credentials

One-click creation creates the repository under your code platform account, so valid platform credentials are required:

  • You are already signed in with GitCode / GitHub / Gitee, or
  • You bound an access token for the corresponding platform in Settings → Credentials

If no credentials are available, creation returns 400. Self-hosted environments also need a platform Bot Token; hosted editions usually have it configured. For platform integration, see GitCode integration, GitHub integration, and Gitee integration.

2. Open the templates page

  1. Click Back to Repository Hall at the top.
  2. Click Project templates in the Repository Hall.
  3. You can also click Create from template at the bottom of the My projects page.

3. Select a template

  1. Select the category Hello World starter templates.
  2. Find Mood Tracker.
  3. Open the template and read the README and pipeline description first.
  4. Click Create from template.

On a template card, Local template means the code comes from a built-in Grape example; Cloud template means it comes from a remote repository. This example is a local template.

4. Fill in repository information

Field Value in this example Description
Platform GitCode / GitHub / Gitee Select a platform with bound credentials
Owner space Personal space, or a group/subgroup A personal space creates the repository directly under the account; a group requires permissions
Repository name mood-tracker Letters, digits, underscores, and hyphens only
Visibility Public or private A private group cannot create a public repository; the platform requires you to switch to private

Do not reuse the name of an existing non-empty repository; an empty repository with the same name may be reused, but a non-empty repository causes the template write to fail.

5. Create and wait for the result

After you click create, the following happens in order:

  1. Grape creates the repository on the code platform.
  2. Grape writes the template files into the repository.
  3. Grape hosts the repository automatically and creates a webhook.
  4. Grape applies the template scene.
  5. Grape analyzes the project asynchronously and generates onboarding Issues.

After the page reports that project <space>/mood-tracker was created and hosted successfully, confirm the result in the repository Workbench.

Completion criteria:

  • [ ] The mood-tracker repository appears on the code platform.
  • [ ] Template files such as README, app.py, and test_app.py exist.
  • [ ] The repository shows Hosted in Grape.
  • [ ] The scene is hello-world, and nodes are bound to engines.
  • [ ] Issues created automatically by onboarding appear in the project.

5. Three things to do after creation

  1. Read the README: confirm the start method, endpoints, and test command.
  2. Read the onboarding Issues: template analysis generates experience and exploration Issues.
  3. Run one Issue: select an Issue to enter the pipeline and observe VOD → Issue → Coding → QA → SRE.

The Mood Tracker README also provides two follow-up exercises: add an /api/export endpoint and add tests for the export feature. You can create Issues for them directly.

6. What actually happens during creation

Step What happens What happens on failure
Create repository Creates a repository under your platform account A duplicate name or insufficient permissions return an error
Write template Pushes the template directory to the default branch If the default branch is protected, Grape pushes to a temporary branch
Host Creates a webhook and imports the repository A webhook failure produces a hosting warning
Apply scene Overrides the default scene with the template's scene_id Scene application fails, but the repository still exists
Project analysis Analyzes the structure in the background and generates Issues You can create Issues manually later; the repository remains usable

When the default branch is protected: the template code may be pushed to a temporary branch, and the default branch remains empty. The prompt gives the branch name; merge that branch into the default branch before the repository has template content.

Hosting warning: if the prompt says the bot is not a maintainer, add the Bot as a maintainer in the repository's member management settings, then host the repository again manually.

7. Common failures

Symptom Cause Action
400: no available platform GitCode / GitHub / Gitee credentials are not bound Sign in or bind a platform Token first
400: invalid repository name Contains spaces, Chinese characters, or special characters Use letters, digits, underscores, and hyphens
409: write to a same-name repository failed A non-empty repository with the same name already exists Use another repository name, or handle the existing repository first
502: repository created but template write failed Platform Token, Bot permissions, or network problem Check the prompt and platform permissions; after fixing them, host the repository manually on the repository management page
Creation succeeds but the Workbench is empty The template was pushed to a temporary branch Merge the temporary branch into the default branch as prompted
No onboarding Issues The analysis task failed or is still running Check the task logs; you can also create Issues manually

8. Do the same with the API

Suitable for scripted batch repository creation. The example still uses Mood Tracker:

export BASE=https://<your-grape-domain>
export T=<grape_ API key or tk_ session token>

curl -s -X POST "$BASE/api/project-templates/create" \
  --oauth2-bearer "$T" \
  -H "Content-Type: application/json" \
  -d '{
    "template_id": "hello-flask",
    "repo_name": "mood-tracker",
    "provider": "gitcode",
    "owner": "",
    "private": true
  }'
Field Description
template_id hello-flask corresponds to Mood Tracker
repo_name New repository name; leave empty to use the template default name
provider gitcode / github / gitee; leave empty to select a bound platform automatically
owner Owner space; leave empty for a personal space, or set group or group/sub for a group
private true for private, false for public

Check the following in the response:

  • full_name: Full name of the new repository
  • webhook_id: Non-zero means hosting succeeded
  • host_warning: Hosting warning
  • pushed_to: Branch where the template code was pushed
  • scene_id: Applied scene

Workbench and Issue Center | Scenes and engine configuration | How an Issue moves through the pipeline | Project template API