frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Show HN: Pure Effect – Reproduce production bugs on your laptop without a DB

https://pure-effect.org
27•tie-in•2d ago
Hi HN,

I think it's safe to say that the majority of developers don't give a second thought to writing code with I/O tangled in business logic. It's all too common to see code like: const user = findUser(email); if (!user) await saveUser(user);

Now, you may ask: what's the big deal? When we write code like this, two things happen:

1. It gets harder to debug production bugs. Unless you have the exact same database and remote API services to connect to, you may fail to reproduce the bug.

2. You have to use mocks and fakes in your tests, or use test containers, which only help somewhat, and they are slow!

To solve these issues, I built Pure Effect, a tiny TypeScript/JavaScript effect library. The core idea is simple: if a function performs I/O, it isn't pure. But if it returns a description of the I/O it wants to perform, it is. So instead of await findUser(email), you return a Command object that says, "I would like to call this function, and when it finishes, here's what to do next." Your business logic becomes a pure function. Same input, same output, every time. The database never gets touched until the interpreter (runEffect) runs.

When I first started the library, I didn't expect just how far that one idea would stretch. Once your pipelines are just data, a lot of wonderful things become possible:

- No need for mocking libraries. You walk the tree in tests and assert on its structure: assert.equal(flow.cmd.name, 'cmdFindUser'). Nothing is executed.

- Wrap any effect with Retry(effect, { attempts: 3, delay: 200, backoff: 2 }). The configuration is plain data, so you can assert on it in tests.

- Every command's input and output flows through the interpreter, so you get a full execution trace for free. You can write a simple timeTravel() function that replays it locally without touching any I/O. Perfect for debugging complex production bugs.

- An onBeforeCommand hook sits between your business logic and the interpreter. Since it sees every intended side effect before it fires, it can be used to enforce runtime guardrails. You can quarantine destructive calls before they happen for example.

- You can review AI-generated code before it runs. Since Pure Effect pipelines are plain data, you can inspect what the generated code intends to do before it touches anything.

There are just six primitives: Success, Failure, Command, Ask, Retry, and Parallel, plus effectPipe and runEffect. Zero dependencies. Under 1 KB minified and gzipped.

How it compares to Effect-TS

Effect-TS is the full-featured option in this space and has a large ecosystem. Pure Effect offers a different tradeoff. It covers the 80% case: testable pipelines, dependency injection, retry, and OpenTelemetry hooks, all in under 1 KB with zero dependencies and no new vocabulary to learn. Effect-TS is a framework you build around. Pure Effect, on the other hand, is a pattern you drop into existing code.

I've been using Pure Effect in production since December. It's at v0.8.0, not 1.0 yet, but stable enough that I wanted to put it out there and hear what people think.

GitHub: https://github.com/aycangulez/pure-effect

I wrote five posts that document how Pure Effect evolved. They are tagged at https://lackofimagination.org/tags/effect/ if you want the longer story.

Comments

ramon156•1h ago
So many promises and claims in both the post and the README, yet I have no seen any evidence. I don't want to nitpick things out because it doesn't add much to the conversation, but it's assuming a lot of things about me

"the majority of developers don't give a second thought to writing code with I/O tangled in business logic"

This is a very fuzzy intro

- "the majority of developers dont do X", is something that needs to be easily verifyable

- "writing code with I/O tangled in business logic" seems like just SoC, I doubt devs have never heard about this.

The solution is a library that adds a bunch of FP with... tests? Hard bugs require session replays, not FP. FP has nothing to do with "reproducing bugs on your device". These seem like two things loosely wired together.

If you're trying to make something alike Effect-TS, then sure, this looks like a cool library, but it took a while for me to get to that conclusion.

Also, the five AI generated articles provide little value to the conversation. They don't even have a topic, other than you talking about your own library.

dwroberts•1h ago
> Testing without mocking

> you can assert on what the code intends to do without executing any of it

