:_mod-docs-content-type: REFERENCE
[id="odo-create_{context}"]
= odo create


`odo` uses a link:https://devfile.io[_devfile_] to store the configuration of a component and to describe the component's resources such as storage and services. The _odo create_ command generates this file.

== Creating a component

To create a _devfile_ for an existing project, run the `odo create` command with the name and type of your component (for example, `nodejs` or `go`):

[source,terminal]
----
odo create nodejs mynodejs
----

In the example, `nodejs` is the type of the component and `mynodejs` is the name of the component that `odo` creates for you.

[NOTE]
====
For a list of all the supported component types, run the command `odo catalog list components`.
====

If your source code exists outside the current directory, the `--context` flag can be used to specify the path.
For example, if the source for the nodejs component is in a folder called `node-backend` relative to the current working directory, run the command:

[source,terminal]
----
odo create nodejs mynodejs --context ./node-backend
----

The `--context` flag supports relative and absolute paths.

To specify the project or app where your component will be deployed, use the `--project` and `--app` flags.
For example, to create a component that is part of the `myapp` app inside the `backend` project, run the command:

[source,terminal]
----
odo create nodejs --app myapp --project backend
----

[NOTE]
====
If these flags are not specified, they will default to the active app and project.
====

== Starter projects

Use the starter projects if you do not have existing source code but want to get up and running quickly to experiment with devfiles and components.
To use a starter project, add the `--starter` flag to the `odo create` command.

To get a list of available starter projects for a component type, run the `odo catalog describe component` command.
For example, to get all available starter projects for the nodejs component type, run the command:

[source,terminal]
----
odo catalog describe component nodejs
----

Then specify the desired project using the `--starter` flag on the `odo create` command:

[source,terminal]
----
odo create nodejs --starter nodejs-starter
----

This will download the example template corresponding to the chosen component type, in this instance, `nodejs`.
The template is downloaded to your current directory, or to the location specified by the `--context` flag.
If a starter project has its own devfile, then this devfile will be preserved.

== Using an existing devfile

If you want to create a new component from an existing devfile, you can do so by specifying the path to the devfile using the `--devfile` flag.
For example, to create a component called `mynodejs`, based on a devfile from GitHub, use the following command:

[source,terminal]
----
odo create mynodejs --devfile https://raw.githubusercontent.com/odo-devfiles/registry/master/devfiles/nodejs/devfile.yaml
----

== Interactive creation

You can also run the `odo create` command interactively, to guide you through the steps needed to create a component:

[source,terminal,subs="verbatim,quotes"]
----
$ odo create

? Which devfile component type do you wish to create *go*
? What do you wish to name the new devfile component *go-api*
? What project do you want the devfile component to be created in *default*
Devfile Object Validation
 ✓  Checking devfile existence [164258ns]
 ✓  Creating a devfile component from registry: DefaultDevfileRegistry [246051ns]
Validation
 ✓  Validating if devfile name is correct [92255ns]
? Do you want to download a starter project *Yes*

Starter Project
 ✓  Downloading starter project go-starter from https://github.com/devfile-samples/devfile-stack-go.git [429ms]

Please use `odo push` command to create the component with source deployed
----

You are prompted to choose the component type, name, and the project for the component. You can also choose whether or not to download a starter project. Once finished, a new `devfile.yaml` file is created in the working directory.

To deploy these resources to your cluster, run the command `odo push`.
