DEV Community

Rich Field
Rich Field

Posted on • Updated on


Deploying Firebase Rules is super easy

The deployment of my firebase project has been automated since day one.

With one notable exception - the database rules.

A recent feature required considerable changes to the rules and I wanted to have them under source control.

Partly to have a record of all changes and partly as it's easy for clumsy fingers to update / delete rules via the console.

Turns out it's super easy - as most things Firebase are! 😄

Simply define your rules in a .json file, then add a rules property to the firebase.json file that points to it.

  "database": {
    "rules": "firebase.database.rules.json"
  "hosting" : {

Then wherever you run simply call the Firebase CLI like this:

firebase deploy --only database

Or if like me you want to deploy and app and database:

firebase deploy --only hosting,database

Note the lack of space after the comma, that caught me out first try!

Top comments (0)

Super Useful CSS Resources

A collection of 70 hand-picked, web-based tools which are actually useful.
Each will generate pure CSS without the need for JS or any external libraries.