I haven't talked about the data model for bookmarksy.io yet but I spent yesterday evening building out the core data model for bookmarks/categories.
Here's the approach.
First, the definitions:
- Bookmark - a twitter bookmark.
- Category - a group of bookmarks that share a domain.
- User registers
- Categories service seeds their account with a default category "Uncategorized" (all bookmarks will initially exist as part of this category)
- Then, when a user reads their dashboard (these things happen asynchronously):
- categories are loaded
- bookmarks are loaded
- bookmarks are hydrated (reach out to twitter to capture any new bookmarks)
- hydrated bookmarks are loaded into "uncategorized"
So far, this flow exists and is stable, with the exception of bookmark hydration. I have yet to come up with a non blocking, performant solution but am working on it!
I think, given the potential variety of categories, having them account scoped makes the most sense. This will likely lead to some de-normalization but it's an acceptable trade off