# Template Provider

**Last Updated:** 2026-01
**Confidence:** High

> **Evolution:** This documents the current single-template system. See [Composable Monorepo](../features/composable-monorepo.md) for the upcoming monorepo architecture.

## Summary

TemplateProvider seeds new repos with project templates. Includes .woodpecker.yml, .claude/ configuration, and stack-specific files.

**Key Facts:**
- Templates stored in `deployments/k8s/base/templates/`
- Seeded via Gitea API file creation
- Variable interpolation: `{{PROJECT_NAME}}`, `{{DOMAIN}}`
- Available templates: `default`, `astro-landing`, `go-api`

**File Pointers:**
- Port: `internal/port/template_provider.go`
- Adapter: `internal/adapter/gitea/templates.go`
- Templates: `deployments/k8s/base/templates/`

## Port Interface

```go
type TemplateProvider interface {
    SeedRepo(ctx context.Context, owner, repo, templateName string, vars map[string]string) error
    ListTemplates(ctx context.Context) ([]TemplateInfo, error)
}

type TemplateInfo struct {
    Name        string
    Description string
    Stack       string // "astro", "go", "nextjs", etc.
}
```

## Template Structure

```
templates/
├── default/
│   ├── .woodpecker.yml
│   ├── .claude/
│   │   └── CLAUDE.md
│   └── README.md
├── astro-landing/
│   ├── .woodpecker.yml
│   ├── .claude/
│   │   └── CLAUDE.md
│   ├── package.json
│   ├── astro.config.mjs
│   ├── src/pages/index.astro
│   ├── Dockerfile
│   └── nginx.conf
└── go-api/
    ├── .woodpecker.yml
    ├── .claude/
    │   └── CLAUDE.md
    ├── go.mod
    ├── main.go
    └── Dockerfile
```

## API Usage

```json
POST /project
{
    "name": "myapp",
    "template": "astro-landing"
}
```

## Related Topics

- [Composable Monorepo](../features/composable-monorepo.md) - Upcoming monorepo architecture
- [Infrastructure Management](../features/infrastructure.md)
- [Project Service](./project-service.md)
