Skip to content

📋 CRUD app using Akita state management to access Firebase data

License

Notifications You must be signed in to change notification settings

AndrewJBateman/angular-akita-firebase

Repository files navigation

⚡ Angular Akita Firebase

  • Angular app using Akita state management and Create, Read, Update & Delete (CRUD) functions to interface with a Firebase database. Tutorial code from Aldo Caamal with some updates - see 👏 Inspiration below
  • Note: to open web links in a new window use: ctrl+click on link

GitHub repo size GitHub pull requests GitHub Repo stars GitHub last commit

*** Note: to open web links in a new window use: ctrl+click on link**

📄 Table of contents

📚 General info

  • Akita used to create the posts.store.ts - an Akita Entity Store of single objects that is the single source of truth
  • Akita is not being maintained and they themselves recommend using an equivalent reactive store 'https://ngneat.github.io/elf/'

📷 Screenshots

Example screenshot

📶 Technologies

💾 Setup

  • Run npm i to install dependencies.
  • Add to environments/environment.ts: Firebase realtime database access credentials
  • Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
  • Run npm run build for a production build with css purging.
  • Run http-server to view build on an apple/android phone or simulator (pick 2nd http address supplied)
  • The build artifacts will be stored in the dist/angular-akita-firebase directory.

🔧 Testing

  • Run ng test to run Jasmine unit tests via Karma.
  • Run ng e2e to execute the end-to-end tests via Protractor.

💻 Code Examples

  • posts.service.ts function to load post to Firebase database while showing percentage progress
  async add(post: Post, files: any) {
    await this.uploadImage(files);

    let newpost = {
      title: post['title'],
      content: post['content'],
      cover: this.downloadURL,
      fileref: this.filepath,
    };

    let p = await this.firestore.collection('posts').add(newpost);
    this.setPercentage(null);
  }

🆒 Features

  • Uses Akita state management, built on top of RxJS data streams to create an Observable Data Store model.

📋 Status & To-Do List

  • Status: Working. Add Firebase authentication to access database - bypassed by setting access to 'true' in Firebase rules
  • To-Do: Nothing

👏 Inspiration

📁 License

  • This project is licensed under the terms of the MIT license.

✉️ Contact