Skip to content


Welcome to the installation guide for Cobra Accounts, follow this guide to get started with Cobra Accounts.

Server Setup

You start by setting up your server infrastructure to support Cobra Accounts.

Before you continue: Please download and follow the instructions for setting up a database with Cobra Database. You can follow the instructions here.

Configuring the Environment

The server configuration relies on environment variables and the secret service to get email credentials and more. Follow these steps carefully to setup your server environment.

Secrets Configuration

To ensure proper operation of the system, the following secrets must be configured in the Cobra Secrets service (http://localhost:21300/ if you're running it locally):

  • ACCOUNTS_BASE_URL: Specifies the base URL for the account service. For testing purposes, you can use http://localhost:21302/. In production or behind a reverse proxy, set this to the public base URL to ensure that email confirmation links sent to users are accessible over the internet.

  • ADMIN_USERNAMES: Defines a comma-separated list of administrator usernames. If you have not created an account yet, this can be left empty. Otherwise, populate it with the relevant admin usernames (e.g., Username1,Username2).

  • EMAIL: The email address used for sending out emails from your system, such as

  • EMAIL_PASSWORD: The password for the email account specified above.

  • EMAIL_DISPLAY_NAME: Represents the name that appears as the sender of the emails, typically your product or company name.

  • EMAIL_HOST: The SMTP server host for sending emails.

  • EMAIL_PORT: The port number used by your email SMTP server, commonly set to 587.

  • EMAIL_ENABLE_SSL: Indicates whether to use SSL for email communication (true or false). It is recommended to keep this enabled for enhanced security.

Environment Variables

The server configuration relies on an .env file, which houses various environment variables for the Docker containers. Begin by unzipping the zip file found within the ByteCobra/Accounts directory that you imported into your Unity project. This zip file contains all the necessary code and configuration files needed to set up and run the server. Ensure you extract the contents to a designated workspace or project directory where you plan to operate your server.

After extracting the package, find the .env file within the unzipped folder and make sure that the following variables are set correctly:

  • MASTER_KEY: This is the access key required for interacting with the secret service. It must match the key specified within the .env file located in the unzipped Cobra Database package.

Launching the Containers

Go to the unzipped folder where the docker-compose.yml file is located and run the following script in CMD or a terminal:

docker-compose -p bytecobra build --no-cache && docker-compose -p bytecobra up -d

To confirm that the containers are operational, you can inspect the status of the containers either through the Docker Desktop interface by navigating to the 'Containers' tab or by executing the docker ps command in your terminal.

Verifying API Operation

To confirm the API is up and running and available on your machine you can also check in the browser:

Setting Up Admin Accounts

Finally, configuring at least one admin account is recommended, especially before transitioning to a production environment.

To establish your initial admin account:

  1. Use the Swagger interface to create a new user, i.e. go to http://localhost:21302/ in your web browser and use the Account/create endpoint to create your account (press the Try It Out button).
  2. Add the newly created username to the ADMIN_USERNAMES secrets.
  3. Restart the API to ensure that all changes are active.
  4. Login to your account via the Swagger interface, i.e. use the Account/login endpoint.
  5. If you use two factor authentication, you may have to use the Account/login-2fa endpoint as well, after receiving the verification code.
  6. Once logged in, try accessing one of the admin endpoints, for example Admin/get-roles with your own username or email as the ID. If you don't encounter a 401 Unauthorized error, your admin privileges are active.

Unity Setup

Once your server is up and running you can open the Unity project in which you imported Cobra Accounts, then go to Assets/Byte Cobra/Accounts/Resources/Account Configuration. Click on the scriptable object and set the base url of your server in the inspector.

Now you should be able to use the client-side scripts to interact with your server. Check out the usage section for more information.