<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/multiple-viewmodel-architecture-in-jetpack-compose-6mxzoorcs" -->

---
title: Multiple ViewModel Architecture in Jetpack Compose
description: Using a single ViewModel per Jetpack Compose screen is a common but problematic pattern that leads to bloated ViewModels with 1000+ lines, unrelated...
canonical: https://daily.dev/posts/multiple-viewmodel-architecture-in-jetpack-compose-6mxzoorcs
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Multiple ViewModel Architecture in Jetpack Compose | daily.dev
og:description: Using a single ViewModel per Jetpack Compose screen is a common but problematic pattern that leads to bloated ViewModels with 1000+ lines, unrelated...
og:url: https://daily.dev/posts/multiple-viewmodel-architecture-in-jetpack-compose-6mxzoorcs
og:image: https://api.daily.dev/og/posts/6mxZoorCS.png
og:image:alt: Multiple ViewModel Architecture in Jetpack Compose
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.

# Multiple ViewModel Architecture in Jetpack Compose

**[Stevdza-San](https://daily.dev/sources/stevdzasan)** · 8 min read · 2 upvotes · 1 comments

## Summary

Using a single ViewModel per Jetpack Compose screen is a common but problematic pattern that leads to bloated ViewModels with 1000+ lines, unrelated dependencies, hard-to-read UI state classes, and excessive merge conflicts in team settings. A better approach is to create separate ViewModels for each independent component on a screen, scoping each ViewModel's lifecycle to its composable. The `rememberViewModelStoreOwner` API enables this by destroying a ViewModel when its composable leaves the composition, preventing unnecessary memory usage and keeping architecture clean and maintainable.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=ifA8K3_XziI>

## Questions this post answers

### How do I scope a ViewModel to a specific composable so it gets cleared when that composable leaves the UI tree in Jetpack Compose?

Use the rememberViewModelStoreOwner API and pass its result as a parameter to the composable function that hosts the ViewModel. By default, a ViewModel injected with Koin's viewModel composable function is tied to the navigation destination's lifecycle, so it survives even after the composable using it leaves the composition. Wrapping the component with rememberViewModelStoreOwner ties the ViewModel's lifecycle to that specific composable instead, so it gets cleared when the composable is removed.

_Explore more Android architecture patterns like ViewModel scoping on daily.dev._

### Why should I avoid putting all my screen's logic into a single ViewModel in Jetpack Compose?

A single ViewModel per composable screen tends to grow unmanageable, sometimes reaching 1,000 lines with 10-20 unrelated properties in one UI state class, plus one event handler that knows about every component. This causes more merge conflicts in team settings, forces tests to set up unrelated dependencies, and can hurt performance since 10-20 injected dependencies must resolve during initialization even when many aren't needed at once.

_Compare ViewModel architecture tradeoffs for Android apps on daily.dev._

## Community discussion

Top comments from developers on daily.dev.

**@mark\_kazakov** · 0 upvotes

> In many large applications, there will be repeated business logic cases that will require a dedicated viewmodel, no reason to shy away from having a few viewmodels in one screen.

## Similar posts on daily.dev

- [Android Architecture Is Quietly Moving Beyond ViewModel as a State Holder](https://daily.dev/posts/android-architecture-is-quietly-moving-beyond-viewmodel-as-a-state-holder-0e2pkua20) · ProAndroidDev · 12 upvotes · 0 comments
- [AppState in Jetpack Compose: The Missing Piece for Building Large-Scale Android Apps](https://daily.dev/posts/appstate-in-jetpack-compose-the-missing-piece-for-building-large-scale-android-apps-gsrhvyqeq) · Medium · 2 upvotes · 1 comments
- [Mastering Navigation 3: Managing Per-Screen ViewModels with NavBackStack](https://daily.dev/posts/mastering-navigation-3-managing-per-screen-viewmodels-with-navbackstack-enocmyifg) · ProAndroidDev · 1 upvotes · 0 comments

---

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

[View this post on daily.dev](https://daily.dev/posts/multiple-viewmodel-architecture-in-jetpack-compose-6mxzoorcs)

```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":"Multiple ViewModel Architecture in Jetpack Compose","url":"https://daily.dev/posts/multiple-viewmodel-architecture-in-jetpack-compose-6mxzoorcs","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/multiple-viewmodel-architecture-in-jetpack-compose-6mxzoorcs"},"datePublished":"2026-08-09T15:27:15.020Z","dateModified":"2026-09-14T06:54:42.790Z","description":"Using a single ViewModel per Jetpack Compose screen is a common but problematic pattern that leads to bloated ViewModels with 1000+ lines, unrelated...","image":"https://i.ytimg.com/vi/ifA8K3_XziI/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/ifA8K3_XziI/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Stevdza-San","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":"Stevdza-San","logo":"https://media.daily.dev/image/upload/s--IthzHSnd--/f_auto,q_auto/v1774179041/logos/stevdzasan?_a=BAMAMiWQ0","url":"https://daily.dev/sources/stevdzasan"},"commentCount":1,"discussionUrl":"https://daily.dev/posts/multiple-viewmodel-architecture-in-jetpack-compose-6mxzoorcs","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":1}],"keywords":"architecture,android,jetpack-compose","timeRequired":"PT8M","video":{"@type":"VideoObject","name":"Multiple ViewModel Architecture in Jetpack Compose","description":"Using a single ViewModel per Jetpack Compose screen is a common but problematic pattern that leads to bloated ViewModels with 1000+ lines, unrelated...","thumbnailUrl":"https://i.ytimg.com/vi/ifA8K3_XziI/sddefault.jpg","uploadDate":"2026-08-09T15:27:15.020Z","duration":"PT8M","url":"https://api.daily.dev/r/6mxZoorCS","embedUrl":"https://www.youtube.com/embed/ifA8K3_XziI"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Stevdza-San","item":"https://daily.dev/sources/stevdzasan"},{"@type":"ListItem","position":3,"name":"Multiple ViewModel Architecture in Jetpack Compose"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/multiple-viewmodel-architecture-in-jetpack-compose-6mxzoorcs","comment":[{"@type":"Comment","text":"In many large applications, there will be repeated business logic cases that will require a dedicated viewmodel, no reason to shy away from having a few viewmodels in one screen.","datePublished":"2026-08-25T15:25:46.621Z","url":"https://daily.dev/posts/6mxZoorCS#c-j2AHMR5My","author":{"@type":"Person","name":"Mark Kazakov","url":"https://daily.dev/mark_kazakov","image":"https://media.daily.dev/image/upload/s--xbUWQzIM--/f_auto/v1743106084/avatars/avatar_DXWhIjQxKsp3WABroh08k"}}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/multiple-viewmodel-architecture-in-jetpack-compose-6mxzoorcs#faq","mainEntity":[{"@type":"Question","name":"How do I scope a ViewModel to a specific composable so it gets cleared when that composable leaves the UI tree in Jetpack Compose?","acceptedAnswer":{"@type":"Answer","text":"Use the rememberViewModelStoreOwner API and pass its result as a parameter to the composable function that hosts the ViewModel. By default, a ViewModel injected with Koin's viewModel composable function is tied to the navigation destination's lifecycle, so it survives even after the composable using it leaves the composition. Wrapping the component with rememberViewModelStoreOwner ties the ViewModel's lifecycle to that specific composable instead, so it gets cleared when the composable is removed. Explore more Android architecture patterns like ViewModel scoping on daily.dev."}},{"@type":"Question","name":"Why should I avoid putting all my screen's logic into a single ViewModel in Jetpack Compose?","acceptedAnswer":{"@type":"Answer","text":"A single ViewModel per composable screen tends to grow unmanageable, sometimes reaching 1,000 lines with 10-20 unrelated properties in one UI state class, plus one event handler that knows about every component. This causes more merge conflicts in team settings, forces tests to set up unrelated dependencies, and can hurt performance since 10-20 injected dependencies must resolve during initialization even when many aren't needed at once. Compare ViewModel architecture tradeoffs for Android apps on daily.dev."}}]}
```

