I was just tired to build up a project every time I wanted to create a web service, so I've decided to create a template. This is a fully working application, backend and frontend you can deploy in your Google Firebase.
FirebaseTool 8.x
Angular 9.x
NodeJS 14.x
Just follow the instructions, and you will have a nice starting point for your web application.
- Download and extract the zip file of the project from github repo https://github.com/stuckDaemon/firebase-template
- Rename the folder from
firebase-template-masterto[PROJECT_NAME](whichever you want to use of course) - Open it with IntelliJ
- Search and replace each occurrence of
firebase-templatewith[PROJECT_NAME](brutal replacement will work) - Search and replace each occurrence of
firebaseTemplateAppwith[PROJECT_NAME]App(brutal replacement will work)
Basics
- Go to https://firebase.google.com
- Create a new project
[PROJECT_NAME] - Upgrade project plan to
Blaze(mandatory to deploy backend services). You can downgrade afterwards.
Auth keys
- Select the gear icon on the right of
Project Overview - Open
project settingsand thenService accounttab - Click the button
Generate new private keyand download the file - Save the json file just downloaded in
functionsfolder and rename it as[PROJECT_NAME]-firebase-adminsdk
Database
- Open Cloud Firestore from the left column
- Create a new database
- Create a new collection
foosand its first element (choose random values) with these fields
id: auto-ID;
created_at: timestamp;
modified_at: timestamp;
name: text;
email: text;
text: text;
- Go to the project root and run
$ firebase use --add - You will be prompted the list of your projects in firebase. Choose the one you want to add
- Remove this git origin and add yours
$ git remote remove origin $ git remote add origin [YOUR_REPO_URL] - Resolve the project dependencies
$ npm i $ cd functions $ npm i $ cd ..
- Build the project
$ ng build --prod && firebase deploy - Visit the URL the CLI is showing you.
When you are playing around with the code, you can run the backend with
$ firebase emulators:start
and the frontend with
$ ng serve