WatermelonDB is a free, open source databases project written in JavaScript and released under MIT. It has 11,786 GitHub stars, 658 forks and 304 open issues, and was last pushed 41 hours ago. On this registry it ranks #71 of 143 tracked projects in Databases, with 5 head-to-head comparisons available.

What is WatermelonDB?

WatermelonDB is an MIT-licensed, open-source reactive database framework for JavaScript that keeps React and React Native apps launching fast by loading records lazily from a SQLite foundation instead of pulling an entire dataset into JavaScript.

What it is

WatermelonDB is a database framework written in JavaScript for React and React Native applications, published under the MIT licence and developed in the open by Nozbe. It sits on top of SQLite as its storage engine and adds a model layer, so developers define classes with decorators such as @field and @children to describe records and their relations. On top of those models it provides an observable layer, exposed through the withObservables higher-order component and an optional RxJS API. It supports static typing with either Flow or TypeScript, and it runs across iOS, Android, Windows, web, and Node.js. The project has been in production since 2017, where it powers Nozbe, and its documentation lives at watermelondb.dev.

The concrete problem it solves is application launch time on data-heavy apps. The README states plainly that for simple apps, using Redux or MobX with a persistence adapter is the easiest approach, but that once an app scales to thousands or tens of thousands of records, loading a full database into JavaScript becomes expensive and the app becomes slow to launch, especially on slower Android devices. WatermelonDB replaces that pattern by being lazy: nothing is loaded until it is requested, and querying runs directly against SQLite on a separate native thread, so most queries resolve immediately. Unlike using SQLite directly, the framework is fully observable, so changing a record automatically re-renders every piece of UI that depends on it, including lists that must reorder and counters that must update.

Key capabilities

  • Lazy loading: no records are read from SQLite until a component or query actually asks for them, which keeps launch time flat as the dataset grows.
  • Relational models defined in JavaScript with decorators such as @field and @children, backed by SQLite.
  • Querying executed directly against the SQLite database on a separate native thread rather than in JavaScript.
  • Reactive rendering through the withObservables higher-order component, which re-renders dependent components when a post, comment, or other record is added, changed, or removed.
  • An optional RxJS API for teams that prefer observable streams over the component-level integration.
  • Offline-first operation with synchronization against a backend the developer provides.
  • Static typing through Flow or TypeScript, and a framework-agnostic JavaScript API for plugging into UI frameworks other than React.

Who uses it and how

  • Production React Native apps that carry thousands to tens of thousands of records and need the app to open instantly regardless of dataset size.
  • Teams that outgrow Redux or MobX paired with a persistence adapter, where the full store is loaded into JavaScript at startup.
  • Offline-first mobile products that must keep working without connectivity and reconcile changes through a sync layer against an in-house backend.
  • Cross-platform codebases targeting iOS, Android, Windows, web, and Node.js from the same model definitions.
  • Contributors: the repository carries the hacktoberfest topic and maintains a good first issue label for newcomers, with setup and testing guidance in CONTRIBUTING.md.

Getting started

The README excerpt does not print an install or run command, so the entry point is the full documentation at watermelondb.dev and the repository docs at nozbe.github.io/WatermelonDB, with project setup, testing, and environment instructions in CONTRIBUTING.md.

How it compares

The tools named in the facts are Redux and MobX used with a persistence adapter, and SQLite used directly. Redux and MobX are described as the easiest choice for simple apps, while WatermelonDB targets complex applications where loading the whole database into JavaScript is the bottleneck; against raw SQLite, the difference is observability, since SQLite on its own will not re-render components when a record changes.

When to use it โ€” and when not to

A self-hoster takes on the SQLite database itself and, for offline-first use, the sync backend on the other end, because the framework synchronizes with a backend the developer supplies rather than hosting one. The repository shows 304 open issues, and the "Who uses WatermelonDB" section is still an empty placeholder inviting pull requests, so the published adopter list is not yet evidence of ecosystem breadth. Teams building a simple app should follow the README's own advice and start with Redux or MobX plus a persistence adapter rather than adopting this framework.

project readme (upstream, from github) โ€” read inline

WatermelonDB

A reactive database framework

Build powerful React and React Native apps that scale from hundreds to tens of thousands of records and remain fast โšก๏ธ

MIT License npm Gurubase

