Skip to content

Commit 0ee0dcc

Browse files
committed
Moving some scripts around and writing some new ones.
1 parent 6735162 commit 0ee0dcc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3044
-5
lines changed

README.md

+2-2

package.json

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
{
22
"dependencies": {
3-
"gitbook-plugin-ga": "^2.0.0"
3+
"gitbook-cli": "^2.3.2"
4+
},
5+
"scripts": {
6+
"start": "gitbook serve",
7+
"install": "gitbook install",
8+
"build": "gitbook build",
9+
"build:debug": "gitbook build ./ --log=debug --debug",
10+
"versions": "gitbook ls-remote"
411
}
512
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
Hello YouTube!
2+
3+
It's Chris Esplin again, haunting your suggested videos feed!
4+
5+
This will be a short update on what I've been doing for the last year.
6+
7+
In the Summer of 2017 I was approached by some great folks from Udemy.com.
8+
9+
They were interested in publishing a Firebase course to their platform...
10+
11+
...and thought that I might be interested in collaborating on a course with Juarez Filho.
12+
13+
Juarez and I have been in the Google Developer Expert program for a few years...
14+
15+
...and we both specialize in Firebase for web.
16+
17+
We use the Firebase platform every day and know the space pretty well.
18+
19+
So I said "yes", understanding that I was in for a lot of work.
20+
21+
I use time-tracking software every day...
22+
23+
...so I can confidently say that I've spent over 450 hours on this project over the last year.
24+
25+
I had no idea what I was getting into.
26+
27+
The problem is that I couldn't stomach the thought of knocking the course out quickly.
28+
29+
I've been unhappy with my video production skills for a while now, and I wanted to solve that.
30+
31+
So I bought a bunch of video equipment and software and started teaching myself.
32+
33+
I worked on the project for three hours every morning before work and on Saturdays...
34+
35+
...except for vacations and breaks for a bit of freelance work.
36+
37+
Anyway, the reason we're here is because I've got over 40 videos and I'm anxious to ship them!
38+
39+
We're talking about a full-blown, two-and-a-half hours video course on `udemy dot com`.
40+
41+
I'm a web developer, so this is Firebase for web, not Android or iOS.
42+
43+
That's not to say that the fundamentals won't apply if you're a native developer...
44+
45+
...but I built the demo project in React and used the JavaScript SDK for everything.
46+
47+
You can start learning with the free companion site, `full stack firebase dot com`.
48+
49+
I've used `full stack firebase dot com` as a place to outline the material...
50+
51+
...because you've got to write it all down before you can start shooting videos.
52+
53+
So start at `full stack firebase dot com` and you'll find links to purchase the course on Udemy.
54+
55+
You'll find a bunch of introductory modules about high-level Firebase concepts.
56+
57+
We've covered serverless concepts and how to think about the Firebase ecosystem.
58+
59+
And of course you'll find modules on each of the big Firebase platform features.
60+
61+
These modules include the Firebase command-line interface, Authentication, Firestore...
62+
63+
...the Realtime Database, Cloud Functions for Firebase, Firebase Storage...
64+
65+
...Firebase Cloud Messaging, and Firebase Hosting.
66+
67+
Each module starts with an introduction and a walkthrough to demonstrate the feature in action.
68+
69+
Next we implement the feature in our demo app.
70+
71+
The original plan was for Juarez to write a demo app in Angular and I'd do one in React.
72+
73+
Juarez is behind schedule, so the Angular demos aren't ready;
74+
75+
however, my React demo app is live at `react dot fullstackfirebase dot com`...
76+
77+
...and you'll be able to deploy your own version of it when you take the Udemy course.
78+
79+
Don't get hung up on the fact that it's in React, because you won't need to code any React.
80+
81+
The Firebase SDK is all vanilla JavaScript, so my integrations are vanilla JS as well.
82+
83+
I would have done the entire app in vanilla JavaScript...
84+
85+
...but that would have added a few hundred more hours to the development process.
86+
87+
So let's wrap this up.
88+
89+
I am not giving up on YouTube.
90+
91+
I've just been wholly consumed by learning video production and making a Firebase course.
92+
93+
`full stack firebase dot com` is still a work in progress, but it's free for everyone.
94+
95+
The Udemy course isn't free, but it isn't expensive either.
96+
97+
I'm confident that you won't find a more comprehensive course on Firebase for web.
98+
99+
And now that I've spent a few hundred hours learning to produce videos and screencasts...
100+
101+
...I'm anxious to dive back into YouTube.
102+
103+
So smash that like button.
104+
105+
Hit it three times if you can.
106+
107+
Just make sure that it's an odd number of times so that YouTube registers the "like" correctly.
108+
109+
I'll hang out in the comments to respond to questions...
110+
111+
...and as always, make sure to subscribe for the latest Firebase tips and tricks!
112+
113+
114+
115+
116+
117+
118+
119+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
Hello YouTube!
2+
3+
If you've been keeping up on Firebase in the last year then you're likely using Firestore.
4+
5+
Firestore is a bit of a successor to the original Firebase Realtime Database.
6+
7+
After Google purchased Firebase in October of 2014...
8+
9+
...Firebase had to move over to Google infrastructure.
10+
11+
That's a ton of work, but once you're on Google infrastructure, you're on Google infrastructure!
12+
13+
So you might as well design a new database from scratch that crushes everything that came before.
14+
15+
And there's how we got Firestore.
16+
17+
I've talked about Firestore in the past...
18+
19+
...so review those videos or check out `full stack firebase dot com` for the Firestore introduction.
20+
21+
I'd like to talk at a high level about Firestore sub-collections.
22+
23+
First, we need to review the Firestore data model.
24+
25+
Firestore is a document/collection database.
26+
27+
Documents hold whatever JSON data you'd like, but they must live within a collection.
28+
29+
A document can have any number of sub-collections with their own documents.
30+
31+
And you can keep nesting your data within sub-collections to your heart's content.
32+
33+
But that would be a horrible mistake.
34+
35+
In fact, I haven't found a great use case for sub-collections yet.
36+
37+
First off, you can easily save embedded JSON objects within your documents...
38+
39+
...so it's not necessary to make a sub-collection to nest data within a document.
40+
41+
And second, sub-collections are easily orphaned.
42+
43+
What do I mean by orphaned???
44+
45+
I mean that if you delete a document's data without deleting it's sub-collections...
46+
47+
...you can no longer query the document...
48+
49+
...so you might lose your reference to it, and lose track of its sub-collections.
50+
51+
This deserves some extra explanation.
52+
53+
If I have a collection called `foods`, I can query all of the documents in my `foods` collection.
54+
55+
Imagine that I have a `food` document named `gelato`.
56+
57+
My `gelato` document has attributes for `color`, `calories` and `deliciousnessRating`.
58+
59+
I want to track the ingredients in my gelato, so I create an `ingredients` sub-collection.
60+
61+
When I query my `foods` I get an object back named `gelato`...
62+
63+
...with `color`, `calories` and `deliciousnessRating` attributes.
64+
65+
But I don't get the `ingredients` sub-collection.
66+
67+
I only get the `ingredients` sub-collection if I make a separate query for it.
68+
69+
And I have to just know that it's there.
70+
71+
There's no hint that my `gelato` document has sub-collections.
72+
73+
So I can lose track of my `ingredients` sub-collection by forgetting that it exists.
74+
75+
Now imagine that I delete my gelato document for some reason.
76+
77+
My `gelato` document is gone, but I've forgotten to delete my `ingredients` sub-collection.
78+
79+
Because, get this... I have to manually delete a document's sub-collections.
80+
81+
And to add insult to injury...
82+
83+
...since I deleted the `gelato` document, it no longer shows up in my `foods` queries.
84+
85+
So now I don't know that `gelato` ever existed, but the `ingredients` sub-collection is still there.
86+
87+
You can see these orphaned sub-collections by clicking through the Firestore web console.
88+
89+
But you have to click through every single document to find them...
90+
91+
...because orphaned sub-collections don't show up when you query their parents.
92+
93+
This is garbage.
94+
95+
I'm confident that the Firebase team knows of this problem and has some plan to address it...
96+
97+
...because Firestore is still in beta of course...
98+
99+
...and I'm thankful to have Firestore even with it's wacky sub-collection system.
100+
101+
Just don't get suckered by sub-collections.
102+
103+
They have their uses for sure.
104+
105+
I've used them to cascade security rules and it's been great...
106+
107+
...but sub-collections are still iffy as a cornerstone of your data model.
108+
109+
The good news is that you don't need sub-collections to build your app on Firestore.
110+
111+
And they'll likely get more useful in time, so I'm hopeful.
112+
113+
Let me know what you think about Firestore in the comments.
114+
115+
I'll hang out and answer questions as always...
116+
117+
...and don't forget to smash those "like" and "subscribe" buttons.
118+
119+
If you're already subscribed, maybe unsubscribe and subscribe again...
120+
121+
...just for the satisfaction of clicking that fantastic "subscribe" button one more time.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
I pay close attention to the Firebase ecosystem...
2+
3+
...so my Google News feed often has Firebase- and Google-related articles in it.
4+
5+
A few weeks ago I saw an article pass through my feed about Firebase apps leaking data.
6+
7+
It was coverage of some security research by a company named Appthority.
8+
9+
Appthority did an audit of thousands of Android and iOS apps and found some serious problems.
10+
11+
These apps had all implemented Firebase, but failed to implement Firebase security rules.
12+
13+
So these apps' Firebase databases are basically public for everyone to read.
14+
15+
I thought, "wow, that's really horrible... I sure hope they get that fixed!"...
16+
17+
...and I forgot about it.
18+
19+
But in the last few days the coverage has gotten heavier...
20+
21+
...and it's entered into clickbait territory.
22+
23+
When the clickbait farms start to recycle content, the coverage goes from "ok" to "horrible".
24+
25+
The details of the story suffer, because the clickbait farms are churning out articles...
26+
27+
...without even a cursory understanding of what they're writing about.
28+
29+
So I'd like to clear this situation up a bit.
30+
31+
Just be to one-hundred percent up front, I am not speaking for anyone but myself.
32+
33+
These are my opinions that I'm talking about because the clickbait is misleading.
34+
35+
So what is actually happening with these data leaks?
36+
37+
It's simple.
38+
39+
Bad developers are lazy and believe in security-through-obscurity.
40+
41+
Firebase has given them all of the tools that they need, but they haven't used them.
42+
43+
And as a result, apps by lazy, incompetent developers are leaking data all over the web.
44+
45+
This happens because Firebase is a back-end as a service.
46+
47+
This necessitates that the Firebase database is publicly accessible.
48+
49+
Anyone can make requests to your Firebase database, both the Realtime Database and Firestore.
50+
51+
So Firebase has Security Rules that you write to lock down your databases.
52+
53+
These rules are, admittedly, the weakest part of the Firebase platform.
54+
55+
I am not implying that the security itself is weak, because it's bulletproof.
56+
57+
But Security Rules are difficult for developers to understand...
58+
59+
...because they solve a complex set of problems.
60+
61+
I've noticed that Firebase's default security rules have become more strict over the years.
62+
63+
You now have to manually override them to make your database public.
64+
65+
You're supposed to replace the default rule with your app-specific rules to lock your data.
66+
67+
It's a little like changing the admin password on your new router.
68+
69+
People don't think anything will ever happen to them...
70+
71+
...so the vast majority of routers still use their publicly-discoverable default passwords.
72+
73+
Likewise, bad developers don't think anything will ever happen to them...
74+
75+
...so they override Firebase's Security Rules and make their apps publicly accessible.
76+
77+
A publicly-accessibly app is easier to develop on...
78+
79+
...because you never run afoul of your own Security Rules.
80+
81+
And that's fine if you're writing a little demo app or an internal prototype with dummy data.
82+
83+
But it's become clear that there are a ton of bad developers out there...
84+
85+
...and these devs shipped their apps without ever locking them back up.
86+
87+
If you're interested in stealing, there are a ton of insecure apps out there.
88+
89+
And some of them are poorly configured Firebase apps.
90+
91+
If you've been a bad developer, please write some security rules.
92+
93+
I'm happy to help you sort them out.
94+
95+
In fact, I've written some tutorials over on `full stack firebase dot com` that will prove useful.
96+
97+
And for everyone else...
98+
99+
...thank you for taking basic security measures and locking down your Firebase apps.
100+
101+
Data security is no joke.
102+
103+
We have to take our responsibility as developers very seriously.
104+
105+
I don't want to work in a highly-regulated industry...
106+
107+
...and bad data security, even if it's inadvertent, will drag us all down.
108+
109+
And if you somehow conned me into installing an insecure app on my phone...
110+
111+
...shame.
112+
113+
Shame.
114+
115+
Shame.
116+
117+
Shame.
118+
119+
120+
121+
122+

0 commit comments

Comments
 (0)