Coder Social home page Coder Social logo

andrewjbateman / ionic-angular-firebase Goto Github PK

View Code? Open in Web Editor NEW
2.0 3.0 1.0 3.04 MB

:clipboard: Ionic app to perform Create Read Update & Delete (CRUD) operations on a Google Cloud Firestore database.

TypeScript 51.73% JavaScript 7.56% HTML 10.68% SCSS 30.03%
ionic firebase-database firebase angular database crud crud-application pwa rxjs ionic6

ionic-angular-firebase's Introduction

โšก Ionic Angular Firebase

  • Ionic app to perform Create Read Update & Delete (CRUD) operations on a Google Cloud Firestore NoQSL document-oriented database.
  • 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

๐Ÿ“„ Table of contents

๐Ÿ“š General info

  • Firebase access was declined without some kind of access-limit script - see Setup below
  • Each database record contains simple title & text strings with auto-generated record id string
  • Typescript Record model used to specify record format
  • Home page shows records from database as a list of Ionic cards
  • Clicking on a card activates a modal with record details and cancel, update & delete buttons
  • Data service separates logic that interacts with Firebase database
  • Progressive Web App functionality added but needs to be tested

๐Ÿ“ท Screenshots

screenshot screenshot

๐Ÿ“ถ Technologies

๐Ÿ’พ Setup

  • Run npm i to install dependencies
  • Create Google firebase project, create firestore database and add firebaseConfig data to environment.ts files, e.g.:
export const environment = {
  production: false,
  firebase: {
    apiKey: 'xxx..x',
    authDomain: 'xxx..x',
    projectId: 'xxx..x',
    storageBucket: 'xxx..x',
    messagingSenderId: 'xxx..x',
    appId: 'xxx..x',
  },
};
  • In Firebase click on 'Edit Rules' and change to allow access until up to a month from today, e.g.:
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.time < timestamp.date(2022, 12, 12);
    }
  }
}
  • Note: There are other ways to limit user access, including adding Firebase Authentication
  • ionic serve To start the server on localhost://8100
  • ionic build --prod to create build files in www folder
  • http-server www/ to serve static build files

๐Ÿ’ป Code Examples

  • data.service.ts constructor fetches all records with their ids from the Firebase 'records' collection of documents.
  constructor(private db: AngularFirestore) {
    this.recordsCollection = db.collection<Record>('records');
    this.records = this.recordsCollection.snapshotChanges().pipe(
      map((actions) =>
        actions.map((record) =>
          // loop through each database item and return with id
          ({ id: record.payload.doc.id, ...record.payload.doc.data() })
        )
      )
    );
  }

๐Ÿ†’ Features

  • Simple code to access & perform CRUD operations on Firestore database
  • Modal used to view record detail, instead of using routing to a record detail page

๐Ÿ“‹ Status & To-do list

  • Status: Working
  • To-do: Deploy

๐Ÿ‘ Inspiration

๐Ÿ“ License

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

โœ‰๏ธ Contact

ionic-angular-firebase's People

Contributors

andrewjbateman avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

shamsul74

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.