Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 04671c9

Browse files
committedMar 15, 2019
Filled out the rest of the bullet points.
1 parent 3da87c5 commit 04671c9

File tree

1 file changed

+68
-9
lines changed

1 file changed

+68
-9
lines changed
 

‎getting-started-with-firebase-2019-edition/getting-started-with-firebase-2019-edition.md

Lines changed: 68 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Firebase enables a distributed architecture.
2828

2929
New developers have traditionally learned to build monolithic apps.
3030

31-
A monolith is a single application server that holds your database and server. Everything lives on a single server that you control, so it's very easy to teach and understand.
31+
A monolith is a single application server that holds your database and server. Everything lives on a single server that you control, so it's very easy to teach and understand.
3232

3333
The first managed service that I used was Amazon S3. It was an endpoint where I could send files. S3 would save the files and give me a link. I'd save the link in my local SQL database and S3 would serve the file to my users.
3434

@@ -64,7 +64,7 @@ So get over your SQL-induced anxiety and duplicate data throughout your Firebase
6464

6565
## The Evil Twin Databases
6666

67-
Firebase now has two databases,
67+
Firebase now has two databases,
6868

6969
1. the [Realtime Database](https://firebase.google.com/docs/database/), also known as classic Firebase or the RTDB, and
7070
2. [Cloud Firestore](https://firebase.google.com/docs/firestore/).
@@ -96,36 +96,95 @@ The other projects took between 75 and 200 hours each. Again, I finished them in
9696

9797
Firebase has spoiled me. I haven't spun up a new production server in two years. And these aren't just rapid prototypes. They're fully-functional, scalable and used by thousands of customers.
9898

99-
## Firebase includes *nearly* everything I need to build small- to medium-sized apps
99+
## Firebase includes _nearly_ everything I need to build small- to medium-sized apps
100100

101-
The pillars of Firebase's web offering are
101+
The pillars of Firebase's web offering are
102102

103103
- the Realtime Database (json database),
104104
- Cloud Firestore (document/collection database),
105105
- Cloud Functions for Firebase (serverless functions),
106-
- Firebase Storage (file/blob storage), and
106+
- Firebase Storage (file/blob storage), and
107107
- Firebase Hosting (static file hosting).
108108

109109
These five pillars can support an enormous range of apps.
110110

111-
Realistically, you'll need to "cheat" on Firebase a bit for larger apps. I use GCP for a few things that don't fit neatly within the Firebase offering. I also use [Algolia](https://www.algolia.com/) to power my search.
111+
Realistically, you'll need to "cheat" on Firebase a bit for larger apps. I use GCP for a few things that don't fit neatly within the Firebase offering. I also use [Algolia](https://www.algolia.com/) to power my search.
112112

113-
The funny thing is that Algolia is the most expensive part of my stack at $35/month. The Firebase databases are optimized for everything **except search**. This is an important caveat to recognize early. Searching Firestore collections or anything in the Realtime Database is extremely limited, and for strong architectural reasons. I don't expect to ever see Firebase support search.
113+
The funny thing is that Algolia is the most expensive part of my stack at \$35/month. The Firebase databases are optimized for everything **except search**. This is an important caveat to recognize early. Searching Firestore collections or anything in the Realtime Database is extremely limited, and for strong architectural reasons. I don't expect to ever see Firebase support search.
114114

115-
I primarily use GCP to manage the DNS for my domains. But I've also run some Cloud Compute instances for build processes.
115+
I primarily use GCP to manage the DNS for my domains. But I've also run some Cloud Compute instances for build processes.
116116

117117
And I use [GitLab.com](https://gitlab.com/deltaepsilon) for CI/CD purposes... so I guess I step out on Firebase a couple of times on each project :)
118118

119119
## Firebase scales effortlessly
120120

121+
Firebase does not allow slow operations. The database does not execute joins. It doesn't search.
121122

123+
I've never brought a Firebase app up to massive scale. I've heard that the Realtime Database can run into limits and require manual sharding; however, Firestore is architected much differently, and I wouldn't be surprised if it scales more like [Cloud Spanner](https://cloud.google.com/spanner/).
124+
125+
Firestore has some awesome performance characteristics.
126+
127+
From the [Firestore marketing page](https://firebase.google.com/products/firestore/):
128+
129+
> All queries scale with the size of your result set (note: not your data set), so your app is ready to scale from day one.
130+
131+
Firestore also offers strong consistency, meaning that you don't have to worry about the eventual-consistency data models that bedevil most NoSQL implementations.
122132

123133
## GCP is the escape hatch
124134

135+
Firebase services are built on Google Cloud Platform (aka GCP) infrastructure, and some of them are closely integrated.
136+
137+
For instance, Firebase Cloud Storage uses GCP Storage buckets that you can access through the GCP SDKs.
138+
139+
GCP is an enterprise-focused suite of service. It's massive.
140+
141+
Each Firebase project comes with its own GCP account, granting you access to the full power of GCP. So don't worry if Firebase doesn't fulfill your every need. GCP likely has it covered.
142+
143+
For example, If you don't want to pay for Algolia, you can spin up an Elasticsearch cluster on GCP and roll your own search. It'll be just as expensive as Algolia... so I can't recommend it for small projects; however, those capabilities are all there if you need them.
144+
125145
## Common concerns with Firebase
126146

147+
Firebase has it's downsides!
148+
149+
- Firebase cannot be hosted locally.
150+
- Firebase is tough to mock for local unit tests.
151+
- There's far less tooling available than for SQL databases.
152+
- Firebase can get expensive if you implement it poorly.
153+
154+
None of these problems bothers me. It may be Stockholm Syndrome... but I'm at peace with all of these "problems" with Firebase.
155+
156+
Engineering is all about tradeoffs. Firebase trades a bunch of control and autonomy for speed and simplicity of development.
157+
127158
## When to NOT use Firebase
128159

160+
**DO NOT** use Firebase if you have highly relational data.
161+
162+
**DO NOT** use Firebase if you have complex graph data.
163+
164+
**DO NOT** use Firebase if you have complex server needs.
165+
166+
I sometimes recommend hybrid architectures. Store your relational data in GCP's Cloud SQL or Cloud Spanner databases. Store your graph data in JanusGraph on top of Cloud Bigtable.
167+
168+
But these are all advanced use cases! Don't worry about them until you need them.
169+
129170
## The competition
130171

131-
## Conclusion: Firebase is preferred for most front-end-focused apps
172+
Firebase's direct competition is dead. [Facebook killed off Parse](https://blog.parseplatform.org/announcements/a-parse-shutdown-reminder/) and [RethinkDB](https://rethinkdb.com/blog/rethinkdb-shutdown/) suffered a similar fate.
173+
174+
The most direct alternative to Firebase at this point is AWS or GCP. They're quite a bit more complicated and harder to use... but you could achieve similar architectures with other services.
175+
176+
Or just use Postgres. Postgres is killer... as long as you have budget to write your own API on top of it.
177+
178+
That's about it. Use AWS, GCP or Postgres. Your dev velocity will suffer, but at least with Postgres you can run everything locally!
179+
180+
I've spent a lot of time with Postgres running in a local Docker container, and it's slick. I didn't write that API myself. It was expensive to maintain, and I could have duplicated it in Firebase at a much lower cost. But the business I was working with wasn't a fan of managed services. What could I do :)
181+
182+
## Conclusion: Firebase is preferred for most front-end-focused apps
183+
184+
Firebase is a slam dunk for small- to medium-sized projects, especially if they're front-end focused.
185+
186+
You may need to re-architect if you hit massive scale... but you **always** have to re-architect for massive scale. Don't optimize for scale prematurely.
187+
188+
Choose Firebase because it gets you to market faster. It helps you validate your ideas and get feedback.
189+
190+
Firebase is a cornerstone of Google's cloud strategy. It's not going anywhere.

0 commit comments

Comments
 (0)
Please sign in to comment.