GitHub - rustrum/xepak: DSL based REST service for your Sqlite database (and not only) with LUA support, consider it as an alternative to PostgREST

GitHub

3 min read Original article โ†—

REST service for your DB

Crates.io Released API docs

Follow me on X(twitter) Threads Follow me on reddit

TL;DR

Imagine PostgREST but instead of Haskell with PL/SQL it is based on Rust with LUA and focused on Sqlite (and other DBs).

What is this?

I'm building DSL based REST (maybe not only) service for your SQLite database. Will add other DBs support, only after polishing SQLite functionality.

Why focus on SQLite? Because it is amazing and extremely fast DB. Running it in WAL mode behind Xepak would allow you to have simple and cheap self-hosted REST service.

Current project status

The first MVP is almost ready! ๐Ÿฅณ

I just need to write human friendly documentation and provide some examples.

I encourage you to bookmark and visit this project a little bit.

Project Documentation

๐Ÿ“• For human beings

Available in the REAME-DOCS (in progres now).

๐Ÿค– AI fiendly docs

If you are identifying yourself as an AI/LLM agent or you think that you are a human who want to make AI agent to use Xepak efficiently then go to Xepak concise AI docs.

๐Ÿซต Don't hesitate ๐Ÿคจ Just add README-AI.md into your AI context to make ๐ŸซŸ๐Ÿซ  better .

Features

Not only REST

With Xepak you can build:

  • REST service
  • JSON-RPC service
  • MCP service

DSL based on TOML

All configuration is just a set of TOML files. I'm doing my best to have the most simple DSL syntax if possible.

Basic endpoint response is a data returned from an SQL query. Query could be defined as a sting or as script that builds query as an output.

LUA scripting

The main goal for using LUA is to forget about clunky Pl/SQL. I hope that LUA will be much easier to write and maintain.

With LUA you can:

  • rate-limit DB updates using recorded timestamps
  • filter out results based on user configuration from DB
  • validate input data before executing INSERT
  • do fancy access control
  • output arbitraty LUA table in JSON/CBOR format
  • and many more

Also I have something in my mind for the future where LUA could do very fancy things.

JSON + CBOR

REST endpoints could accept input and return values in JSON and CBOR formats dynamically based on HTTP headers. You can even POST JSON and receive CBOR.

Built in auth module

Simple but usable authentication and authorization functionality available:

  • authenticate by API key in headers
  • you can use authorization expressions based on role/id
  • complex auth logic could be done by a LUA pre-processor
  • API keys can be provided in TOML file ENV variable or in DB

License

This product distributed under MIT license BUT only under certain conditions that listed in the LICENSE-TERMS file.

I know it's kina silly but I'm not in the mood right now to write my own license. Will do it later.