Nightscout in Northflank

Too complicated? Not what you’re looking for?

Consider a hosted Nightscout service! Check for easier solutions here.


You can create your new Northflank Nightscout site with a MongoDB Atlas database or with its own Northflank database.


  • Nightscout fits in the free tier

  • Easy to deploy or migrate an existing site from Heroku

  • Simple to use and troubleshoot

  • Can use a native Northflank MongoDB database ($)


  • The Nightscout address generated for your site is impossible to remember

Set up a new Nightscout

Create your Northflank and GitHub accounts from a computer.


Do not change device/computer/browser during the setup process!
If you have unexpected issues when creating your site, restart with another browser.

Step 0: Create a database


Make sure you created one before starting your Nightscout web app creation with Northflank. Come back here when you have a MONGODB_URI connection string.


Copy the connection string from your previous platform: edit the variables and look for MONGODB_URI. If you don’t see MONGODB_URI but see MONGO_CONNECTION (NOT MONGO_COLLECTION): use its value.

Step 1: Create a GitHub account and fork the Nightscout project

Do you have a GitHub account?

Create a GitHub account

a) Click this link to create a GitHub account:

Enter your email and click Sign up for GitHub


b) Enter a password and a username (anything you want and that is accepted, not very important).
Type n to decline advertisement emails.


c) Play and solve the puzzle then click Create account


d) GitHub will send you a verification code. Open your mail and check your inbox (check your spam-folder if not received after a couple of minutes).


e) If a personalization sequence starts, click Skip personalization at the bottom.


f) Leave the page that opened as it is. Don’t close it.


You have created your GitHub account. Now fork the Nightscout project.

Fork the Nightscout project

a) Click here to log in at GitHub:
Enter your username or email and your password. Click Sign in


If you already have a fork of cgm-remote-monitor in GitHub

Delete or update your current cgm-remote-monitor fork before continuing.

b) Open this link Click on Fork


Confirm with Create fork


Make sure you deselect Copy the master branch only.


c) Wait for a moment


d) You now have a copy (fork) of the Nightscout project repository in your own GitHub.


Update your Nightscout fork

  • Click here to log in at GitHub:

  • Enter your username or email and your password. Click Sign in


  • Select your own cgm-remote-monitor project (not nightscout/cgm-remote-monitor)


  • Your repository will open. If you see This branch is xxx commits behind nightscout:master you need to update.

  • Select Fetch upstream


  • Select Fetch and merge


  • After a moment, your repository should display This branch is up to date with nightscout:master


You have now updated your GitHub cgm-remote-monitor repository.

If you ran into trouble, you can redeploy the project.

Step 2: Create a Northflank account

a) Sign-up to Northflank in a new browser tab. Login with GitHub (click on the logo).


b) Confirm your GitHub account if required.


c) Select Only select repositories, in the drop-down list select cgm-remote-monitor then click Install & Authorize.


c) Enter a user name, your email address and invent a password (type it twice to confirm). Accept the TOS and Privacy Policy then click Continue .


d) Click Choose theme.


e) Select Skip for now.


f) Select Create free project.


g) Enter a project name (for example nightscout) and select a region (you can make it geographically close to where you live) then click Create project.


Step 3: Deploy Nightscout in Northflank

What are you trying to do now?

a) Select Add new service.


b) Don’t change anything and scroll down to Service name. Click Suggest random name.


c) Select your cgm-remote-monitor and the master branch.


d) In Buid options select Buildpack.


Open Advanced build settings and select heroku/builder-classic:22.


e) Expand Variables and click Add variable.


f) Setup your Nightscout core variables.

API_SECRET will be your Nightscout site password, it needs to be at least 12 characters long and you should NOT use spaces if you use @ or ! symbols remember you will probably need to express them using Percent encoding in your uploader and downloader apps. If you’re not sure on how to do this, it is recommended to use only letters (uppercase + lowercase) and digits.


The API_SECRET is the main password allowing full access to your Nightscout site. Make sure it’s reasonably secure (mix uppercase and lowercase letters, plus digits) and do no not share it publicly. If you think you exposed it by mistake, it is recommended that you change it.


Click Add variable each time to add another one.

Dexcom Bridge

g) If you use Dexcom bridge you need to configure these two variables with your Dexcom credentials:



If you’re using Dexcom Share in the US you should put US, in any other case it must be EU.
If you don’t see it proposed at this point you’ll need to browse the list below to find it and modify it.


Remember to add bridge at the end of the enable variable in the list below.


The most common error on initial Nightscout setups is that people incorrectly use an old account or an old password. To test your username and password, go to Dexcom’s Clarity page (check here for USA accounts and here for the others) and try logging in to your Dexcom account. If your account info isn’t valid, or you don’t see any data in your Clarity account… you need to figure out your actual credentials before moving ahead. See here for troubleshooting tips and information on your Dexcom account.


