The use of an Addon will depend on the implementation in the application running on your Service. Your application should be configured to receive connection details from Environment Variables.
You have service running a Node.js application that requires a persistent database, it gets a connection string from
process.env.MONGODB_URI. You create a MongoDB Addon in the same Project for this purpose.
- Navigate to the Addons list and select the Addon
- Find and copy the the value of MongoSrv (a Connection string) in Connection details
- Navigate to the Services list and select your Service
- Open the Environment page and enter your password if required
- Select Edit mode and click Add variable
- Enter the key used in your application in the Key field (in our case it is
- Paste the value from MongoSrv into the Value field
- Click Update & Redeploy to restart the Service with the new Environment Variable
You can forward an Addon for local development using the Northflank CLI.
Use the CLI to access an Addon locally
- Install the Northflank CLI
- Ensure you have the necessary shell installed for the Addon you wish to access
- Log in on the Northflank CLI with a token that grants access to the Project containing the Addon
- Forward the port of the specific Addon, or forward all ports in the Project:
- To forward a specific Addon:
northflank forward addon --project [project-name] --addon [addon-name]
- To forward all ports:
northflank forward all
You can now connect to your Addon locally using the Admin connection string.