== Getting Started

The best way of getting started is using the `jooby console`. It is a small application that generates
Jooby projects very quickly.

**Features**

- Maven or Gradle build
- Java or Kotlin application
- Script or MVC routes
- Jetty, Netty or Undertow application
- Uber/Fat jar or https://github.com/fizzed/stork[Stork native launcher]
- Dockerfile

To install the console:

- Download https://repo1.maven.org/maven2/io/jooby/jooby-cli/{joobyVersion}/jooby-cli-{joobyVersion}.zip[jooby-cli.zip]
- Unzip `jooby-cli.zip` in your user home directory (or any other directory you prefer to)
- Find the native launchers in the `bin` directory

[TIP]
====
You might want to add the native launcher `bin/jooby` or `bin/jooby.bat` to system path variable.
So its globally accessible from any location.
====

[NOTE]
====
To simplify documentation we use `jooby` as command. Windows users must use `jooby.bat`
====

.Setting workspace:
[source, bash]
----
jooby set -w ~/Source
----

All code will be saved inside the `~/Source` directory.

Workspace directory is ready!

Now type `jooby` hit ENTER.

After prompt type `help create`:

.jooby
[source, bash]
----
jooby> help create
Missing required parameter: <name>
Usage: jooby create [-dgikms] [--server=<server>] <name>
Creates a new application
      <name>              Application name or coordinates (groupId:artifactId:
                            version)
  -d, --docker            Generates a Dockerfile
  -g, --gradle            Generates a Gradle project
  -i                      Start interactive mode
  -k, --kotlin            Generates a Kotlin application
  -m, --mvc               Generates a MVC application
  -s, --stork             Add Stork Maven plugin to build (Maven only)
      --server=<server>   Choose one of the available servers: jetty, netty or
                            undertow
jooby> 
----

The `create` command generates a Jooby application. Some examples:

.Creates a Maven Java project:
[source, bash]
----
jooby> create myapp
----

.Creates a Maven Kotlin project:
[source, bash]
----
jooby> create myapp --kotlin
----

.Creates a Gradle Java project:
[source, bash]
----
jooby> create myapp --gradle
----

.Creates a Gradle Kotlin project:
[source, bash]
----
jooby> create myapp --gradle --kotlin
----

Maven and Java are the default options but you can easily override those with `-g -k` or `-gk` (order doesn't matter).
Along with the build and language the `create` command adds two test classes: `UnitTest` and `IntegrationTest`.

Passing the `-m` or `--mvc` generates a MVC application:

.Creates a Maven Java Mvc project:
[source, bash]
----
jooby> create myapp --mvc
----

The `--server` option, allow you to choose between: (J)etty, (N)etty or (U)ndertow:

.Creates a Maven Java Project using Undertow:
[source, bash]
----
jooby> create myapp --server undertow
----

Maven/Gradle configuration generates an `uber/fat` jar at package time. Maven builds supports
generation of https://github.com/fizzed/stork[Stork launchers].

.Creates a Maven Java Project with stork launchers:
[source, bash]
----
jooby> create myapp --stork
----

There is a `-d` or `--docker` option which generates a `Dockerfile`

.Creates a docker file:
[source, bash]
----
jooby> create myapp --docker
----

The default package in all these examples is set to `app`, to get fully control of groupId, package, version, etc... Use the interactive mode:

.Interactive mode:
[source, bash]
----
jooby> create myapp -i
----

=== Code Snippets

For simplicity and brevity we are going to skip the `runApp` function and extending `Jooby`.
A code example will looks like:

.Snippet
[source, java, role = "primary"]
----
{
  get("/", ctx -> "Snippet");
}
----

.Kotlin
[source, kotlin, role = "secondary"]
----
{
  get("/") { "Snippet" }
}
----

The use of `application class` or `runApp function` will be included when is strictly necessary.
