In this post, we take a closer look at an open source project called Ent, an entity framework for Go, in a way that is super simple to understand or as it’s commonly known online, ELI5. If you're interested in learning by watching or listening, check out a video about this open source project on our Facebook Open Source YouTube channel.
What do most applications do these days? They interact with data in one way or another. As your app's scale increases, it becomes more challenging to manage databases, schemas, queries, and constraints. These challenges are why a technique called Object-Relational Mapping, or ORM, was created. It vastly simplifies your app's development by limiting how much you work with raw SQL and, therefore, keep your database more secure, your code less repetitive, and your app more robust.
At Facebook, we tend to think about data modeling in graph concepts like with GraphQL, a query language for API. As we were working with Go-lang, we had been looking for a way to get the benefits of ORM while interacting with Graph-based data models. This search led us to create a new open source project, Ent.
Ent is an entity framework built for Go programming language. This framework provides developers with a Graph-based, Object Relational Mapping.
With Ent, data schemas, including types, relations and constraints, are treated as code. Ent lets developers avoid context switching and continue working with Go while using Go.
Ent's static types and explicit API make it very accessible for new developers. In return, this increased efficiency leads to more robust code.
Ent is very much declarative where operations like queries, aggregations and graph traversals are kept simple because there is no need to write raw SQL.
Lastly, Ent enforces a storage agnostic approach where its users are not bound to any particular technology. For example, during the development of Ent, the Facebook Connectivity team was able to migrate from AWS Neptune to MySQL seamlessly.
Ent was open source in 2019, and it has been actively used by the Facebook Connectivity team and several external projects.
Are you interested in learning more about Ent? The project has excellent starter and advanced documentation and a growing following on GitHub. If you are keen on using Go, we invite you to look at GoDoc.
If you have any thoughts or questions about Ent, let us know on our YouTube channel, or tweet at us.
In a series of short videos (~1 min in length), one of our Developer Advocates on the Facebook Open Source team explains a Facebook open source project in a way that is easy to understand and use.
We will write an accompanying blog post (like the one you're reading right now) for each of these videos, which you can find on our YouTube channel.
To learn more about Facebook Open Source, visit our open source site, subscribe to our YouTube channel, or follow us on Twitter and Facebook.
Interested in working with open source at Facebook? Check out our open source-related job postings on our career page by taking this quick survey.