1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-05-08 01:15:49 +02:00
unleash.unleash/website/docs/quickstart.mdx

126 lines
4.4 KiB
Plaintext

---
title: Quickstart
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
This guide helps you set up Unleash Enterprise in your own environment using [Docker](#set-up-unleash-with-docker). Alternatively, you can sign up for a [cloud-hosted trial instance](https://www.getunleash.io/pricing).
If you are looking to set up the open-source version of Unleash, please refer to the instructions in the [Unleash GitHub repository](https://github.com/Unleash/unleash?tab=readme-ov-file#get-started-with-unleash).
## Set up Unleash with Docker
To start Unleash locally, clone the Unleash repository and start the server with [Docker Compose](https://docs.docker.com/compose/):
```shell
git clone git@github.com:Unleash/unleash.git
cd unleash
docker compose -f docker-compose-enterprise.yml up
```
This pulls the `unleashorg/unleash-enterprise` Docker image and uses a Docker Compose file to configure the Unleash server and its database.
> This step uses `docker compose` (V2 syntax). If you have the older `docker-compose` (V1), use that command syntax instead.
## Log in to the Unleash Admin UI
In your browser, go to [http://localhost:4242](http://localhost:4242) and log in using the following credentials:
- **username**: `admin`
- **password**: `unleash4all`
![Unleash Admin UI log in screen](/img/quickstart-login.png)
## Install your trial license
Request a license by signing up for a self-hosted trial [here](https://www.getunleash.io/pricing). Once you've signed up, you'll receive an email from Unleash containing your trial license key.
In the Admin UI, go to **Admin > License**, copy the license key you received by email and click **Update license key**.
The top banner now displays the number of days you have left on your free trial.
![Unleash Admin UI log in screen](/img/quickstart-license.png)
## Create your first flag
To create your first flag:
1. Open the **Default** project.
2. Click **New feature flag**.
3. Enter a name, and click **Create feature flag**.
For more details on creating feature flags, see [How to create a feature flag](/how-to-create-feature-flag).
## Connect an SDK
Next, use one of the client or server-side [SDKs](/reference/sdks) to connect Unleash with your application.
<Tabs groupId="connect-sdk-quickstart">
<TabItem value="sdk-client-side" label="Connect a client-side SDK">
1. Create a [frontend API token](/reference/api-tokens-and-client-keys#frontend-tokens).
2. Determine your Unleash URL, for example: `http://localhost:4242/api/frontend`.
3. Use the SDK to connect to Unleash in your application.
The following example shows how to use the [JavaScript SDK](/reference/sdks/javascript-browser) to connect to your Unleash instance:
```javascript title="JavaScript SDK"
import { UnleashClient } from "unleash-proxy-client";
const unleash = new UnleashClient({
url: "https://<your-unleash-instance>/api/frontend",
clientKey: "<your-token>",
appName: "<your-app-name>",
});
unleash.on("synchronized", () => {
// Unleash is ready to serve updated feature flags.
// Check a feature flag
if (unleash.isEnabled("some-flag")) {
// do cool new things when the flag is enabled
}
});
```
</TabItem>
<TabItem value="sdk-server-side" label="Connect a server-side SDK">
1. Create a [client API token](/reference/api-tokens-and-client-keys#client-tokens).
2. Determine your Unleash URL, for example: `http://localhost:4242/api`.
3. Use the SDK to connect to Unleash in your application.
The following example shows how to use the [Node.js SDK](/reference/sdks/node) to connect to your Unleash instance:
```javascript title="Node.js SDK"
const { initialize } = require("unleash-client");
const unleash = initialize({
url: "https://<your-unleash-instance>/api",
appName: "<your-app-name>",
customHeaders: {
Authorization: "<your-token>",
},
});
unleash.on("synchronized", () => {
// Unleash is ready to serve updated feature flags.
if (unleash.isEnabled("some-flag")) {
// do cool new things when the flag is enabled
}
});
```
</TabItem>
</Tabs>
## Next steps
Check out our reference documentation that explains the [Unleash architecture](/understanding-unleash/unleash-overview), the different [hosting options](/understanding-unleash/hosting-options) available, and other [core concepts](/reference) you need to get the most out of Unleash.
Explore feature flag best practices and language-specific tutorials in our [developer guides](/topics).