1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00
unleash.unleash/website/docs/quickstart.mdx

145 lines
4.7 KiB
Plaintext
Raw Normal View History

2024-10-25 11:12:05 +02:00
---
title: Quickstart
---
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
This guide helps you set up Unleash in just a few minutes. The fastest way to get started is by using [Docker](#set-up-unleash-with-docker). If Docker doesn't work for you, see [other ways to try Unleash](#additional-ways-to-try-unleash).
## Set up Unleash with Docker
### Start Unleash locally
To start Unleash locally, clone the [Unleash repository](https://github.com/Unleash/unleash) and start the server with Docker Compose:
```shell
git clone git@github.com:Unleash/unleash.git
cd unleash
docker compose up -d
```
### 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)
### 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.
1. Create an API token:
- For client-side SDKs, use a [frontend token](/reference/api-tokens-and-client-keys#front-end-tokens).
- For server-side SDKs, use a [client token](/reference/api-tokens-and-client-keys#client-tokens).
2. Determine your Unleash URL:
- For client-side SDKs, use `<your-unleash-instance>/api/frontend`.
- For server-side SDKs, use `<your-unleash-instance>/api`.
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) and the [Node.js SDK](/reference/sdks/node) to connect to your Unleash instance:
<Tabs groupId="connect-sdk-quickstart">
<TabItem value="sdk-client-side" label="Connect a client-side SDK">
```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">
```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>
## Other ways to try Unleash
### Unleash demo instance
You can also use the [Unleash demo instance](https://app.unleash-hosted.com/demo/) to test different use cases before setting up your own instance. The demo instance is available at `https://app.unleash-hosted.com/demo/`.
2024-10-25 11:12:05 +02:00
To run tests on this instance, use the following API URLs and keys:
- **Client-side:**
- API URL: `https://app.unleash-hosted.com/demo/api/frontend`
- Frontend key: `demo-app:default.bf8d2a449a025d1715a28f218dd66a40ef4dcc97b661398f7e05ba67`
- **Server-side:**
- API URL: `https://app.unleash-hosted.com/demo/api`
- Client key: `56907a2fa53c1d16101d509a10b78e36190b0f918d9f122d`
To test the credentials and retrieve feature flags, run this command:
```shell
curl https://app.unleash-hosted.com/demo/api/client/features \
-H "Authorization: 56907a2fa53c1d16101d509a10b78e36190b0f918d9f122d"
```
### Other local setup options
For other ways to get started locally, see the steps for [starting an Unleash server](using-unleash/deploy/getting-started#start-unleash-server).
## Hosting Unleash
#### Hosted by Unleash
With our [Pro](/availability#plans) and [Enterprise](https://www.getunleash.io/pricing) plans, you can run Unleash in the cloud by using our hosted offerings.
2024-10-25 11:12:05 +02:00
#### Self-hosted
Self-hosting Unleash is available for [Open Source](https://www.getunleash.io/pricing) and [Enterprise](https://www.getunleash.io/pricing) customers. Visit [Self-hosting Unleash](/using-unleash/deploy) to learn more.
2024-10-25 11:12:05 +02:00
## Next steps
Check out our reference documentation that explains all [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).