Project Templates

Automate the creation and configuration of Doppler Projects.

Learn how to use Project Templates for automating the creation of environments and secrets for a Project in Doppler with a single-click or CLI command.

1280

Template File

Creating a template is easy and straightforward with the complexity and size of the template depending on the number of environments, configs, and variables required.

🚧

Don't hard-code secrets in your template file, even if in a private repository.

To get started, create the expected filename doppler-template.yaml in the root of your repository, then let's take a look at a simple generic example you can use as the basis for your own template:

projects:
  - name: your-project # Name may contain lowercase letters, spaces, numbers, hyphens, and underscores
    description: Your project description

    # List of totally customizable environments, e.g Test, Stage, QA, CI-CD
    environments:
      - name: Development # Name may contain letters, spaces, numbers, hyphens, and underscores
        slug: dev # Slug may contain letters, numbers, hyphens, and underscores
        configs:
          - slug: dev # First slug *must* match environment slug name

      - name: CI-CD
        slug: ci-cd
        configs:
          - slug: ci-cd
          - slug: ci-cd_github # Branch configs supported
          - slug: ci-cd_gitlab

      - name: Test
        slug: test
        configs:
          - slug: test

      - name: Production
        slug: prd
        configs:
          - slug: prd

    # Define secrets for each environment
    secrets:
      dev:
        ENV: development
        API_KEY: ""

      ci-cd:
        DOCKER_HUB_USERNAME: ""
        DOCKER_HUB_TOKEN: ""

      test:
        ENV: development
        API_KEY: ""

      prd:
        ENV: production
        API_KEY: ""

Once the doppler-template.yaml file has been committed to your repository, you're ready to use it by building the import URL for the Doppler dashboard.

Dashboard Import

Importing a Project Template through the dashboard requires creating an import URL that consists of two parts:

  1. Doppler import endpoint: <https://dashboard.doppler.com/workplace/template/import>
  2. The template query parameter with the URI encoded URL to your doppler-template.yaml file

A fully-formed import URL for a GitHub repository would look similar to the following:

# Subtitute 'YourOrg', 'your-repo' and 'your-branch'
https://dashboard.doppler.com/workplace/template/import?template=https%3A%2F%2Fgithub.com%2FYourOrg%2Fyour-repo%2Fblob%2Fyour-branch%2Fdoppler-template.yaml

Opening the URL then triggers the following to occur:

  1. Ensure the user is signed in or prompt them to create an account
  2. Confirm which Workplace the project will be created in
  3. Validate the template
  4. Create the defined Project, Configs, and Variables
  5. Navigate to the Project's home page

Import Button

We recommend using our Import to Doppler button in your README.md or documentation to use in conjunction with the import URL. Here is an example from our App Config Templates repository:

Import to Doppler

[![Import to Doppler](https://raw.githubusercontent.com/DopplerUniversity/app-config-templates/main/doppler-button.svg)](https://dashboard.doppler.com/workplace/template/import?template=https%3A%2F%2Fgithub.com%2FDopplerUniversity%2Fapp-config-templates%2Fblob%2Fmain%2Ftemplates%2Fgeneric.yaml)

CLI Import

Once the doppler-template.yaml file has been added to the root of your repository, you can import with a single Doppler CLI command:

doppler import

Then configure the CLI to use the created project and optionally open the Doppler dashboard to the Project home page:

doppler setup
doppler open dashboard

Sample Templates

Visit our App Config Templates repository on GitHub for a growing list of example templates.

You can also see how we use Project Templates in our sample applications:

πŸ“˜

Is there an application you'd like to see an example template for?

You can create an issue or better yet, contribute a template of your own through a Pull Request.

Supported Code Hosts

The following code host URLs are supported:

  • gist.github.com
  • gist.githubusercontent.com
  • github.com
  • githubusercontent.com
  • gitlab.com
  • bitbucket.org

πŸ‘

Awesome Work!

Now you know how to use Doppler Templates to make setting up a new project with one-click or a single command.