Horizon

Hyphen's Edge server

Run Horizon in your environment and at the edge for fast, secure access to your feature flags and secrets.

Self Hosting

You can self-host instances of Horizon on your own infrastructure to add redundancy and reduce latency.

When you self-host Horizon, start by creating an API key and grant it access to the projects you’ll run. Horizon uses this key to make calls to Hyphen, so it must have permission for every resource your projects require.


Create an API Key

Open the Hyphen Dashboard app and navigate to settings > API Keys

Create a new API Key, giving it project collaborator access to the projects that will be accessed through yourself hosted instance. Don't forget to save the secret some place safe as it will not be shown to you again.

Environment Variables

Horizon uses environment variables, some required and show not, that you may want to customize

NameDescriptionRequired
API_KEYUsed to authenticate with Hyphen servicesYes
HYPHEN_BASE_URLHyphen may provide you with your own URL, if that is the case use this variable to adjust Horizon's behavior.No

Local Docker

This is useful for testing locally and making sure everything is working. You may use whatever port mapping you like.

docker run `
  -e API_KEY={you_key} `
  -p {pick_a_port}:3333 us-docker.pkg.dev/hyphenai/public/horizon:latest `
  -t horizon
docker run \
  -e API_KEY={you_key} \
  -p {pick_a_port}:3333 us-docker.pkg.dev/hyphenai/public/horizon:latest \
  -t horizon

Deploying to the cloud

Google Cloud

Open the cloud console and navigate to Cloud Run and then Create

Make the Following Selections

  • Deploy using Artifact Registry / Docker Hub
  • use the container Image url of us-docker.pkg.dev/hyphenai/public/horizon:latest
  • Give the service a meaning, to you, name
  • Uncheck Use IAM to authenticate incoming requests

Make the Following Selections

  • If you'd like to use a different port do so, but this is optional as Horizon respects the $PORT variable
  • Add the API key secret are an Environment Variable called API_KEY
  • Click Create

Azure Container Apps

Open the Azure portal and navigate to Container App and create a new one

Make the Following Selections

  • Choose the correct Subscription
  • Choose the correct Resource Group or create a new one
  • Choose the correct region
  • Choose an existing App Environment or create a new one
  • Click Next

Make the Following Selections

  • Give The Container App a meaningful, to you, name
  • Select Docker Hub or other registeries
  • Image type is public
  • login server is us-docker.pkg.dev
  • Image and Tag is hyphenai/public/horizon:latest
  • Add an environment variable with the name API_KEY and the value of the API Key Secret you just created.
  • Click Next

Make the Following Selections

  • Enable ingress
  • Accept traffic from anywhere
  • Target Port should be 3333
  • Click Review + Create

Hyphen Deploy

Coming Soon, you'll be able to deploy Horizon directly with Hyphen Deploy!

Configuring the SDK

Configuring the SDKs is dependent on which SDK you are using. As such you should look at the documentation for the specific API. Bellow is an example of using the Hyphen Node SDK

  const options = {
    publicApiKey: config.hyphenPublicKey,
    applicationId: '{YOUR_APP}',
    context: { targetingKey: 'anonymous', },
		// this my also be the URL of a load balancer, balancing multiple instances 
    uris: ['{URL_OF_YOUR_INSTANCE}'] 
  };

  const toggle = new Toggle(options);