is that not just bending the meaning of mocking? Nulling things out and not executing them is a form of mocking (and the default behaviour for mocks in most languages)

woutgaze•55m ago
I have the feeling that the author is really onto something: the explicit boundary between symbolic intent and real-world execution.

Type systems don’t cut it always, you sometimes need something in-between imperative code - which is hard to test all edge cases - and pure type system chasing. The sweet spot maybe lies in having a DSL (in this case "building business mutations") and have good building blocks.

erispoe
•
53m ago
Why not just use Effect? https://effect.website/
rirze•29m ago
He comments on this in the Hackernews post text:

> Effect-TS is the full-featured option in this space and has a large ecosystem. Pure Effect offers a different tradeoff. It covers the 80% case: testable pipelines, dependency injection, retry, and OpenTelemetry hooks, all in under 1 KB with zero dependencies and no new vocabulary to learn. Effect-TS is a framework you build around. Pure Effect, on the other hand, is a pattern you drop into existing code.

indiv0•8m ago
Been kicking around a similar idea in the back of my mind from the first moment "functional core / imperative shell" [0] and "sans-IO" [1] infected my brain. I've been chasing that high ever since.

Unfortunately, whenever I try to apply this pattern 100%, I hit all kinds of walls -- the language isn't expressive enough to support what I want, the amount of wiring/glue to support it becomes a burden, the resulting code is spaghetti because the "declaration of intent" lives too far from "implementation of the intent". Part of the problem is certainly my own capabilities as a developer as well.

I can't help but fantasize about the platonic ideal of a "perfect" system where all that nasty evil I/O is banished to the Shadow Realm and I can frolic in the Fields of Idempotency and Reproduciblity -- one of these days I'll bite the bullet and try Haskell.

Nowadays I aim for 80% "perfection", and only in the areas where it matters. In addition, instead of effects I rely more on "reduce complexity as much as possible", which is (frustratingly) much harder to put into practice than "use X library/pattern to solve all problems". Though if I can model the system as a state machine and proptest it [2], that usually gets me where I want to be.

Though my soul feels like I just woke up from a dream where I was perfectly content, and now I'm back in the real world with all of its imperfections [3].

---

As for your specific project, it heavily reminds me of the Crux [4] model, which is itself inspired by Elm [5]. I wish you the best of luck with your project.

[0]: https://www.destroyallsoftware.com/screencasts/catalog/funct...

[1]: https://fasterthanli.me/articles/the-case-for-sans-io

[2]: https://sled.rs/simulation.html

[3]: https://xkcd.com/224/

[4]: https://github.com/redbadger/crux#architectural-overview

[5]: https://guide.elm-lang.org/architecture/

John Carmack on the mistakes around Quake that ruined id software

https://twitter.com/ID_AA_Carmack/status/2069799283369345247
136•shadowtree•51m ago•47 comments

RubyLLM: A Ruby framework for all major AI providers

https://rubyllm.com/
149•doener•2h ago•21 comments

We’re making Bunny DNS free

https://bunny.net/blog/were-making-bunny-dns-free/
623•dabinat•7h ago•205 comments

Show HN: Nub – A Bun-like all-in-one toolkit for Node.js

https://github.com/nubjs/nub
95•colinmcd•2h ago•20 comments

CAPTCHAs have failed for 20 years

https://www.browserbase.com/blog/why-captchas-are-getting-harder
9•harsehaj•44m ago•7 comments

I taught a bucket to speak Git

https://www.tigrisdata.com/blog/objgit/
13•xena•43m ago•0 comments

Running Windows Games on a Hobby OS with Wine

https://astral-os.org/posts/2026/04/03/wine-on-astral.html
42•avaliosdev•2h ago•10 comments

PR spam today looks like email spam in the early 2000s

https://www.greptile.com/blog/prs-on-openclaw
17•dakshgupta•2h ago•7 comments

