Serverless architectures are so hot right now! Today on the show we dive into Firebase with Angular2 using the AngularFire2 library.

We’ll be a dynamic Quote of the Day application which updates from the server in real time. Get out of here! Real time!

You can grab the code for today’s episode on GitHub.

Real Time Quote Action

Don’t forget to Subscribe to my Fresh Bytecode channel for regular Java/Web-related screencasts

Here’s the script so you can follow along at home:

[ ] Discuss the plan for today - use remote db to populate a list of quotes - with live update when server changes

[ ] Create a new app

ng new qotd

[ ] I’ve added Semantic UI to the index.html in the root

<link rel="stylesheet" href="">

<script src=""></script>
<script src=""></script>

[ ] I’ve also customised the index.html to use the Home Page layout from Semantic UI (scroll down that page to see it in action)

[ ] Install the firebase deps

npm install firebase angularfire2 --save

[ ] Sign up for a firebase account:

[ ] Create some data

[ ] Edit the read and write action on the your table (the rules tab) - so you can read without authenticating

    "rules": {
        ".read": "true",
        ".write": "auth != null"

[ ] Configure your app.module.ts to use Firebase

Update your module definitions

    import * as firebase from 'firebase';
    import { AngularFireModule } from 'angularfire2';

    // Initialize Firebase
    export const firebaseConfig = {
      apiKey: "AIzaSyAtkDOebowUCsSF8efOL_0yup1DKCCan00",
      authDomain: "",
      databaseURL: "",
      storageBucket: "",
      messagingSenderId: "922026910241"

      declarations: [
      imports: [
      providers: [],
      bootstrap: [AppComponent]
    export class AppModule { }

[ ] Add your quote list component

import { Component, OnInit } from '@angular/core';
import { AngularFire, FirebaseListObservable } from 'angularfire2';

  selector: 'app-quotelist',
  templateUrl: './quotelist.component.html',
  styleUrls: ['./quotelist.component.css']
export class QuotelistComponent implements OnInit {

  quotes: FirebaseListObservable<any>;

  constructor(private af: AngularFire) { }

  ngOnInit() {
    this.quotes ='quotes', {
      query: {
        orderByChild: 'author'


[ ] Add some markup

<table class="ui basic table" id="quoteTable">
    <tr *ngFor="let quote of quotes | async">


[ ] Celebrate the awesome serverless realtime update action