Molecule 1.0 - Datomic with Scala

Hi All,

After several years of work, I have now completed and released Molecule 1.0 (web, github) - a non-blocking asynchronous domain-customizable database query language for Scala and Scala.js against the Datomic database.

Molecule makes Datomic transactions and queries intuitive and type-safe. Here’s a simple example of building molecules using the words of some Person domain data model:

Person.name("Bob").age(42).Address.street("Sesame Street 4").save

Person.name.age.Address.street.get.map(_.head ==> 
  ("Bob", 42, "Sesame Street 4")
)

This gets automatically translated to transaction data and Datalog query at compile time and executed against the Datomic database at runtime with minimal overhead.

Since Molecule compiles into both Java byte code and JavaScript, it can also be used for transparent RPCs where you can call the database directly from client/javascript code using molecules without any server code. Much like GraphQL, just with type-safe attribute-inferred code.

Molecule can fetch typed tuples (as shown above), property objects or json and implements nearly all Datomic functionality, including nested hierarchies, associative relationships, time queries, transaction functions, reified transactions and more.

Both the Peer and Client apis are targeted.

Check out a sample project and give it a spin!

Cheers, Marc

3 Likes