WatermelonDB
โšก๏ธ Launch your app instantly no matter how much data you have
๐Ÿ“ˆ Highly scalable from hundreds to tens of thousands of records
๐Ÿ˜Ž Lazy loaded. Only load data when you need it
๐Ÿ”„ Offline-first. Sync with your own backend
๐Ÿ“ฑ Multiplatform. iOS, Android, Windows, web, and Node.js
โš›๏ธ Optimized for React. Easily plug data into components
๐Ÿงฐ Framework-agnostic. Use JS API to plug into other UI frameworks
โฑ Fast. And getting faster with every release!
โœ… Proven. Powers Nozbe since 2017 (and many others)
โœจ Reactive. (Optional) RxJS API
๐Ÿ”— Relational. Built on rock-solid SQLite foundation
โš ๏ธ Static typing with Flow or TypeScript

Why Watermelon?

WatermelonDB is a new way of dealing with user data in React Native and React web apps.

It's optimized for building complex applications in React Native, and the number one goal is real-world performance. In simple words, your app must launch fast.

For simple apps, using Redux or MobX with a persistence adapter is the easiest way to go. But when you start scaling to thousands or tens of thousands of database records, your app will now be slow to launch (especially on slower Android devices). Loading a full database into JavaScript is expensive!

Watermelon fixes it by being lazy. Nothing is loaded until it's requested. And since all querying is performed directly on the rock-solid SQLite database on a separate native thread, most queries resolve in an instant.

But unlike using SQLite directly, Watermelon is fully observable. So whenever you change a record, all UI that depends on it will automatically re-render. For example, completing a task in a to-do app will re-render the task component, the list (to reorder), and all relevant task counters. Learn more.

Usage

Quick (over-simplified) example: an app with posts and comments.

First, you define Models:

class Post extends Model {
  @field('name') name
  @field('body') body
  @children('comments') comments
}

class Comment extends Model {
  @field('body') body
  @field('author') author
}

Then, you connect components to the data:

const Comment = ({ comment }) => (
  <View style={styles.commentBox}>
    <Text>{comment.body} โ€” by {comment.author}</Text>
  </View>
)

// This is how you make your app reactive! โœจ
const enhance = withObservables(['comment'], ({ comment }) => ({
  comment,
}))
const EnhancedComment = enhance(Comment)

And now you can render the whole Post:

const Post = ({ post, comments }) => (
  <View>
    <Text>{post.name}</Text>
    <Text>Comments:</Text>
    {comments.map(comment =>
      <EnhancedComment key={comment.id} comment={comment} />
    )}
  </View>
)

const enhance = withObservables(['post'], ({ post }) => ({
  post,
  comments: post.comments
}))

The result is fully reactive! Whenever a post or comment is added, changed, or removed, the right components will automatically re-render on screen. Doesn't matter if a change occurred in a totally different part of the app, it all just works out of the box!

โžก๏ธ Learn more: see full documentation

Who uses WatermelonDB

Nozbe Teams
CAPMO
Mattermost
Rocket Chat
Steady
Aerobotics
Smash Appz
HaloGo
SportsRecruits
Chatable
Todorant
Blast Workout
Dayful
Learn The Words
ezypack

Does your company or app use ๐Ÿ‰? Open a pull request and add your logo/icon with link here!

Contributing

We need you

WatermelonDB is an open-source project and it needs your help to thrive!

If there's a missing feature, a bug, or other improvement you'd like, we encourage you to contribute! Feel free to open an issue to get some guidance and see Contributing guide for details about project setup, testing, etc.

If you're just getting started, see good first issues that are easy to contribute to. If you make a non-trivial contribution, email me, and I'll send you a nice ๐Ÿ‰ sticker!

If you make or are considering making an app using WatermelonDB, please let us know!

Author and license

WatermelonDB was created by @Nozbe.

WatermelonDB's main author and maintainer is Radek Pietruszewski (website โ‹… ๐• (Twitter))

See all contributors.

WatermelonDB is available under the MIT license. See the LICENSE file for more info.

Frequently asked questions

Is WatermelonDB free to use?

WatermelonDB is open source under the MIT licence. There is no licence fee and no seat count โ€” you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does WatermelonDB do?

๐Ÿ‰ Reactive & asynchronous database for powerful React and React Native apps โšก๏ธ

What is WatermelonDB written in?

WatermelonDB is primarily written in JavaScript. Its source is publicly available at https://github.com/Nozbe/WatermelonDB, and it has 11,786 GitHub stars.