Show HN

DortDB

by @jeeza

DortDB, a TS library for mixed-lang queries on JavaScript structures Hello HN, I made a TypeScript library for querying in-memory JS data. Originally, the goal was to have a more modular and lightweight alternative to AlaSQL, but then I was asked to include support for SQL/XML, which I personally find way too verbose. So I got to thinking, remembered Virtuoso's combined SQL and SPARQL queries and extrapolated from there. The resulting engine consists of a shared core that provides the optimizer, query infrastructure etc., and separate languages that can be added as plugins. The way this is implemented is that the languages are translated into a common algebra. Thanks to that, you can mix multiple languages in a single query - imagine you need to process some tabular data, but for each row you want to extract information from a deep tree-like structure. Well, you can write an outer SQL query and put in an XQuery subquery and it just works. The algebra itself is designed to be extensible - I don't presume to have covered everything any query language might need (but there is a language implemented for every major data model - SQL, XQuery and a Cypher-like language (licensing)). For example, XQuery includes two special algebra operators of its own, without needing to modify the core. There is a link to a demo on the GitHub README, where you can play with query plans, or execute queries on some sample data. There is also a link to my diploma thesis about this project, if you're interested in that. The whole thing was presented as a demo at VLDB last year. This is a result of more than 2 years of work, and I'm at the point where I think other people might find it useful too - mainly because I was able to make docs I am happy with. The docs were created with the help of a LLM, but I spent weeks on that, so hopefully they read good. The code itself was written by hand, with the exception of the initial batch of regression tests.

Discover more builders

Builderlust is an endless, joyful scroll of real projects people are shipping right now. Get the app to keep finding your next spark of inspiration.

📱 Coming soon to iOS & AndroidOpen in the app