I just rebooted NextApex at https://nextapex.org It's a hacker news clone I wrote in Electric (V2). It would probably be good to update it to the latest Electric, sometime. If you'd like to see the source code I can share a link.
no promises, our roadmap can and does pivot on a dime
The most interesting bit to me is the gravity calculation. Hacker News has a gravity measure that allows them to sort the list based on points and hours-alive. I show the gravity next to the little up arrow โ and it's what determines the sorted order of things.
One thing I had a hard time figuring out in V2 was recursion -- I could not infinitely nest comments for some reason or other. So the comments are hardcoded to go 4 deep. Maybe doing this with V3 will be easier.
i love the ui. very retro.
id absolutely love to see the source
https://github.com/eleCush/NextApex/blob/main/src/app/todo_list.cljc Just about everything is in that one file, with a couple things in the electric_server for handling logins, and a latest-db> in the xtdb_contrib to watch the database
i seriously love the styling. i have been dying to see a bezel on a button for years
what is the vision for the tribe feature?
The vision is for multiple people to be part of a tribe and share content relevant to the group's interests. Right now, when you want to share a link you've got to choose a tribe to submit it through. Long-term, when there's a lot of content, I was thinking people would choose which tribes they want to subscribe to/join. It's kinda like subreddits, now that I think about it.
Very cool. Kinda reminds me of Google+ circles too. Tribe is a better word though. Google didn't have electric though!
v2 is just broken in too many ways to express recursion properly. v3 is a lot better, but currently has performance problems, which we're starting to tackle now. The recursive comment thread UI is a bit of a pathological case, I'm not sure if Electric v3 will be up to it or not. Our own "recursive" UIs tend to be in the style of the macos finder, which is actually a tree that has been flattened into a grid. Electric v3 is great at those
https://x.com/thmorriss/status/1817959645576839223 this v2 example used recursion... Worked fine for me. https://github.com/tommy-mor/llm-history/blob/7a51da867087acf88e000ba742b83fbdf0180042/src/electric_starter_app/main.cljc#L111
Although maybe it's using the macos finder pattern after all. But the component calls itself. I can't tell
It's a very small example, compared to a large hacker news thread
everything works for small apps ๐
I will have to make a V3 version of NextApex and report back ๐ซก
great to hear you're working on performance issues! do you have a sense of timeline for the v3 performance work? asking because i'm scoping out a project that needs to ship in 3-6 months and trying to figure out if electric v3 is the right fit
btw, unmounting feels faster than before, did you guys update that recently?
are there electric3 specific LLM rules for AI aided code editors one can add? without I notice the LLMโs struggle between versions of electric.. here is an example of this by some friends who launched a DB startup: https://www.instantdb.com/docs/using-llms
specifically the rules file (not MCP): https://www.instantdb.com/llm-rules/next/cursor-rules.md
i doubt there's a canonical rules file, but fwiw here's my vibe-coded CLAUDE.md that I put in my app/ui/ directory with all the electric cljc files. it's far from perfect but it works for me, would love to get improvements on it https://gist.github.com/yayitswei/630c4b290debcb96a82ef9a854f127c7
thanks, i hired a tech writer to help us make faster progress on the electric v3 docs, we will consider adopting these mannerisms, agents are definitely an intended consumer
@wei thanks for sharing that! Is the doc/electric-clojure.md you refer to in the prompt the google docs one?
no, that's a longer vibe-coded one. I'm less attached to this one, might be a good idea to replace it with the google doc
here's another one that i attempted with code from the hyperfiddle tutorial. too long for most contexts but you can ask an agent to search it for examples
Woah, cheers!
This is increbibly helpful for me, even if it contains "vibes".
Do you find it adherese to the "check the tail" instruction well?
I had extended claude code post tool hook to inject any compilation errors, that was super helpful.
But I kinda broke that hook code so I'll need to rewrite it, I think it makes sense to invest some time in a proper hook that checks the log and extracts at least those pretty electric and shadow-cljs errors. I also spent some time to add more log extraction from the browser console via mcp.
doing it well is tricky (logs get spammy so quickly, that [truncate} from the middle is kind of a requireent)
a tip for not rolling your own wrt browser console extraction: https://github.com/ChromeDevTools/chrome-devtools-mcp/tree/main Well made one that
i've been using https://github.com/microsoft/playwright-mcp but devtools seems more lightweight and better suited for iterative debugging
Yes, also used that. Good mcp too.
thinking more about it, the hook should actually look for build completed messages to verify success, e.g.
[:dev] Build completed. (308 files, 2 compiled, 0 warnings, 1.06s)
instead of errors, since the stacktrace can be long and the agent may miss the actual error if it only looks at the last few linesYeah I had some heuristics to parse out the nice parts of the stack traces. But indeed some are very long.
i've never gotten around to trying hooks. but that seems like a more foolproof way of doing things
tangentially, i would love a tool that balances parens. all the LLMs seem to have trouble with this and it's one of the few things i regularly need to step in and help with
clojure-mcp makes a decent attempt with its edit commands. But I am gravitating more to its native edit tool nowadays.
is it good for working with electric? i've just been using vanilla claude code + CLAUDE.md with decent results
Hmm I modified it heavily myself and took out most of the tools. Nowadays only the clojure eval that I manually extended with clojurescript eval via shadow
That is more important than the paren balancing, giving it a repl
i prefer a more lightweight setup as well
Yes, but eval is super valuable
I often tell claude to โgroundโ or โtraceโ with โreal dataโ and that works really well.
my repl eval is literally a python nrepl client that it wrote itself
Good enough!
I notice if my cljs repl is down it will just use the devtools mcp and call cljs symbols directly. Itโs interesting how resourceful it is.
for sure, super resourceful! i have a bunch of observations like that too.