#Convex Ents: Manage your document relationships

16 messages · Page 1 of 1 (latest)

thin flume
#

https://stack.convex.dev/ents

Convex Ents is an opinionated take on modeling and retrieving complex document relationships in your app. It builds on top of the built-in Convex capabilities to provide:

  • Modeling "edges" between tables, including many-to-many relationships
  • Ability to easily map and filter documents retrieved from the database
  • Enforcing unique field values
  • Defining default values for easier document shape evolution
  • Propagating deletion to related documents
  • Soft and scheduled deletions
  • Row-level security/permissions and more

Convex Ents is a library that provides: simpler ways to model and query related documents, ability to easily map and filter documents, enforcing uniqu...

hot delta
#

This is amazing Michael. I find it super clean and def something I’m looking forward to trying out. This raises a question about migration, are there any stack posts on migrating and changing schemas and such to your knowledge?

thin flume
#

I don't have a migration resource yet, that's good feedback. You have two primary choices:

  1. Adopt Ents next to your existing vanilla code
  2. Refactor your code to use Ents

Either way, for the schema you can rename defineTable and defineSchema to the ent equivalents (the schema is a strict superset, so everything that you had in there will continue to work)

And then you can refactor your reads and writes to use ctx.table.

Curious if you attempt this how it goes and what path you chose!

hot delta
#

Okay so that’s great. I think the plan would be to use ents in a new project for the hackathon first, to pick up on the syntax - I was planning on joining anyhow. And then start refactoring some parts of the commercial platform I’m building. I see multiple areas of that, which could benefit. Especially when being the only dev in our team as we build out our MVP, for a rather large video platform. We value simplicity is key, and getting features tested quickly on our test group. So this will allow us to save valuable time. I’ll report back how it goes!

1 question. Does cascading and scheduled deletion work on storage ids?

sturdy mist
#

What’s the origin of the name?

hot delta
thin flume
thin flume
hot delta
jaunty inlet
#

@thin flume, is there an existing example of using ents in a project?
I'd like to use ents, but I'm a little confused about best practices for creating a simple action.

So far I love the concept! I just setup a schema, and it was a breeze, and it's easy to understand the relationships between tables.

thin flume
pearl ether
#

@thin flume I'm curious if this is something that will be supported or further developed as part of convex? I'm tempted to use this, but I just wonder if this is more of an experiment or something we can expect to be around for a while?

I did try this out and I found it really nice - I'm just trying to decide if I take the leap in an existing project or not 🙂

That said, this looks great, good work!!

thin flume
#

@pearl ether Ents are currently community maintained. It is purely a library and so anyone can write one, and you could vendor it into your project an amend to your needs. The more people use the library the more support from the Convex team it will get.

open pilot
#

also, star the convex-ents repo if you're using it! it helps us keep tabs on adoption