---
updatedAt: 2025-06-03T20:36:46.000Z
agentTools:
  projectIndex: https://docs.ol-hub.com/llms.txt
---

# ol create template

Generate Service source code based on a project and a solution

## Description

Templates are used by the [**ol generate**](https://ol-hub.readme.io/docs/ol-generate) command to render the source code files of the generated service. They are written in the FreeMarker Template Language (FTL) and contain the boilerplate source code of the generated service. The [**ol generate**](https://ol-hub.readme.io/docs/ol-generate) command uses the Apache FreeMarker™ template engine to process the templates and render the service source code. Every generator has a template set from which the service source code files are generated.

The **ol create template** command enables you to create custom template files that either override the prepackaged generator template set or supplement them. 

## Syntax

 ol create template \[OPTIONS]

### Example

```Text Windows
> ol create template --name test_template.ftl --source d: \tmp\text.ftl --target-path text2. txt -f
```
```Text macOS
$ ol create template --name test_template.ftl --source d: \tmp\text.ftl --target-path text2. txt -f
```

### Extended Description

When you create a template, specify the new template's name, the file that will serve as the initial source of the new template, the name of the file generated from the template, and its location in the generated service folder. 

In the below example, the new template's name is **test\_template.ftl**, the source of the template is **text.ftl**, and once the service is generated, the file rendered from **test\_template ftl** will reside in the root of the service folder under the name **text.txt**. 

```Text Windows
> ol create template --name test_template.ftl --source d: \tmp\text.ftl --target-path text2. txt -f
```
```Text macOS
$ ol create template --name test_template.ftl --source d: \tmp\text.ftl --target-path text2. txt -f
```

The command will perform the following:

* The file **test\_template.ftl**  is added to your local templates folder at .ol/cli/templates.
* The new template is registered in templates.config located at .ol/cli/templates.

After you generate a service with the [**ol generate**](https://ol-hub.readme.io/docs/ol-generate) command, the FTL engine will process the template and generate text.txt in the root of the service folder. 

> ❗️ If the value of the **--name** option has an extension other than \*.ftl, the generated file will not be processed by the FTL engine. In that case, the file specified as the value of the **--source** option will only be copied to the generated service folder.

## Rules

* Login to the OL Hub.

## Options

#### --name

The name of the newly created template. If the **--name** parameter is omitted, the **--source** filename is used.

#### --force, -f

Force-override the newly created template, if a template with such a name already exists.

#### --templates-path

The location of the folder which contains the custom templates and the templates configuration file (the **template.config** file). If you omit the **--source** option, the folder will be created by default under **.ol/cli/**.

#### --source

The path to the file that provides the initial content to the created template. If you omit the **--source** option, the template will be created with only the default header. 

#### --target-path, -t

The path to the file generated from the new template by the [**ol generate**](https://ol-hub.readme.io/docs/ol-generate) command. The path is relative to the newly created service root folder.