0.27.1 ā€¢ Published 6 months ago

@nozbe/watermelondb v0.27.1

Weekly downloads
3,078
License
MIT
Repository
github
Last release
6 months ago
WatermelonDB
āš”ļøLaunch your app instantly no matter how much data you have
šŸ“ˆHighly scalable from hundreds to tens of thousands of records
šŸ˜ŽLazy loaded everything. Only load data you need
āœØReactive API with RxJS
šŸ“±Supports iOS, Android, and the web
āš›ļøMade for React. Easily plug data into components
ā±Fast. Async. Multi-threaded. Highly cached.
šŸ”—Relational. Built on rock-solid SQLite foundation
āš ļøStatically typed with Flow
šŸ”„Offline-first. (Plug in your own sync engine)

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 / React Native, and the number one goal is real-world performance. In simple words, your app must launch fast.

If you have a simple app, keep using Redux or MobX with a persistence adapter. But if you start scaling to thousands or tens of thousands of database records, you'll notice a big impact on how fast the app launches, especially on slower Android devices. Loading a full database into JavaScript is expensive!

Watermelon fixes it by being lazy. Nothing is loaded unless requested. And because all querying is performed directly on the rock-solid SQLite database on a separate thread, most queries resolve in less than 1ms, even with 10,000 records, even on slower Android devices!

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: comment.observe()
}))
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 =>
      <Comment key={comment.id} comment={comment} />
    )}
  </View>
)

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

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 occured in a totally different part of the app, it all just works out of the box!

āž”ļø Learn more: see full documentation

Contributing

If you have comments, complaints, or ideas for improvements, feel free to open an issue or a pull request! See Contributing guide for details about project setup, testing, etc.

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

Author and license

WatermelonDB was created by @Nozbe. Main author and maintainer is Radek Pietruszewski.

Contributors: @mobily, @kokusGr, @rozPierog, @rkrajewski, @domeknn, @Tereszkiewicz.

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

0.28.0-0

6 months ago

0.27.1

6 months ago

0.27.0

8 months ago

0.27.0-9

8 months ago

0.27.0-8

8 months ago

0.27.0-7

8 months ago

0.27.0-1

12 months ago

0.27.0-3

11 months ago

0.27.0-2

11 months ago

0.27.0-5

11 months ago

0.27.0-4

11 months ago

0.27.0-6

10 months ago

0.26.0

1 year ago

0.27.0-0

12 months ago

0.26.0-11

1 year ago

0.26.0-10

1 year ago

0.26.0-13

1 year ago

0.26.0-12

1 year ago

0.26.0-15

1 year ago

0.26.0-14

1 year ago

0.25.3-0

1 year ago

0.26.0-3

1 year ago

0.26.0-4

1 year ago

0.26.0-5

1 year ago

0.26.0-7

1 year ago

0.26.0-8

1 year ago

0.26.0-9

1 year ago

0.25.4

1 year ago

0.25.3

1 year ago

0.25.2

1 year ago

0.25.5

1 year ago

0.25.1

1 year ago

0.25.0

1 year ago

0.24.1-9

1 year ago

0.26.0-nozbe3

1 year ago

0.26.0-1

1 year ago

0.26.0-2

1 year ago

0.26.0-0

1 year ago

0.25.2-0

1 year ago

0.24.1-11

1 year ago

0.24.1-10

1 year ago

0.26.0-nozbe2

1 year ago

0.26.0-nozbe1

1 year ago

0.24.1-7

2 years ago

0.24.1-8

2 years ago

0.24.1-6

2 years ago

0.24.1-3

2 years ago

0.24.1-5

2 years ago

0.24.1-1

2 years ago

0.24.1-0

2 years ago

0.24.0

2 years ago

0.23.1-9

3 years ago

0.23.1-8

3 years ago

0.23.1-6

3 years ago

0.23.1-7

3 years ago

0.23.1-5

3 years ago

0.23.1-4

3 years ago

0.23.1-3

3 years ago

0.23.1-1

3 years ago

0.23.1-2

3 years ago

0.23.1-0

3 years ago

0.23.0

3 years ago

0.23.0-12

3 years ago

0.23.0-11

3 years ago

0.23.0-10

3 years ago

0.23.0-9

3 years ago

0.23.0-8

3 years ago

0.23.0-6

3 years ago

