Last active
December 18, 2020 16:54
-
-
Save CodenameCookie/abbfa33c02215cd327b40a10fc08bcc5 to your computer and use it in GitHub Desktop.
100 Firebase Tips and Tricks (WITH VIDEO)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get Started | |
1)Create a two Firebase Projects - one for development and another for live production data | |
https://youtu.be/iWEgpdVSZyg?t=33 | |
2) Link Google Analytics | |
https://youtu.be/iWEgpdVSZyg?t=47 | |
3) Limit permissions for employees, follow the Principle of Least Privilege | |
https://youtu.be/iWEgpdVSZyg?t=53 | |
4) Update contact info for GDPR | |
https://youtu.be/iWEgpdVSZyg?t=104 | |
5) Add a project and don’t worry about exposing your credentials in frontend code | |
https://youtu.be/iWEgpdVSZyg?t=110 | |
6) MISSING? | |
7) Upgrade to Blaze, then set a budget on GCP | |
https://youtu.be/iWEgpdVSZyg?t=82 | |
7) Generate detailed reports for billing | |
https://youtu.be/iWEgpdVSZyg?t=93 | |
8) Install the Firebase Tools CLI and GCloud. You should be able to run firebase and gcloud from the command line. | |
https://youtu.be/iWEgpdVSZyg?t=99 | |
9) Hosting and Distribution | |
https://youtu.be/iWEgpdVSZyg?t=117 | |
Use App Distribution to bypass Google Play and Apple Test Flight | |
Use NPM Scripts to build/deploy your app | |
Use --project flag to avoid deploying to the wrong project | |
Use the the cool new web.app domain | |
Add additional sites with multisite hosting | |
Rewrite routes to Cloud Function or Cloud Run | |
Rewrite routes Dynamic Links | |
Set custom CORS Headers | |
Set custom Cache Headers | |
Add CI/CD with Cloud Build | |
Frontend Setup | |
RTDB vs Firebase | |
Stop worrying about pricing | |
Backup your Firestore data | |
Start the Database in locked mode | |
Run queries from the console | |
Know the right JS import syntax | |
Import services from firebase/app | |
Defer script tags that contain the Firebase SDK. | |
Angular App? Use AngularFire | |
React App? Use ReactFire | |
RxJS? Use RxFire | |
Find additional projects from the FirebaseExtended Github Org. | |
Use Performance Monitoring | |
Use Crashlytics | |
Use Analytics | |
Auth + Firestore Techniques | |
Get the current user as a Promise OR add a realtime listener. | |
Learn async programming | |
Handle auth errors | |
Implement lazy auth by linking auth methods | |
Create your own custom email action handlers | |
One-To-One relationships with a DocID | |
Use the merge: true for a non-destructive Firestore set | |
OneToMany relationships with a sub-collection | |
Query collections with a common name using collectionGroup | |
Many-To-Many with a UID Map | |
Use duplication to increase performance and reduce costs | |
Query Map values with dot notation | |
Query data once OR with a realtime listener | |
Listen to specific doc changes | |
Sync browser tabs for offline persistence | |
Use emojis in your code | |
Wildcard string queries with ~ | |
Create indicies by viewing the Firestore error logs | |
Write to lists with array union & remove | |
Query lists with array-contains | |
Pipeline concurrent single doc read requests | |
Use serverTimestamp to update times | |
Use increment to update counters | |
Use the Distributed Counter extension | |
Run atomic writes with batch | |
Don’t be afraid to integrate an SQL or Fulltext Search database | |
Rules | |
Always use rules | |
Play with the Simulator | |
Test with the Emulator | |
Make your rules fine-grained based on read/write types | |
request vs resource | |
Use get to read other database locations | |
Simplify rules with functions | |
Storage | |
Create multiple buckets, use coldline for infrequently accessed data. | |
Save the download URL and file location to Firestore | |
Make a references with refFromURL | |
List all files in a directory | |
Calculate progress with bytesTransferred / totalBytes | |
Upload concurrently | |
Assign metadata | |
Use the Resizer extension | |
Admin | |
Create a Admin script for Node.js | |
Keep your Service Account private via gitignore or an environment variable | |
Seed the Database with Faker.js | |
Use the REST APIs | |
Integrate googleapis for better REST code. | |
Cloud Functions | |
Use TypeScript | |
Minimize dependencies | |
Use Global Variables | |
Write idempotent code | |
Adjust runWith Settings for more time and memory | |
Avoid infinite loops | |
Use isEqual to break infinite loops | |
Always return a Promise | |
Use PubSub functions for internal services | |
Use callable functions for user auth | |
Delete Firestore collections in batches | |
Write small, pure JS functions | |
Use Third-Party APIs | |
Deploy single functions | |
Test functions in the shell | |
Customize logging with Stackdriver | |
Analytics | |
Record events and user properties | |
Create audiences | |
Customize the UX with remote config | |
Send smart notifications | |
Sprinkle in some Machine Learning | |
And don’t forget to have fun! | |
Get Started | |
Hosting and Distribution | |
Frontend Setup | |
Auth + Firestore Techniques | |
Rules | |
Storage | |
Admin | |
Cloud Functions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment