Chapter 9. Database

 

This chapter covers

  • Fundamentals of Firebase
  • Using Firebase in a serverless application

Most applications need to store data and, in most cases, a database is a commonsense solution. In this chapter we introduce Firebase as our database of choice. Firebase is a NoSQL database that has great features such as real-time streaming using WebSockets, offline capabilities, and a declarative security model. Firebase is great for quickly getting started, it scales well, and it’s immediately familiar to anyone who understands JSON.

As with most things in software development, the choice of a database should depend on your requirements. If your application is going to work with relational data, use a relational database. In a scenario where a NoSQL approach is appropriate but some structure is needed, a document database such as MongoDB or CouchDB might be more useful. If a scalable key/value store and fast lookups are important, then Firebase is a good option. And for some applications, a graph database might suit better than anything else. The best advice we can give is to look at your requirements, assess available options, and decide based on what’s a good fit for your domain and application. There’s no best database or even database type for serverless architectures. Everything depends on your goals and requirements.

9.1. Introduction to Firebase

9.2. Adding Firebase to 24-Hour Video

9.3. Securing access to files

9.4. Exercises

9.5. Summary