DEV Community

Cover image for Vue.js Firebase Database CRUD example
Tien Nguyen
Tien Nguyen

Posted on • Edited on • Originally published at bezkoder.com

12 4

Vue.js Firebase Database CRUD example

In this tutorial, I will show you step by step to build a Vue.js Firebase Database CRUD App - Firebase Realtime Database.

Full Article: https://bezkoder.com/vue-firebase-realtime-database/

Related Post: Vue.js Firestore CRUD example

Vue Firebase CRUD with Realtime Database Overview

We're gonna build an Vue Firebase 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 Realtime Database

Here are the screenshots:

  • Create a new Tutorial:

vue-firebase-crud-realtime-database-create
vuejs-firebase-database-crud-create

Firebase Realtime Database right after the Operation:

vuejs-firebase-database-crud-create-db

  • Retrieve all Tutorials with details when clicking on a Tutorial:

vuejs-firebase-database-crud-retrieve-all

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

vuejs-firebase-database-crud-update-status

  • Update the Tutorial details with Update button:

vuejs-firebase-database-crud-update

  • Delete the Tutorial using Delete button:

vuejs-firebase-database-crud-delete

  • Delete all Tutorials with Remove All button:

vuejs-firebase-database-crud-delete-all

Vue.js Firebase Database CRUD Project Structure

vuejs-firebase-database-crud-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 Database service.
  • TutorialDataService exports TutorialDataService that uses firebase's Database Reference to interact with Firebase Database.
  • 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-firebase-realtime-database/

Further Reading

Related Posts:

Fullstack CRUD App:

Newer version: Vue 3 Firebase example: Build a CRUD Application

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

AWS GenAI LIVE!

GenAI LIVE! is a dynamic live-streamed show exploring how AWS and our partners are helping organizations unlock real value with generative AI.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️