Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nozbe/watermelondb
🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️
https://github.com/nozbe/watermelondb
database hacktoberfest persistence react react-native reactive rxjs
Last synced: 11 days ago
JSON representation
🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️
- Host: GitHub
- URL: https://github.com/nozbe/watermelondb
- Owner: Nozbe
- License: mit
- Created: 2018-08-28T15:32:05.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-21T12:04:37.000Z (7 months ago)
- Last Synced: 2024-05-06T10:32:57.674Z (6 months ago)
- Topics: database, hacktoberfest, persistence, react, react-native, reactive, rxjs
- Language: JavaScript
- Homepage: https://watermelondb.dev
- Size: 27.6 MB
- Stars: 10,135
- Watchers: 104
- Forks: 573
- Open Issues: 214
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG-Unreleased.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
README
A reactive database framework
Build powerful React and React Native apps that scale from hundreds to tens of thousands of records and remain fast ⚡️| | 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](https://watermelondb.dev/docs/Sync/Intro) 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 Teams](https://nozbe.com/teams) since 2017 (and [many others](#who-uses-watermelondb)) |
| ✨ | **Reactive.** (Optional) [RxJS](https://github.com/ReactiveX/rxjs) API |
| 🔗 | **Relational.** Built on rock-solid [SQLite](https://www.sqlite.org) foundation |
| ⚠️ | **Static typing** with [Flow](https://flow.org) or [TypeScript](https://typescriptlang.org) |## 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](https://www.sqlite.org/index.html) 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**](https://www.youtube.com/watch?v=UlZ1QnFF4Cw).
📺 Next-generation React databases
| |
(a talk about WatermelonDB)## Usage
**Quick (over-simplified) example:** an app with posts and comments.
First, you define Models:
```js
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:
```js
const Comment = ({ comment }) => (
{comment.body} — by {comment.author}
)// 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:
```js
const Post = ({ post, comments }) => (
{post.name}
Comments:
{comments.map(comment =>
)}
)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](https://nozbe.github.io/WatermelonDB/)
## Who uses WatermelonDB
_Does your company or app use 🍉? Open a pull request and add your logo/icon with link here!_
## Contributing
**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](./CONTRIBUTING.md) for details about project setup, testing, etc.
If you're just getting started, see [good first issues](https://github.com/Nozbe/WatermelonDB/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22) 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](https://github.com/Nozbe).
**WatermelonDB's** main author and maintainer is [Radek Pietruszewski](https://github.com/radex) ([website](https://radex.io) ⋅ [𝕏 (Twitter)](https://twitter.com/radexp))
[See all contributors](https://github.com/Nozbe/WatermelonDB/graphs/contributors).
WatermelonDB is available under the MIT license. See the [LICENSE file](https://github.com/Nozbe/WatermelonDB/LICENSE) for more info.