Setting up a template repository

A template repository is a Git repository that contains starter templates you created that your team can use to develop applications.

This means that, within an organization or team, you can set up template repositories with Cloud Code, custom to your organization, to offer a standard set of starter applications, services, and infrastructure configuration that others can use. This helps align new projects with your organization's preferred technical stack and standards, and encourages the incorporation of best practices at the beginning of the development cycle.

A template repository can be an existing repository of application templates you've already created or a brand new set of templates you'd like others to use. You'll only need to add a Template Descriptor file to the repository to import it with Cloud Code.

When ready, template repositories are easy to share with your team; they'll need Cloud Code set up and the Git URL of the template repository to use. For private Git repositories, only members that have access to the repository can use the underlying custom templates.

To see an example of how a template repository might be set up, reference this sample repository.

Creating a new template repository

If you'd like to create a brand new template repository to use, follow these steps:

  1. Create a new Git repository.

    Your Git repository can be hosted either remotely or live on your local machine. This example uses a brand new GitHub repository, 'my-template-repository'.

    GitHub repository creation interface with repository name field filled with 'my-template-repository'

  2. Add template directories to this repository.

    Your template directories can contain anything and be located anywhere you want within the repository. In this example, two template directories, 'template1' and 'template2', containing a readme file each have been added to 'my-template-repository'.

    A readme file with instructions on how best to use your custom templates is highly recommended.

    'my-template-repository' with two underlying template directories, 'template1' and 'template2'

  3. Create a Template Descriptor file.

    A Template Descriptor file provides Cloud Code with information on your template to properly create your application. This file must be named .cctemplate, located in your root directory, and must have the schema defined in the Template Descriptor file schema section.

Using an existing repository

If you'd like to use an existing repository, you'll still need to create a Template Descriptor file. This file provides Cloud Code with information on your template to properly create your application.

Your Template Descriptor file must be named .cctemplate, located in your root directory, and must have the schema defined in the Template Descriptor file schema section.

Template Descriptor schema

Key Description Type
metadata Metadata used by Cloud Code to read. Conforms to the Metadata Schema. Metadata
templates Array of templates contained in a repository. Objects in this array should conform to the Template Schema. Array<Template>
name (optional) Name of the template repository. String

Example

{
   "metadata":{
      "version":"1"
   },
   "name": "My Template Repository",
   "templates":[
      {
         "path":"/path/to/template1_location",
         "name":"My Template 1",
         "description":"The first template of its name."
      },
      {
         "path":"/path/to/template2_location",
         "name":"My Template 2",
         "description":"The sequel."
      }
   ]
}

Template schema

Key Description Type
path Where the template is located within a repository.

The path is interpreted as being from the root of the repository.

String
name Name of a template.

This is displayed in an IDE when selecting a template to base an application on.

String
description (optional) Description of a template.

This is displayed in an IDE when selecting a template to base an application on.

String

Example

{
   "path":"path/to/template1",
   "name":"My Template 1",
   "description":"The first template of its name."
}

Metadata schema

Key Description Type
version The version of the template schema being used. Currently, the only valid version is 1. String

Example

{
   "version":"1"
}

Getting Support

To send feedback, report issues on GitHub, or ask a question on Stack Overflow.