Some people have had problems with their bridge connecting when their Dexcom passwords are entirely numeric. If you have connection issues in that case, try changing your password to something with a mix of numbers and letters.


You need to have at least one follower to use Dexcom Share. See here.

h) Select the units you’re using in DISPLAY_UNITS acceptable choices are mg/dl or mmol/L (or just mmol).


i) You can add alarms values. See here for the meaning of each one.


j) If you want to ensure that ONLY someone with permission to view your site (e.g., a token or the API_SECRET) is able to view the data, you should configure the AUTH_DEFAULT_ROLES variable in as denied.
If you want your site to be visible to anybody leave it as readable.


k) In ENABLE, copy and paste the following words (separated by a space) so that won’t have to think about which you want now:

careportal basal dbsize rawbg iob maker cob bwp cage iage sage boluscalc pushover treatmentnotify loop pump profile food openaps bage alexa override speech cors

If you are using your Dexcom share account as a data source also add bridge at the end, after a space like this:

careportal basal dbsize rawbg iob maker cob bwp cage iage sage boluscalc pushover treatmentnotify loop pump profile food openaps bage alexa override speech cors bridge


l) You can modify the variables values, check the documentation for the meaning of each one.

m) add a 3 to 8 letter code to your URL.


n) Scroll down and check you’re using an nf-compute-10 plan, then click: Create Service



o) You now need to add a payment method.


p) Wait until your build completes. You will see a green cloud when done, it will take less than 15 minutes.


Step 4: Attach your database to your Nightscout site

a) Browse back into your project Service then Environment, click Edit.


b) Select Add variable at the end of the list.


c) Name it MONGODB_URI and paste the string you obtained at Step 0.


d) Click Update and restart bottom right.


a) Go to your Account Dashboard - Settings and scroll down to Import.
Select Heroku.



If you don’t see this option, send a mail to Northflank support to request access to the feature.

b) Click Link Heroku.


c) Login in Heroku.


d) Click Allow.


e) Select your Nightscout Heroku app then click Continue.


f) Select your project (the one you created in Step 1.g) then click Continue.


g) Verify the branch you want to migrate, usually it’s master unless you know why you need another one.


h) Optional if your Heroku wasn’t on stack 22 select heroku/builder-classic:22 unless you know why you want to use another one.


i) Modify your compute plan to the smallest nf-compute-10 and click Continue.


j) Wait until import completes then return to your Dashboard (top left).


To open your Nightscout site, navigate to your project Services and click the address link top right.


Good time to check you selected the right plan.

Make sure you selected the developer sandbox plan to avoid unexpected fees.


New Nightscout Setup

a) Your Nightscout site should open and direct you to a new profile creation.


b) Setup your Time zone and eventually all other fields. Do not leave any fields empty. If you don’t know which value to use, just use the default value. You can change these values later at any time.


c) Browse down to Authentication status and click Authenticate. Enter your API secret. Click Update.


d) Click Save.


e) If the following pop-up shows up click OK, and check status (upper right of the window).


f) If you need to modify your profile after this, authenticate with the lock icon (top right of the page): enter your API secret. Then click on the hamburger menu and select Profile Editor.


Privacy warning

Anyone with access to the URL of your Nightscout site, can view your BG and run reports of your data. It it strongly recommended that you enable security to your site once you’re done with the setup

g) Dexcom Share users should see data flowing in after some minutes. xDrip+ users (including Medtronic CareLink followers) should setup the uploader as shown here. xDrip4iOS users here. AAPS and Loop: consult the relative documentation.


You have completed a new Nightscout site creation. You can continue here now.

The following section provides more information that you might not need to use now.

Change your Northflank Nightscout site name

You cannot override the default name if you don’t have a DNS.
You can use TinyURL to get a shorter name.


You can also use a free dynamic DNS service to do this in order to have something easier to remember.

Keep the original Northflank URL in your uploaders and followers.

You have completed a new Nightscout site creation. The following section provides more information for variables edition that you might not need to use now.

Editing Variables in Northflank

a) Open Northflank and login with your username or with GitHub.


b) Select Services then your Nightscout project.


c) Select Environment then Edit.


e) You can perform various operations on your variables:

  1. Add a new variable with + Add Variable

  2. Edit variables values directly in the table

  3. Delete a variable with the bin icon


Multiple lines values should be typed with \n separating each original line.

----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGBygGSM49AwEHBHkwdwIBAQQg7c8w00t5ju7N980r\nerN8N+isnJoec+ohIEuD0teRbPmgCgYIKoZIzj0DAQehRANCAAREnRISLSiFgdn4\nLbf44yIKspXKr7GpPBVshv3ShOms2qHTdAFriXXRPmbq7eAJuFrxpYOduU1dl9vo\nouciW0je\n-----END PRIVATE KEY-----

Don’t forget to Update & restart when you’re done editing.