<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/adding-cloud-firestore-to-a-jetpack-compose-app-pg0xnlmdd" -->

---
title: Adding Cloud Firestore to a Jetpack Compose app | daily.dev
description: A step-by-step tutorial demonstrates integrating Cloud Firestore into an Android app built with Jetpack Compose, part four of a series building a to-do app. It...
canonical: https://daily.dev/posts/adding-cloud-firestore-to-a-jetpack-compose-app-pg0xnlmdd
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Adding Cloud Firestore to a Jetpack Compose app | daily.dev
og:description: A step-by-step tutorial demonstrates integrating Cloud Firestore into an Android app built with Jetpack Compose, part four of a series building a to-do app. It...
og:url: https://daily.dev/posts/adding-cloud-firestore-to-a-jetpack-compose-app-pg0xnlmdd
og:image: https://api.daily.dev/og/posts/PG0xNLMdD.png
og:image:alt: Adding Cloud Firestore to a Jetpack Compose app
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Adding Cloud Firestore to a Jetpack Compose app

**[Firebase](https://daily.dev/sources/firebase-blog)** · 16 min read · 0 upvotes · 0 comments

## Summary

A step-by-step tutorial demonstrates integrating Cloud Firestore into an Android app built with Jetpack Compose, part four of a series building a to-do app. It covers adding the Firestore dependency, creating a StorageService interface, using snapshot listeners with DisposableEffect for real-time sync, and implementing save/update/delete/get operations mapped to a Task data class via reflection. It also flags an antipattern for bulk-deleting user data and suggests using Cloud Functions or the Delete User Data Extension instead.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://firebase.blog/posts/2022/07/adding-cloud-firestore-to-jetpack-compose-app>

## Questions this post answers

### How do I set up real-time listeners for Cloud Firestore in a Jetpack Compose Android app?

Use a DisposableEffect in the top-level composable to register the listener when the view appears and unregister it via onDispose when it disappears. The StorageService implementation attaches a snapshot listener with addSnapshotListener to a Firestore query, mapping document changes to a Task object with toObject and checking for REMOVED change types to detect deletions.

_daily.dev surfaces practical Firestore and Compose integration patterns for developers wiring up realtime data._

### How do I add Cloud Firestore to an Android app's build.gradle file?

Add the Firebase BoM platform dependency, for example implementation platform('com.google.firebase:firebase-bom:31.0.0'), then declare implementation 'com.google.firebase:firebase-firestore-ktx'. A Firestore database must also be created for the project through the Firebase Console before connecting to it in code.

_Developers configuring Firebase dependencies can track setup guides like this one on daily.dev._

### What is the antipattern to avoid when deleting all Firestore documents for a user in Android?

Avoid looping through and deleting each document individually client-side via a query followed by document.reference.delete() calls, because a dropped internet connection mid-loop leaves some documents undeleted. Instead, handle bulk deletion server-side with a Cloud Function or Firebase's Delete User Data Extension to ensure atomic, reliable cleanup.

_daily.dev helps developers building account-deletion flows avoid common Firestore data-integrity mistakes._

## Similar posts on daily.dev

- [How Firestore Structures Data and How to Perform CRUD Operations With It](https://daily.dev/posts/how-firestore-structures-data-and-how-to-perform-crud-operations-with-it-odioykply) · freeCodeCamp · 1 upvotes · 0 comments
- [Using Flutter with Firebase: A Developer's Guide](https://daily.dev/posts/using-flutter-with-firebase-a-developer-s-guide-jbpavk3vl) · Flutter Community · 0 upvotes · 0 comments
- [Build intelligent Android apps: Cloud and hybrid inference](https://daily.dev/posts/build-intelligent-android-apps-cloud-and-hybrid-inference-eyctih4y9) · Android Developers Blog · 0 upvotes · 0 comments

---

Tags: [#android](https://daily.dev/tags/android), [#kotlin](https://daily.dev/tags/kotlin), [#firebase](https://daily.dev/tags/firebase), [#jetpack-compose](https://daily.dev/tags/jetpack-compose)

[View this post on daily.dev](https://daily.dev/posts/adding-cloud-firestore-to-a-jetpack-compose-app-pg0xnlmdd)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Adding Cloud Firestore to a Jetpack Compose app","url":"https://daily.dev/posts/adding-cloud-firestore-to-a-jetpack-compose-app-pg0xnlmdd","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/adding-cloud-firestore-to-a-jetpack-compose-app-pg0xnlmdd"},"datePublished":"2026-08-23T12:18:33.456Z","dateModified":"2026-08-23T12:29:10.786Z","description":"A step-by-step tutorial demonstrates integrating Cloud Firestore into an Android app built with Jetpack Compose, part four of a series building a to-do app. It...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/759e8cc246ee695b4135cc95e0eeb753?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/759e8cc246ee695b4135cc95e0eeb753?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Firebase","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Firebase","logo":"https://media.daily.dev/image/upload/s--i395oqZH--/f_auto,q_auto/v1787487448/logos/firebase-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/firebase-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/adding-cloud-firestore-to-a-jetpack-compose-app-pg0xnlmdd","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"android,kotlin,firebase,jetpack-compose","timeRequired":"PT16M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Firebase","item":"https://daily.dev/sources/firebase-blog"},{"@type":"ListItem","position":3,"name":"Adding Cloud Firestore to a Jetpack Compose app"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/adding-cloud-firestore-to-a-jetpack-compose-app-pg0xnlmdd#faq","mainEntity":[{"@type":"Question","name":"How do I set up real-time listeners for Cloud Firestore in a Jetpack Compose Android app?","acceptedAnswer":{"@type":"Answer","text":"Use a DisposableEffect in the top-level composable to register the listener when the view appears and unregister it via onDispose when it disappears. The StorageService implementation attaches a snapshot listener with addSnapshotListener to a Firestore query, mapping document changes to a Task object with toObject and checking for REMOVED change types to detect deletions. daily.dev surfaces practical Firestore and Compose integration patterns for developers wiring up realtime data."}},{"@type":"Question","name":"How do I add Cloud Firestore to an Android app's build.gradle file?","acceptedAnswer":{"@type":"Answer","text":"Add the Firebase BoM platform dependency, for example implementation platform('com.google.firebase:firebase-bom:31.0.0'), then declare implementation 'com.google.firebase:firebase-firestore-ktx'. A Firestore database must also be created for the project through the Firebase Console before connecting to it in code. Developers configuring Firebase dependencies can track setup guides like this one on daily.dev."}},{"@type":"Question","name":"What is the antipattern to avoid when deleting all Firestore documents for a user in Android?","acceptedAnswer":{"@type":"Answer","text":"Avoid looping through and deleting each document individually client-side via a query followed by document.reference.delete() calls, because a dropped internet connection mid-loop leaves some documents undeleted. Instead, handle bulk deletion server-side with a Cloud Function or Firebase's Delete User Data Extension to ensure atomic, reliable cleanup. daily.dev helps developers building account-deletion flows avoid common Firestore data-integrity mistakes."}}]}
```

