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

# Quickstart

> This document describes how to get started with Flipt v2.

## Setup

Before getting started, make sure the Flipt server is up and running on your
host on your chosen ports.

<CodeGroup>
  ```console Binary theme={null}
  curl -fsSL https://get.flipt.io/v2 | sh
  ```

  ```console Docker theme={null}
  docker run -d \
      -p 8080:8080 \
      -p 9000:9000 \
      -v $HOME/flipt:/var/opt/flipt \
      docker.flipt.io/flipt/flipt:v2
  ```
</CodeGroup>

In this example, we'll use the default location of [http://localhost:8080](http://localhost:8080).

<Tip>
  **Quick Configuration**: If you want to quickly set up Flipt with Git storage
  and SCM integration, you can use the interactive [`flipt
      quickstart`](/v2/cli/commands/quickstart) command. The wizard will guide you
  through configuring your Git repository and authentication.
</Tip>

## Environments and Namespaces

Flipt v2 introduces the concept of environments in addition to namespaces.

By default, Flipt v2 will create a single environment called `default` along with the `default` namespace.

<img src="https://mintcdn.com/flipt/S0FBUVs51BbnWAiF/v2/images/quickstart/environments.png?fit=max&auto=format&n=S0FBUVs51BbnWAiF&q=85&s=1315272bc8621669b3030bcbd6926586" alt="Environments" width="2880" height="1800" data-path="v2/images/quickstart/environments.png" />

Environments are managed via configuration files. See the [Environments](/v2/concepts#environments) documentation for more.

## Flags and Variants

First, we'll create a flag and variants that we will use to evaluate against in the default environment and namespace.

### Create a Flag

A flag is the basic entity in Flipt. Flags can represent features in your
applications that you want to enable/disable for your users.

To create a flag:

1. Open the UI at [http://localhost:8080](http://localhost:8080).
2. Click `New Flag`.
3. Select the `Variant` type.
4. Populate the details of the flag as you wish.
5. Click `Enabled` so the flag will be enabled once created.
6. Click `Create`.

<img src="https://mintcdn.com/flipt/S0FBUVs51BbnWAiF/v2/images/quickstart/create_flag.png?fit=max&auto=format&n=S0FBUVs51BbnWAiF&q=85&s=242223d0a68b46ff690a998a44bb5119" alt="Create Flag" width="2880" height="1800" data-path="v2/images/quickstart/create_flag.png" />

### Create Variants

Variants allow you to return different values for your flags based on rules that
you define.

To create a variant:

1. On the page for the flag you just created, click `Create Variant`.
2. Populate the details of the variant as you wish.
3. Click `Add`.
4. Click `Update` to save the flag and variants.

<img src="https://mintcdn.com/flipt/S0FBUVs51BbnWAiF/v2/images/quickstart/create_variant.png?fit=max&auto=format&n=S0FBUVs51BbnWAiF&q=85&s=709945c0e685b45a5f6d52a4f2ac112a" alt="Create Variant" width="2880" height="1800" data-path="v2/images/quickstart/create_variant.png" />

Click `Flags` in the navigation menu and you should now see your newly created
flag in the list.

## Segments and Constraints

Next, we'll create a segment with a constraint that will be used to determine the
reach of your flag.

### Create a Segment

Segments are used to split your user base into subsets.

To create a segment:

1. From the navigation click `Segments`.
2. Click `New Segment`.
3. Populate the details of the segment as you wish.
4. Click `Create`.

<img src="https://mintcdn.com/flipt/S0FBUVs51BbnWAiF/v2/images/quickstart/create_segment.png?fit=max&auto=format&n=S0FBUVs51BbnWAiF&q=85&s=b78b183b505e051751d428f3b0a06903" alt="Create Segment" width="2880" height="1800" data-path="v2/images/quickstart/create_segment.png" />

### Create a Constraint

Constraints are used to target a specific segment.

<Note>
  Constraints aren't required to match a segment. A segment with no constraints
  will match every request by default.
</Note>

To create a constraint:

1. On the page for the segment you just created, click `Create Constraint`.
2. Populate the details of the constraint as you wish.
3. Click `Add`.
4. Click `Update` to save the segment and constraint.

<img src="https://mintcdn.com/flipt/S0FBUVs51BbnWAiF/v2/images/quickstart/create_constraint.png?fit=max&auto=format&n=S0FBUVs51BbnWAiF&q=85&s=2a2dcfbc4add1ffa652a11fb1c559cd7" alt="Create Constraint" width="2880" height="1800" data-path="v2/images/quickstart/create_constraint.png" />

Click `Segments` in the navigation menu and you should now see your newly
created segment in the list.

## Rules and Distributions

Finally, we'll create a rule defining a distribution for your flag and variants.
Rules allow you to define which variant gets returned when you
evaluate a specific flag that falls into a given segment.

### Create a Rule

To create a rule:

1. Go back to the flag you created at the beginning.
2. Scroll down and click the `Rules` tab.
3. Click `New Rule`.
4. Next to `Segment` choose or search for the segment you created earlier.
5. Next to `Type` choose `Multi-Variate`.
6. You should see the variants you created earlier, with a percentage assigned to each.
7. Click `Add`.
8. Click `Update` to save the rule.

<img src="https://mintcdn.com/flipt/S0FBUVs51BbnWAiF/v2/images/quickstart/create_rule.png?fit=max&auto=format&n=S0FBUVs51BbnWAiF&q=85&s=e01d29d657f5d5f93bb0376946c5d6af" alt="Create Rule" width="2880" height="1800" data-path="v2/images/quickstart/create_rule.png" />

A distribution is a way of assigning a percentage for which entities evaluated
get a specific variant. The higher the percentage assigned, the more likely it
is that any entity will get that specific variant.

<Note>
  You could just as easily have picked `Single Variant` instead of
  `Multi-Variate` when setting up your rule. This would effectively mean you
  have a single distribution, a variant with `100%` chance of being returned.
</Note>

## Evaluation Playground

After creating the above flag, segment and targeting rule, you're now ready to
test how this would work in your application.

The Flipt UI contains an Evaluation Playground to allow you to experiment
with different requests to see how they would be evaluated.

The main ideas behind how evaluation works are described in more detail in the
[Concepts](/v2/concepts#evaluation) documentation.

To test evaluation:

1. Navigate to the `Playground` page from the main navigation.
2. Select or search for the flag you created earlier.
3. Notice that the `Entity ID` field is pre-populated with a random UUID. This represents
   the ID that you would use to uniquely identify entities (ex: users) that you
   want to test against your flags.
4. Click `Evaluate`.
5. Note the pane to the right has been populated with the evaluation
   response from the server, informing you that this request would match the
   segment that you created earlier, and return one of the variants defined.
6. Experiment with different values for the `Request Context` and `Entity ID` fields.

<img src="https://mintcdn.com/flipt/S0FBUVs51BbnWAiF/v2/images/quickstart/evaluation_playground.png?fit=max&auto=format&n=S0FBUVs51BbnWAiF&q=85&s=0ac6e2a61c5c8af0d4f9135d12b61dcd" alt="Evaluation Playground" width="2880" height="1800" data-path="v2/images/quickstart/evaluation_playground.png" />

That's it! You're now ready to integrate Flipt into your applications and start
defining your flags and segments that will enable you to seamlessly rollout
new features to your users while reducing risk.
