DEV Community

Cover image for Vue.js Firestore CRUD App example
bezkoder
bezkoder

Posted on

Vue.js Firestore CRUD App example

In this tutorial, I will show you step by step to build a Vue.js Firetore CRUD App example.

Full Article: https://bezkoder.com/vue-firestore-crud/

Vue Firestore CRUD Overview

We're gonna build an Vue Firestore CRUD App using firebase library in which:

  • Each Tutorial has key, title, description, published status.
  • We can create, retrieve, update, delete Tutorials (CRUD operations) from Firebase Firestore

Here are the screenshots:

  • Create a new Tutorial:

vuejs-firestore-crud-app-create

Cloud Firestore after the Create Operations:

vuejs-firestore-crud-app-cloud-firestore-data-view

– Retrieve all Tutorials, the details will show when clicking on any Tutorial:

vuejs-firestore-crud-app-retrieve

  • Change status to Published/Pending using Publish/UnPublish button:

vuejs-firestore-crud-app-update-status

  • Update the Tutorial details with Update button:

vuejs-firestore-crud-app-update

  • Delete the Tutorial using Delete button:

vuejs-firestore-crud-app-delete

Vue.js Firestore CRUD Project Structure

vuejs-firestore-crud-app-project-structure

Let me explain it briefly.

  • package.json contains 3 main modules: vue, vue-router, firebase.
  • firebase.js configures information to connect with Firebase Project and export Firebase Firestore service.
  • TutorialDataService exports TutorialDataService that uses firebase's Firestore CollectionReference to interact with Firestore collection.
  • There are 3 components that uses TutorialDataService:
    • AddTutorial for creating new item
    • TutorialsList contains list of items, parent of Tutorial
    • Tutorial shows item details
  • router.js defines routes for components.
  • App.Vue contains Router View and navigation bar.

For more details, implementation and Github, please visit:
https://bezkoder.com/vue-firestore-crud/

Further Reading

Related Posts:

Fullstack CRUD App:

Top comments (0)