Krea 2: SOTA open-weights 12B image model

https://www.krea.ai/blog/krea-2-technical-report
155•mattnewton•1d ago•18 comments

Genuinely, my all-time favourite image: Mamenchisaurus hochuanensis

https://svpow.com/2026/06/04/genuinely-my-all-time-favourite-image-mamenchisaurus-hochuanensis/
37•surprisetalk•2d ago•6 comments

A Practical Guide to SSH Tunnels: Local and Remote Port Forwarding

https://labs.iximiuz.com/tutorials/ssh-tunnels
139•signa11•4d ago•28 comments

Quebec town recognizes trees as living beings with rights

https://www.cbc.ca/news/canada/montreal/terrasse-vaudreil-quebec-tree-rights-9.7243634
52•speckx•1h ago•39 comments

Haystack: Open-Source AI Framework for Production Ready Agents, RAG

https://haystack.deepset.ai/
56•doener•5h ago•18 comments

Founding a company in Germany: €9600, 152 days and I still can't send an invoice

https://paolino.me/founding-a-company-in-germany/
414•earcar•4h ago•476 comments

Boffin claims Microsoft's "quantum leap" is invalid due to "basic Python errors"

https://www.theregister.com/research/2026/06/24/boffin-claims-microsofts-supposed-quantum-leap-do...
49•connorboyle•1h ago•25 comments

Edsger Dijkstra's Library (Housed and Archived in Leuven, Belgium)

https://www.dijkstrascry.com/inventory
16•rramadass•1h ago•2 comments

Show HN: Pure Effect – Reproduce production bugs on your laptop without a DB

https://pure-effect.org
28•tie-in•2d ago•6 comments

Show HN: Monolisa v3 – a typeface for developers and creatives

https://www.monolisa.dev/
75•bebraw•2d ago•16 comments

Raspberry Pi Pico W as USB Wi-Fi Adapter

https://gitlab.com/baiyibai/pico-usb-wifi
227•byb•13h ago•108 comments

For Most of the World, Open-Source AI Is the Only Way Forward

https://techstrong.ai/articles/for-most-of-the-world-open-source-ai-is-the-only-way-forward/
8•CrankyBear•1h ago•0 comments

Statistics that live in your SQL

https://kolistat.com/blog/the-stats-duck-v0-6-0/
108•caerbannogwhite•2d ago•15 comments

OpenAI and Broadcom unveil LLM-optimized inference chip

https://openai.com/index/openai-broadcom-jalapeno-inference-chip/
94•meetpateltech•3h ago•34 comments

Ashby (YC W19) Is Hiring EMEA Engineers Who Can Design

https://www.ashbyhq.com/careers?ashby_jid=87b96eef-edc1-4de4-adb6-d460126d02f8&utm_source=hn
1•abhikp•9h ago

Show HN: peerd – AI agent harness that runs entirely in your browser

https://github.com/NotASithLord/peerd
6•NotASithLord•1d ago•0 comments

François Englert (1932 – 2026)

https://home.cern/francois-englert-1932-2026/
49•toomuchtodo•3d ago•3 comments

"Fix" MacBook Neo Cursor Lag: Record 1 Pixel of the Screen Every 10 Seconds

https://gist.github.com/retroplasma/ec21767d0a8380c7ea9c2fbee1c7d6bf
185•retroplasma•14h ago•78 comments

Minimus container images are now free

https://images.minimus.io/
99•dimastopel•4h ago•59 comments

Systems optimization should be part of CI/CD

https://ucbskyadrs.github.io/blog/levi/
11•ttanv•3h ago•2 comments

Qwen-AgentWorld: Language World Models for General Agents

https://arxiv.org/abs/2606.24597
175•ilreb•14h ago•47 comments

Stealing Is a Skill

https://ben-mini.com/2026/stealing-is-a-skill
96•bewal416•3h ago•75 comments