# Templates

Templates are written in [Terraform](https://developer.hashicorp.com/terraform/intro) and define the underlying infrastructure that all Coder workspaces run on.

The [template builder](/docs/@main/templates/creating-templates/#template-builder) is the recommended way to create templates.
It guides you through selecting base infrastructure, adding modules, and configuring your template without writing Terraform.

## Learn the concepts

While templates are written in standard Terraform, it's important to learn the Coder-specific concepts behind templates.
The best way to learn the concepts is by [creating a basic template from scratch](/docs/@main/templates/template-from-scratch/).
If you are unfamiliar with Terraform, see [HashiCorp's Tutorials](https://developer.hashicorp.com/terraform/tutorials) for common cloud providers.

## Create a template

The fastest way to get started is with the [template builder](/docs/@main/templates/creating-templates/#template-builder), which composes a working template from a base infrastructure template and optional registry modules.
Starter templates for popular platforms (AWS, Kubernetes, Docker, and others) are available as base templates in the builder, or through the [CLI](/docs/@main/templates/creating-templates/#cli).

<a id="extending-templates"></a>

## Extend templates

It's often necessary to extend the template to make it generally useful to end users.
Common modifications are:

* Your image(s) (for example, a Docker image with languages and tools installed).
  Docs: [Image management](/docs/@main/templates/managing-templates/image-management/).
* Additional parameters (for example, disk size, instance type, or region).
  Docs: [Template parameters](/docs/@main/templates/extending-templates/parameters/).
* Additional IDEs (for example, JetBrains) or features (for example, dotfiles, Remote Desktop Protocol (RDP)).
  Docs: [Adding IDEs and features](/docs/@main/templates/extending-templates/).

Learn more about the various ways you can [extend your templates](/docs/@main/templates/extending-templates/).

## Best Practices

We recommend starting with a universal template that can be used for basic tasks.
As your Coder deployment grows, you can create more templates to meet the needs of different teams.

* [Image management](/docs/@main/templates/managing-templates/image-management/): Learn how to create and publish images for use within Coder workspaces & templates.
* [Dev Containers integration](/docs/@main/admin/integrations/devcontainers/integration/): Enable native dev containers support using `@devcontainers/cli` and Docker.
* [Envbuilder](/docs/@main/admin/integrations/devcontainers/envbuilder/): Alternative approach for environments without Docker access.
* [Nix(OS)](/docs/@main/admin/integrations/nix/): Define environments with Nix flakes, with or without NixOS.
* [Template hardening](/docs/@main/templates/extending-templates/resource-persistence/#-bulletproofing): Configure your template to prevent certain resources from being destroyed (for example, user disks).
* [Manage templates with Ci/Cd pipelines](/docs/@main/templates/managing-templates/change-management/): Learn how to source control your templates and use GitOps to make sure template changes are reviewed and tested.
* [Permissions and Policies](/docs/@main/templates/template-permissions/): Control who can access and modify your template.
* [External Workspaces](/docs/@main/templates/managing-templates/external-workspaces/): Learn how to connect your existing infrastructure to Coder workspaces.

<Callout type="warn" title="Warning">
  Envbuilder is in **maintenance mode** with no new features planned.

  The recommended way to use dev containers in Coder is the built-in [Dev Containers Integration](/docs/@main/admin/integrations/devcontainers/integration/).
  To find the best approach for your deployment, join the [Coder community](https://coder.com/community) to be guided towards the best approach.
</Callout>

<children></children>
