Skip to content

Commit 5554283

Browse files
docs(CONTRIBUTING): add template contributing guide for new and existing templates (#181)
## Description Add contributing guide for new and existing templates --- ## Type of Change - [ ] New module - [ ] Bug fix - [ ] Feature/enhancement - [X] Documentation - [ ] Other --------- Co-authored-by: Atif Ali <[email protected]>
1 parent fa939bb commit 5554283

File tree

1 file changed

+183
-9
lines changed

1 file changed

+183
-9
lines changed

CONTRIBUTING.md

Lines changed: 183 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ Welcome! This guide covers how to contribute to the Coder Registry, whether you'
44

55
## What is the Coder Registry?
66

7-
The Coder Registry is a collection of Terraform modules that extend Coder workspaces with development tools like VS Code, Cursor, JetBrains IDEs, and more.
7+
The Coder Registry is a collection of Terraform modules and templates for Coder workspaces. Modules provide IDEs, authentication integrations, development tools, and other workspace functionality. Templates provide complete workspace configurations for different platforms and use cases that appear as community templates on the registry website.
88

99
## Types of Contributions
1010

1111
- **[New Modules](#creating-a-new-module)** - Add support for a new tool or functionality
12+
- **[New Templates](#creating-a-new-template)** - Create complete workspace configurations
1213
- **[Existing Modules](#contributing-to-existing-modules)** - Fix bugs, add features, or improve documentation
14+
- **[Existing Templates](#contributing-to-existing-templates)** - Improve workspace templates
1315
- **[Bug Reports](#reporting-issues)** - Report problems or request features
1416

1517
## Setup
@@ -36,7 +38,15 @@ bun install
3638

3739
### Understanding Namespaces
3840

39-
All modules are organized under `/registry/[namespace]/modules/`. Each contributor gets their own namespace (e.g., `/registry/your-username/modules/`). If a namespace is taken, choose a different unique namespace, but you can still use any display name on the Registry website.
41+
All modules and templates are organized under `/registry/[namespace]/`. Each contributor gets their own namespace with both modules and templates directories:
42+
43+
```
44+
registry/[namespace]/
45+
├── modules/ # Individual components and tools
46+
└── templates/ # Complete workspace configurations
47+
```
48+
49+
For example: `/registry/your-username/modules/` and `/registry/your-username/templates/`. If a namespace is taken, choose a different unique namespace, but you can still use any display name on the Registry website.
4050

4151
### Images and Icons
4252

@@ -136,15 +146,171 @@ git push origin your-branch
136146
137147
---
138148

139-
## Contributing to Existing Modules
149+
## Creating a New Template
150+
151+
Templates are complete Coder workspace configurations that users can deploy directly. Unlike modules (which are components), templates provide full infrastructure definitions for specific platforms or use cases.
152+
153+
### Template Structure
154+
155+
Templates follow the same namespace structure as modules but are located in the `templates` directory:
156+
157+
```
158+
registry/[your-username]/templates/[template-name]/
159+
├── main.tf # Complete Terraform configuration
160+
├── README.md # Documentation with frontmatter
161+
├── [additional files] # Scripts, configs, etc.
162+
```
163+
164+
### 1. Create Your Template Directory
165+
166+
```bash
167+
mkdir -p registry/[your-username]/templates/[template-name]
168+
cd registry/[your-username]/templates/[template-name]
169+
```
170+
171+
### 2. Create Template Files
172+
173+
#### main.tf
174+
175+
Your `main.tf` should be a complete Coder template configuration including:
176+
177+
- Required providers (coder, and your infrastructure provider)
178+
- Coder agent configuration
179+
- Infrastructure resources (containers, VMs, etc.)
180+
- Registry modules for IDEs, tools, and integrations
181+
182+
Example structure:
183+
184+
```terraform
185+
terraform {
186+
required_providers {
187+
coder = {
188+
source = "coder/coder"
189+
}
190+
# Add your infrastructure provider (docker, aws, etc.)
191+
}
192+
}
193+
194+
# Coder data sources
195+
data "coder_workspace" "me" {}
196+
data "coder_workspace_owner" "me" {}
197+
198+
# Coder agent
199+
resource "coder_agent" "main" {
200+
arch = "amd64"
201+
os = "linux"
202+
startup_script = <<-EOT
203+
# Startup commands here
204+
EOT
205+
}
206+
207+
# Registry modules for IDEs, tools, and integrations
208+
module "code-server" {
209+
source = "registry.coder.com/coder/code-server/coder"
210+
version = "~> 1.0"
211+
agent_id = coder_agent.main.id
212+
}
213+
214+
# Your infrastructure resources
215+
# (Docker containers, AWS instances, etc.)
216+
```
217+
218+
#### README.md
219+
220+
Create documentation with proper frontmatter:
221+
222+
```markdown
223+
---
224+
display_name: "Template Name"
225+
description: "Brief description of what this template provides"
226+
icon: "../../../../.icons/platform.svg"
227+
verified: false
228+
tags: ["platform", "use-case", "tools"]
229+
---
230+
231+
# Template Name
232+
233+
Describe what the template provides and how to use it.
234+
235+
Include any setup requirements, resource information, or usage notes that users need to know.
236+
```
237+
238+
### 3. Test Your Template
239+
240+
Templates should be tested to ensure they work correctly. Test with Coder:
241+
242+
```bash
243+
cd registry/[your-username]/templates/[template-name]
244+
coder templates push [template-name] -d .
245+
```
246+
247+
### 4. Template Best Practices
248+
249+
- **Use registry modules**: Leverage existing modules for IDEs, tools, and integrations
250+
- **Provide sensible defaults**: Make the template work out-of-the-box
251+
- **Include metadata**: Add useful workspace metadata (CPU, memory, disk usage)
252+
- **Document prerequisites**: Clearly explain infrastructure requirements
253+
- **Use variables**: Allow customization of common settings
254+
- **Follow naming conventions**: Use descriptive, consistent naming
255+
256+
### 5. Template Guidelines
257+
258+
- Templates appear as "Community Templates" on the registry website
259+
- Include proper error handling and validation
260+
- Test with Coder before submitting
261+
- Document any required permissions or setup steps
262+
- Use semantic versioning in your README frontmatter
263+
264+
---
265+
266+
## Contributing to Existing Templates
267+
268+
### 1. Types of Template Improvements
269+
270+
**Bug fixes:**
271+
272+
- Fix infrastructure provisioning issues
273+
- Resolve agent connectivity problems
274+
- Correct resource naming or tagging
275+
276+
**Feature additions:**
277+
278+
- Add new registry modules for additional functionality
279+
- Include additional infrastructure options
280+
- Improve startup scripts or automation
281+
282+
**Platform updates:**
140283

141-
### 1. Find the Module
284+
- Update base images or AMIs
285+
- Adapt to new platform features
286+
- Improve security configurations
287+
288+
**Documentation:**
289+
290+
- Clarify prerequisites and setup steps
291+
- Add troubleshooting guides
292+
- Improve usage examples
293+
294+
### 2. Testing Template Changes
295+
296+
Testing template modifications thoroughly is necessary. Test with Coder:
142297

143298
```bash
144-
find registry -name "*[module-name]*" -type d
299+
coder templates push test-[template-name] -d .
145300
```
146301

147-
### 2. Make Your Changes
302+
### 3. Maintain Compatibility
303+
304+
- Don't remove existing variables without clear migration path
305+
- Preserve backward compatibility when possible
306+
- Test that existing workspaces still function
307+
- Document any breaking changes clearly
308+
309+
---
310+
311+
## Contributing to Existing Modules
312+
313+
### 1. Make Your Changes
148314

149315
**For bug fixes:**
150316

@@ -166,7 +332,7 @@ find registry -name "*[module-name]*" -type d
166332
- Add missing variable documentation
167333
- Improve usage examples
168334

169-
### 3. Test Your Changes
335+
### 2. Test Your Changes
170336

171337
```bash
172338
# Test a specific module
@@ -176,7 +342,7 @@ bun test -t 'module-name'
176342
bun test
177343
```
178344

179-
### 4. Maintain Backward Compatibility
345+
### 3. Maintain Backward Compatibility
180346

181347
- New variables should have default values
182348
- Don't break existing functionality
@@ -208,6 +374,7 @@ bun test
208374
We have different PR templates for different types of contributions. GitHub will show you options to choose from, or you can manually select:
209375

210376
- **New Module**: Use `?template=new_module.md`
377+
- **New Template**: Use `?template=new_template.md`
211378
- **Bug Fix**: Use `?template=bug_fix.md`
212379
- **Feature**: Use `?template=feature.md`
213380
- **Documentation**: Use `?template=documentation.md`
@@ -224,6 +391,13 @@ Example: `https://github.com/coder/registry/compare/main...your-branch?template=
224391
- `main.test.ts` - Working tests
225392
- `README.md` - Documentation with frontmatter
226393

394+
### Every Template Must Have
395+
396+
- `main.tf` - Complete Terraform configuration
397+
- `README.md` - Documentation with frontmatter
398+
399+
Templates don't require test files like modules do, but should be manually tested before submission.
400+
227401
### README Frontmatter
228402

229403
Module README frontmatter must include:
@@ -304,7 +478,7 @@ When reporting bugs, include:
304478

305479
## Getting Help
306480

307-
- **Examples**: Check `/registry/coder/modules/` for well-structured modules
481+
- **Examples**: Check `/registry/coder/modules/` for well-structured modules and `/registry/coder/templates/` for complete templates
308482
- **Issues**: Open an issue for technical problems
309483
- **Community**: Reach out to the Coder community for questions
310484

0 commit comments

Comments
 (0)