# Quick Start

<figure><img src="https://4257661311-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkpyTqJi517UiwFJJRydZ%2Fuploads%2Fgit-blob-beb91aaee1e149d86be475ba6e84bc41402c4499%2Fflow-manager-light%20(1).png?alt=media" alt=""><figcaption><p>Flow Manager</p></figcaption></figure>

<figure><img src="https://4257661311-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkpyTqJi517UiwFJJRydZ%2Fuploads%2Fgit-blob-89b486077352237a195fc22a8a07e0ecf181c313%2Fdesigner-light%20(2).png?alt=media" alt=""><figcaption><p>Designer</p></figcaption></figure>

Create the `html` demo below and follow the steps ahead to learn the essentials.

```markup
<html lang="en">
<head>
  <meta charset="UTF-8">
  <script src="https://my.YOURTENANT.appmixer.cloud/appmixer/appmixer.js"></script>
</head>
<body>
  <div id="flow-manager"></div>
  <div id="designer"></div>

  <script async type="module">
    const appmixer = new Appmixer()

    appmixer.set('baseUrl', BASE_URL)

    try {
        const auth = await appmixer.api.signupUser(USERNAME, PASSWORD)
        appmixer.set('accessToken', auth.token)
    } catch (error) {
        alert(error)
    }

    const flowManager = appmixer.ui.FlowManager({ el: '#flow-manager' })
    const designer = appmixer.ui.Designer({ el: '#designer' })

    flowManager.on('flow:open', flowId => {
        flowManager.close()
        designer.set('flowId', flowId)
        designer.open()
    })

    flowManager.open()
  </script>
</body>
</html>
```

1. Get `Appmixer` constructor from `appmixer.js` file and create a new instance:

```html
  <script src="https://my.YOURTENANT.appmixer.cloud/appmixer/appmixer.js"></script>
```

```javascript
const appmixer = new Appmixer()
```

2\. Set `baseUrl` to connect the API module to the REST API of your engine:

```javascript
appmixer.set('baseUrl', BASE_URL)
```

3\. Create a new user and set `accessToken` to authorize your `appmixer` instance:

```javascript
const auth = await appmixer.api.signupUser(USERNAME, PASSWORD)
appmixer.set('accessToken', auth.token)
```

Change `USERNAME`(e.g. `example@domain.com`) and `PASSWORD`(e.g. `12345678`) parameters to valid credentials for registration of a new user. Or use an authentication method if the user already exists:

```javascript
const auth = await appmixer.api.authenticateUser(USERNAME, PASSWORD)
```

{% hint style="info" %}
`The`token is used by Appmixer to identify the user. Store the token and credentials in a database of your product. This way, you can always associate your users with the (virtual) ones created for Appmixer.
{% endhint %}

4\. Create new instances of **Flow Manager** and **Designer** widgets:

```html
<div id="flow-manager"></div>
<div id="designer"></div>
```

```javascript
const flowManager = appmixer.ui.FlowManager({ el: '#flow-manager' })
const designer = appmixer.ui.Designer({ el: '#designer' })
```

5\. Open **Flow Manager** to browse the flows and switch to **Designer** when a flow is selected:

```javascript
flowManager.open()

flowManager.on('flow:open', flowId => {
    flowManager.close()
    designer.set('flowId', flowId)
    designer.open()
})
```
