My objective is to build one code base for a complete Login system usable across different devices, databases and platforms (at least most of it with minimum configuration changes). iOS, Android, Windows, Progressive Web Apps, Offline Desktop Apps for Mac, Linux and Windows
MYSQL, PostGreSQl, MariaDB, MS SQL, Oracle
Couch DB, Couchbase, Cloudant, Mondgo DB and FIREBASE
I will share my work to implement as SCHEMATICS, download from NPM or GitHUB Repo.
------------------------------------------------------ Rule #1 - Always use local css and SVG Icons
Rule #2 - All backend code (CRUD operations must be in Services)
Rule #3 - Prepare for i18n (Multilingual)
Rule #4 - Avoid DB specific operations
(else prepare for exceptions, like if FIREBASE is used for social auth, always give users a DB login system as alternate)
Rule #5 - No Hardcoded values and Local Storage variables
Rule #6 - Secure your database/datastorage with proper rules/authentications
Rule #7 - know your CORS
Rule #8 - Generalize your code
Rule #9 - No function is written more than 5 lines.
Rule #10 - GitHub is your only friend.
$ node -v
$ npm -v
$ ng -v $ ng new myapp $ ng g module shared/modules/AppRoutingModule
$ ng g module shared/modules/ElishCustomMaterialModule
// make sure these two modules are imported in app.module.ts
Let's copy these file content from my github repo
Copy assets/icons & assets/img
$ ng g component aboutus // a filler component
$ ng g component shared/header // a sticky header component
$ ng g component shared/footer // a sticky footer component
Let's copy these file content from my github repo
Import and initialize firebase settings in your app.module
import { AngularFireModule } from 'angularfire2';
import { AngularFirestoreModule } from 'angularfire2/firestore';
import { AngularFireStorageModule } from 'angularfire2/storage';
import { AngularFireAuthModule } from 'angularfire2/auth';
import { firebase } from '@firebase/app';
import { environment } from '.././environments/environment';
AngularFireModule.initializeApp(environment.firebase, 'atrackin'), // imports firebase/app needed for everything
AngularFirestoreModule, // imports firebase/firestore, only needed for database features
AngularFireAuthModule, // imports firebase/auth, only needed for auth features
AngularFireStorageModule
$ ng g component settings // component where page lands after login is verified and can logout
$ ng g service services/auth-guard // used in router guard
$ ng g service services/back-end // used for all backend database services
$ ng g component shared/login
$ ng g component shared/signup
environment.ts, environment.prod.ts // update these files are per repo
backend and auth-guard // update these files are per repo
login and signup files // update these files are per repo
Please copy over environment settings and update environment.ts file
Please enable google, facebook and email login as sign-in methods to your firebase project.
Very soon, instead of copying over contents from GitHub Repo - I will instead create SCHEMATICS. Stay Tuned and subscribe to my Blogs & Videos.