Welcome to the Macchiato DB Scratchpad
This is a scratchpad project to experiment with approaches for database access on Macchiato. Treat this project as back-of-the-napkin scribblings. The whole point is to try different things and see what ends up being cleaner and more Clojuric.
Chances are little or none of the code you'll see here has been library-fied. As sections reach that point, we'll move them into independent projects in the Macchiato Framework organization.
This code's a mess!
Think things could be done better? Great, reach out! You can find us on:
While the Clojurians channel is still the canonical endpoint, it is subject to Slack's periodic history deletion. You can find the full channel history on Matrix/Riot.
What's still missing
- Extracting database access into its own namespace so we can easily turn it into a library
- Migrations (postgrator might be useful here)
- A more polished HugSQL equivalent. A draft version which gets queries from a set of files is at
- Further review of type coercion. There's a working example of type parsers on
- Node.js needs to be installed to run the application.
- You'll need a PostgreSQL database running on the standard port. Check namespace
machtest.dbfor the default database configuration.
- Run the
setup-dev-db.shscript from the project's root folder to create a user, a sample database and table, and some data.
Building and running
running in development mode
run the following command in the terminal to install NPM modules and start Figwheel:
node in another terminal:
machtest.routes for the http entry points and
machtest.db for the database functions.
configuring the REPL
Once Figwheel and node are running, you can connect to the remote REPL at
(cljs) in the REPL to connect to Figwheel ClojureSrcipt REPL.
building the release version
Whereas the dev version has only the one thread, the release version uses a cluster. To build:
Run the release version:
Distributed under the MIT License