datahike

silian 2025-11-01T18:32:29.009129Z

So writing to a peer will not reflect in the other peers. In order for all peers to see "a single source of truth" datahike needs to be set up with a special "writer" node that all peers submit transactions to. (This creates a queue and potential bottlenecks, which the original design of datahike tried to avoid.)

silian 2025-11-01T18:53:15.140929Z

So I will add :writer to my cfg but my app runs on Heroku; the URL should point to what exactly? Any dedicated dyno? Nevertheless, datahike will know how to coordinate these resources?

{:writer {:backend :datahike-server
 :url ""
 :token "securerndompassword"}}

alekcz 2025-11-01T20:01:23.467249Z

You need to run datahike-server. It's an uberjar that you need to build and run.

alekcz 2025-11-01T20:01:56.243499Z

You can do :writer or you can do :remote-peer which makes a thin client

alekcz 2025-11-01T20:03:10.985359Z

This repo is what I'm doing in prod: https://github.com/alekcz/datahike-server I build the uberjar in github actions then make a docker image which I then deploy.

1
silian 2025-11-01T20:08:17.314049Z

Thanks Alek

silian 2025-11-02T06:39:12.836789Z

Can I integrate this into my existing prod app / codebase? (Or this somehow has to be a separate service?)

alekcz 2025-11-02T06:45:16.395819Z

It makes sense to use this if you need multiple datahike instances you want to updates the db from your reply and not your running app. If your ran app is the only writer then you don't need it.

alekcz 2025-11-02T06:45:37.004419Z

It has to be its own service.

alekcz 2025-11-02T06:45:58.668109Z

Or you could extract the datahike server code and put that into your app.

silian 2025-11-02T07:00:23.632019Z

I'm not sure if I need multiple datahike instances; I'm still not clear what that means. My understanding is simplistic. I am trying to create something like Reddit, practically speaking. (But much smaller : )

alekcz 2025-11-02T07:01:11.930969Z

Driving. Will reply now now.

alekcz 2025-11-02T07:25:05.680769Z

(Going to reply in the main thread so I have space to write)

silian 2025-11-02T07:34:31.331529Z

Thanks Alek. My general goals are these: When a user to this new web app refreshes a page, or visits a new one, I would like what they see to reflect the state of the db when they make that request. But I would also like to change the prod app and schema "on the fly" from my REPL. Call this "the old Lisp way" (which Paul Graham writes about when he was developing his startup Viaweb).

alekcz 2025-11-02T08:03:40.413189Z

I get you. We need to make changes to datahike to make that easy. I'm hoping to get to that soon. I have the same issue.

silian 2025-11-01T06:08:29.057779Z

When I try to transact against my prod conn (from local repl), I have no success/ stalls out; I have to kill my REPL, reconnect and re-load my project. It's a real downer because it kills my flow. What am I doing wrong?

timo 2025-11-01T12:24:17.157519Z

Hi @feedmyinbox02_clojuri, do you have an exception or something? Is it always like that or only after a while?

silian 2025-11-01T18:34:48.397549Z

Hi timo. It's only after some time has passed. I will try to reproduce and confirm, and also get some error information for you. Thank you for reply