0.23.0-5

3 years ago

0.23.0-4

3 years ago

0.23.0-3

3 years ago

0.23.0-2

3 years ago

0.23.0-1

3 years ago

0.22.0

3 years ago

0.22.0-2

3 years ago

0.22.0-1

3 years ago

0.21.0

3 years ago

0.21.0-12

3 years ago

0.21.0-11

3 years ago

0.21.0-10

3 years ago

0.21.0-8

3 years ago

0.21.0-6

3 years ago

0.21.0-5

3 years ago

0.21.0-4

3 years ago

0.21.0-2

3 years ago

0.21.0-1

3 years ago

0.21.0-0

3 years ago

0.20.0

4 years ago

0.19.1-1

4 years ago

0.19.1-0

4 years ago

0.19.0

4 years ago

0.19.0-4

4 years ago

0.19.0-3

4 years ago

0.19.0-2

4 years ago

0.19.0-1

4 years ago

0.19.0-0

4 years ago

0.18.0

4 years ago

0.18.0-0

4 years ago

0.17.1

4 years ago

0.17.0

4 years ago

0.17.0-7

4 years ago

0.17.0-6

4 years ago

0.17.0-4

4 years ago

0.17.0-3

4 years ago

0.16.1-fix

4 years ago

0.15.1

4 years ago

0.16.2

4 years ago

0.17.0-2

4 years ago

0.17.0-1

4 years ago

0.17.0-0

4 years ago

0.16.1-2

4 years ago

0.16.1

4 years ago

0.16.1-1

4 years ago

0.16.1-0

4 years ago

0.16.0

4 years ago

0.16.0-9

4 years ago

0.16.0-8

4 years ago

0.16.0-7

4 years ago

0.16.0-6

4 years ago

0.16.0-5

4 years ago

0.16.0-4

4 years ago

0.16.0-2

4 years ago

0.16.0-3

4 years ago

0.16.0-1

4 years ago

0.16.0-0

4 years ago

0.15.0

4 years ago

0.15.0-10

4 years ago

0.15.0-8

4 years ago

0.15.0-7

5 years ago

0.15.0-6

5 years ago

0.15.0-5

5 years ago

0.15.0-4

5 years ago

0.15.0-3

5 years ago

0.15.0-2

5 years ago

0.15.0-1

5 years ago

0.15.0-0

5 years ago

0.14.1

5 years ago

0.14.0

5 years ago

0.14.0-0

5 years ago

0.13.1-1

5 years ago

0.13.0

5 years ago

0.13.0-2

5 years ago

0.13.0-1

5 years ago

0.13.0-0

5 years ago

0.12.3

5 years ago

0.12.2

5 years ago

0.12.2-5

5 years ago

0.12.2-3

5 years ago

0.12.2-2

5 years ago

0.12.2-1

5 years ago

0.12.2-0

5 years ago

0.12.1

5 years ago

0.12.1-3

5 years ago

0.12.1-2

5 years ago

0.12.1-0

5 years ago

0.12.0

5 years ago

0.11.0

5 years ago

0.10.2-1

5 years ago

0.10.2-0

5 years ago

0.10.1

5 years ago

0.10.1-1

5 years ago

0.10.1-0

5 years ago

0.10.0

5 years ago

0.10.0-2

5 years ago

0.10.0-1

5 years ago

0.10.0-0

5 years ago

0.9.0

5 years ago

0.8.0

5 years ago

0.8.0-6

5 years ago

0.8.0-4

5 years ago

0.8.0-2

5 years ago

0.8.0-1

5 years ago

0.8.0-0

5 years ago

0.7.0

5 years ago

0.7.0-1

6 years ago

0.7.0-0

6 years ago

0.6.2

6 years ago

0.6.2-1

6 years ago

0.6.2-0

6 years ago

0.6.1

6 years ago

0.6.1-4

6 years ago

0.6.1-3

6 years ago

0.6.1-1

6 years ago

0.6.1-0

6 years ago

0.6.0

6 years ago

0.1.24

6 years ago

0.1.23

6 years ago

0.1.22

6 years ago

0.1.21

6 years ago

0.1.20

6 years ago

0.1.19

6 years ago

0.1.17

6 years ago

0.1.16

6 years ago

0.1.15

6 years ago

0.1.14

6 years ago

0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago