DEV Community

Rich Field
Rich Field

Posted on • Edited on

1 3

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!

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay