The Home Assistant frontend is built using web components. For more background about our technology choices, see this blog post.
Do not use development mode in production. Home Assistant uses aggressive caching to improve the mobile experience. This is disabled during development so that you do not have to restart the server in between changes.
Setting up the environment
Getting the code
The first step is to fork the frontend repository and add the upstream remote. You can place the forked repository anywhere on your system.
Configuring Home Assistant
You will need to have an instance of Home Assistant set up. See our guide on setting up a development environment.
Next step is to configure Home Assistant to use the development mode for the frontend. Do this by updating the frontend config in your
configuration.yaml and set the path to the frontend repository that you cloned in the last step:
Node.js is required to build the frontend. The preferred method of installing node.js is with nvm. Install nvm using the instructions in the README, and install the correct node.js by running the following command:
Next, development dependencies need to be installed to bootstrap the frontend development environment. First activate the right Node version and then download all the dependencies:
During development, you will need to run the development script to maintain a development build of the frontend that auto updates when you change any of the source files. To run this server, run:
Make sure you have cache disabled and correct settings to avoid stale content:
Instructions are for Google Chrome
- Disable cache by ticking the box in
- Enable Bypass for network in
Bypass for network
Creating pull requests
If you're planning on issuing a PR back to the Home Assistant codebase you need to fork the frontend project and add your fork as a remote to the Home Assistant frontend repo.
When you've made your changes and are ready to push them change to the working directory for the frontend project and then push your changes
Building the frontend
If you're making changes to the way the frontend is packaged, it might be necessary to try out a new packaged build of the frontend in the main repository (instead of pointing it at the frontend repo). To do so, first build a production version of the frontend by running
To test it out inside Home Assistant, run the following command from the main Home Assistant repository: