# balena-device-config

> Get device config.json configuration

Latest version **6.3.1** (published 2026-02-19) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install balena-device-config
pnpm add balena-device-config
yarn add balena-device-config
bun add balena-device-config
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 6.3.1 |
| Published | 2026-02-19 |
| First published | 2020-04-13 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 50 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Juan Cruz Viotti |
| Maintainers | balena.io |
| Keywords | balena, image, device, config.json, config |

## Links

- npm: https://www.npmjs.com/package/balena-device-config
- Repository: https://github.com/balena-io-modules/balena-device-config
- Issues: https://github.com/balena-io-modules/balena-device-config/issues
- npm.io page: https://npm.io/package/balena-device-config

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [revalidator](https://npm.io/package/revalidator.md) ^0.3.1

## Alternatives

- [jsforce](https://npm.io/package/jsforce.md) — 851.2K weekly downloads
- [react-native-qrcode-svg](https://npm.io/package/react-native-qrcode-svg.md) — 693.5K weekly downloads
- [@salesforce/plugin-data](https://npm.io/package/@salesforce/plugin-data.md) — 394.9K weekly downloads
- [@backstage/plugin-search-common](https://npm.io/package/@backstage/plugin-search-common.md) — 308.5K weekly downloads
- [@chain-registry/types](https://npm.io/package/@chain-registry/types.md) — 38.4K weekly downloads

## Recent versions

- 6.3.1 (latest) — 2026-02-19
- 6.3.2-build-renovate-balena-lint-7-x-9b238e5038b7b704160fd41114c92d676df3ae1c-1 (build-renovate-balena-lint-7-x) — 2026-05-16
- 6.3.2-build-renovate-balena-lint-6-x-cf194252ea8e67088b584d60c29185fd964078f9-1 (build-renovate-balena-lint-6-x) — 2026-05-16
- 6.3.2-build-renovate-major-7--balenalint-5a62651dc9afa807394d2dceee35f1601f47ffd2-1 (build-renovate-major-7--balenalint) — 2026-02-19
- 6.3.2-build-renovate-major-5-gulp-967a1c6e3eaa0e91c76ac27b24d5834968165a21-1 (build-renovate-major-5-gulp) — 2026-02-19
- 6.3.1-build-add-npm-oidc-permissions-f9a2dd56a799a8d50eb4c54e717701b072002a57-1 (build-add-npm-oidc-permissions) — 2026-02-18
- 6.3.1-build-renovate-major-8--balenalint-de4d7348aaf1c195d8f93630e1760101f04640c9-1 (build-renovate-major-8--balenalint) — 2025-03-19
- 6.3.1-build-renovate-major-6--balenalint-cc935337ba03d9ea97a6336f1fb80e5291de7d2c-1 (build-renovate-major-6--balenalint) — 2025-03-19
- 6.3.0-build-add-optional-logs-endpoint-4ef6c533e2341cd23770db1f08f578e5083298d0-1 (build-add-optional-logs-endpoint) — 2023-03-23
- 6.2.1-build-move-to-flowzone-6d302a80e6bd47069b95508992cd31859cbd3c2b-2 (build-move-to-flowzone) — 2023-03-23
- 6.3.1-build-renovate-major-5-gulp-4c256445181962cf281a76eb6362c1d2abdb5572-1 — 2025-04-09
- 6.3.1-build-renovate-major-7--balenalint-d47b20e9bdf1f8fcbf74e5d3ff942b33bba9d296-1 — 2025-03-19
- 6.3.0 — 2023-03-23
- 6.2.1 — 2023-03-23
- 6.2.1-build-move-to-flowzone-6d302a80e6bd47069b95508992cd31859cbd3c2b-1 — 2023-03-22
- … 9 more at https://npm.io/package/balena-device-config/versions

## README

balena-device-config
-------------------

[![npm version](https://badge.fury.io/js/balena-device-config.svg)](http://badge.fury.io/js/balena-device-config)
[![dependencies](https://david-dm.org/balena-io-modules/balena-device-config.png)](https://david-dm.org/balena-io-modules/balena-device-config.png)
[![Build Status](https://travis-ci.org/balena-io-modules/balena-device-config.svg?branch=master)](https://travis-ci.org/balena-io-modules/balena-device-config)
[![Build status](https://ci.appveyor.com/api/projects/status/im9y5jv9ml0fs8jo/branch/master?svg=true)](https://ci.appveyor.com/project/balena-io/balena-device-config/branch/master)

Join our online chat at [![Gitter chat](https://badges.gitter.im/balena-io/chat.png)](https://gitter.im/balena-io/chat)

Get device config.json configuration.

Role
----

The intention of this module is to provide low level access to how a balena.io device `config.json` file is generated.

**THIS MODULE IS LOW LEVEL AND IS NOT MEANT TO BE USED BY END USERS DIRECTLY**.

Installation
------------

Install `balena-device-config` by running:

```sh
$ npm install --save balena-device-config
```

Documentation
-------------


* [deviceConfig](#module_deviceConfig)
    * [.generate(options, params)](#module_deviceConfig.generate) ⇒ <code>Object</code>
    * [.validate(config)](#module_deviceConfig.validate)

<a name="module_deviceConfig.generate"></a>

### deviceConfig.generate(options, params) ⇒ <code>Object</code>
**Kind**: static method of [<code>deviceConfig</code>](#module_deviceConfig)  
**Summary**: Generate a basic config.json object  
**Returns**: <code>Object</code> - config.json  
**Access**: public  

| Param | Type | Description |
| --- | --- | --- |
| options | <code>Object</code> | options |
| params | <code>Object</code> | user params |

**Example**  
```js
config = deviceConfig.generate
	application:
		id: 18
		device_type: 'raspberry-pi'
	apiKey: 'asdf'
	vpnPort: 443
	endpoints:
		api: 'https://api.balena-cloud.com'
		vpn: 'vpn.balena-cloud.com'
		registry: 'registry.balena-cloud.com'
,
	network: 'ethernet'
	appUpdatePollInterval: 50000

console.log(config)
```
**Example**  
```js
config = deviceConfig.generate
	application:
		id: 18
		device_type: 'raspberry-pi2'
	deviceType: 'raspberrypi3'
	apiKey: 'asdf'
	vpnPort: 443
	endpoints:
		api: 'https://api.balena-cloud.com'
		vpn: 'vpn.balena-cloud.com'
		registry: 'registry.balena-cloud.com'
,
	network: 'ethernet'
	appUpdatePollInterval: 50000

console.log(config)
```
<a name="module_deviceConfig.validate"></a>

### deviceConfig.validate(config)
**Kind**: static method of [<code>deviceConfig</code>](#module_deviceConfig)  
**Summary**: Validate a generated config.json object  
**Throws**:

- Will throw if there is a validation error

**Access**: public  

| Param | Type | Description |
| --- | --- | --- |
| config | <code>Object</code> | generated config object |

**Example**  
```js
config = deviceConfig.generate
	application:
		id: 18
		device_type: 'raspberry-pi'
	apiKey: 'asdf'
	vpnPort: 443
	endpoints:
		api: 'https://api.balena-cloud.com'
		vpn: 'vpn.balena-cloud.com'
		registry: 'registry.balena-cloud.com'
,
	network: 'ethernet'
	appUpdatePollInterval: 50000

deviceConfig.validate(config)
```

Support
-------

If you're having any problem, please [raise an issue](https://github.com/balena-io-modules/balena-device-config/issues/new) on GitHub and the balena.io team will be happy to help.

Tests
-----

Run the test suite by doing:

```sh
$ gulp test
```

Contribute
----------

- Issue Tracker: [github.com/balena-io-modules/balena-device-config/issues](https://github.com/balena-io-modules/balena-device-config/issues)
- Source Code: [github.com/balena-io-modules/balena-device-config](https://github.com/balena-io-modules/balena-device-config)

Before submitting a PR, please make sure that you include tests, and that [coffeelint](http://www.coffeelint.org/) runs without any warning:

```sh
$ gulp lint
```

License
-------

The project is licensed under the Apache 2.0 license.

---
_Source: https://npm.io/package/balena-device-config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
