> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dokrypt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Template Marketplace

> Discover, install, and publish templates to the Dokrypt marketplace.

## Overview

The Dokrypt marketplace is a registry for sharing project templates. You can browse community templates, install them locally, and publish your own.

**Registry URL:** `https://hub.dokrypt.com/api/v1`

## Browsing Templates

### Search

```bash theme={null}
# Search locally
dokrypt marketplace search defi

# Search the remote marketplace
dokrypt marketplace search "uniswap" --remote
```

### Browse by Category

```bash theme={null}
dokrypt marketplace browse --category defi --remote
```

Categories: `defi`, `nft`, `dao`, `token`, `basic`

### View Details

```bash theme={null}
dokrypt marketplace info uniswap-v3 --remote
```

## Installing Templates

```bash theme={null}
# From marketplace
dokrypt marketplace install uniswap-v3

# From a local directory
dokrypt marketplace install my-template --from ./my-template-dir
```

Installed templates are stored in `~/.dokrypt/marketplace/`.

Use installed templates with `dokrypt init`:

```bash theme={null}
dokrypt init my-project --template uniswap-v3
```

## Creating Templates

### 1. Scaffold

```bash theme={null}
dokrypt template create my-defi-template
```

### 2. Add Your Files

<Tree>
  <Tree.Folder name="my-defi-template" defaultOpen>
    <Tree.File name="template.yaml" />

    <Tree.File name="dokrypt.yaml.tmpl" />

    <Tree.File name="foundry.toml.tmpl" />

    <Tree.File name="README.md.tmpl" />

    <Tree.Folder name="contracts" defaultOpen>
      <Tree.File name="MyContract.sol" />
    </Tree.Folder>

    <Tree.Folder name="test" defaultOpen>
      <Tree.File name="MyContract.t.sol" />
    </Tree.Folder>

    <Tree.Folder name="scripts" defaultOpen>
      <Tree.File name="deploy.js" />
    </Tree.Folder>
  </Tree.Folder>
</Tree>

### 3. Define Metadata

```yaml theme={null}
# template.yaml
name: my-defi-template
version: "1.0.0"
description: "My awesome DeFi template"
author: your-name
category: defi
difficulty: intermediate
premium: false
price: free
tags: [defi, ethereum, amm]
chains: [ethereum]
services: [ipfs, blockscout]
license: MIT
```

### 4. Use Template Variables

In `.tmpl` files, use Go template syntax:

| Variable             | Example Value | Description         |
| -------------------- | ------------- | ------------------- |
| `{{ .ProjectName }}` | `my-dapp`     | User's project name |
| `{{ .ChainName }}`   | `ethereum`    | Chain name          |
| `{{ .ChainID }}`     | `31337`       | Chain ID            |
| `{{ .Engine }}`      | `anvil`       | Node engine         |
| `{{ .Author }}`      | `dev`         | Author              |

```yaml theme={null}
# dokrypt.yaml.tmpl
version: "1"
name: {{ .ProjectName }}
chains:
  {{ .ChainName }}:
    engine: {{ .Engine }}
    chain_id: {{ .ChainID }}
```

Files ending in `.tmpl` are rendered and the extension is removed. All other files are copied as-is.

### 5. Test Locally

```bash theme={null}
dokrypt marketplace install my-template --from ./my-defi-template
dokrypt init test-project --template my-defi-template
cd test-project
dokrypt up
```

### 6. Publish

```bash theme={null}
cd my-defi-template
DOKRYPT_REGISTRY_TOKEN=your-token dokrypt marketplace publish
```

## Template Metadata Reference

| Field         | Type       | Required | Description                            |
| ------------- | ---------- | -------- | -------------------------------------- |
| `name`        | `string`   | Yes      | Unique template name                   |
| `version`     | `string`   | Yes      | Semantic version                       |
| `description` | `string`   | Yes      | Short description                      |
| `author`      | `string`   | Yes      | Author name                            |
| `category`    | `string`   | No       | `defi`, `nft`, `dao`, `token`, `basic` |
| `difficulty`  | `string`   | No       | `beginner`, `intermediate`, `advanced` |
| `premium`     | `bool`     | No       | Premium template flag                  |
| `price`       | `string`   | No       | Price or "free"                        |
| `tags`        | `string[]` | No       | Searchable tags                        |
| `chains`      | `string[]` | No       | Supported chains                       |
| `services`    | `string[]` | No       | Required services                      |
| `license`     | `string`   | No       | License identifier                     |
| `homepage`    | `string`   | No       | Project homepage URL                   |
| `repository`  | `string`   | No       | Source repository URL                  |

## Managing Installed Templates

```bash theme={null}
# List installed
dokrypt marketplace list

# Remove
dokrypt marketplace uninstall uniswap-v3
```
