News for hackers. Stuff that matters.

dhuan_

Re:A Modern Web App in C on Monday October 12, 2026 @02:41PM (#50060873)
How about modern web apps in shell scripts only:

https://dhuan.github.io/mock/latest/examples.html

Re:Ask HN: What are you working on? (May 2026) on Sunday May 10, 2026 @07:11PM (#48089114)
I have been working on two opensource tools:

https://dhuan.github.io/mock/latest/examples.html Command line utility that lets you build APIs with just one command.

https://github.com/dhuan/dop JSON/YAML manipulation with AWK style approach.

Re:Lute: A Standalone Runtime for Luau on Saturday April 25, 2026 @06:00PM (#47904967)
well done! wouldn't it nice if something like this existed in Lua as well (or maybe it does and I haven't seen it yet)?

I've built a data transforming tool powered by Lua[1] and would definitely like to benefit from an general purpose api/library like Lute.

1: https://github.com/dhuan/dop

Re:Ask HN: What Are You Working On? (April 2026) on Sunday April 12, 2026 @07:21PM (#47745547)
I have been working on two opensource tools:

https://dhuan.github.io/mock/latest/examples.html

^Command line utility that lets you build APIs with just one command.

https://github.com/dhuan/dop

^JSON/YAML manipulation with AWK style approach.

Re:Ask HN: What are you building that's not AI related? on Thursday April 09, 2026 @05:02AM (#47701024)
I have been working on two opensource tools:

https://dhuan.github.io/mock/latest/examples.html

^Command line utility that lets you build APIs with just one command.

https://github.com/dhuan/dop

^JSON/YAML manipulation with AWK style approach.

For me it has to be mock. With it I can create and automate APIs easily.

https://dhuan.github.io/mock/latest/examples.html

Show HN: Dop, Awk-like processing for JSON/YAML/TOML with Lua

https://github.com/dhuan/dop

dop reads JSON, YAML, or TOML from stdin, walks the structure field by field, and lets you transform values with Lua. It can also query nested paths and convert between formats.It weights just 800kb and you don't need Lua installed in your pc.A few examples:echo '{"list":[1,2,3]}' | dop -e ' if type(VALUE) == "number" then set(VALUE * 2) end ' # => {"list":[2,4,6]}echo...

( Read More... | 1 comment | on HN )
Re:A Faster Alternative to Jq on Friday March 27, 2026 @03:18PM (#47547045)
I agree, even trivial tasks require us to go back to jq's manual to learn how to write their language.

this and other reasons is why I built: https://github.com/dhuan/dop

Re:Ask HN: What Are You Working On? (March 2026) on Sunday March 08, 2026 @08:49PM (#47303442)
mock, an API creation and testing utility. Any feedback is welcome.

https://dhuan.github.io/mock/latest/examples.html

Re:Ask HN: What Are You Working On? (January 2026) on Sunday January 11, 2026 @06:42PM (#46581778)
mock, an API creation and testing utility. Any feedback is welcome!

https://dhuan.github.io/mock/latest/examples.html

Re:Charles Proxy on Saturday December 20, 2025 @06:36AM (#46335447)
I’ve found tools like Charles really useful for understanding what’s happening on the wire. When I need something more repeatable (tests, offline work), I usually reach for a mock server instead. I ended up building a small one for my own use and later open-sourced it:

https://dhuan.github.io/mock/latest/examples.html

Re:Ask HN: What Are You Working On? (December 2025) on Sunday December 14, 2025 @04:19PM (#46267037)
mock, an API creation and testing utility. Any feedback is welcome!

https://dhuan.github.io/mock/latest/examples.html

Re:Why your mock breaks later on Monday November 17, 2025 @03:45AM (#45951893)
Great article. In addition, updating your mocking code can often be time-consuming. To try to make this easier, I built mock[1], which streamlines the process of setting up mock services for testing.

https://dhuan.github.io/mock/latest/examples.html

Re:Ask HN: What Are You Working On? (Nov 2025) on Monday November 10, 2025 @08:00AM (#45875538)
mock, an API creation and testing utility. Any feedback is welcome!

https://dhuan.github.io/mock/latest/examples.html

It's also possible create an HTTP service that acts as a wrapper to yt-dlp with just a few lines of shell, I created this example in the following link:

https://dhuan.github.io/mock/latest/examples.html#youtube-do...

Re:Mock – An API creation and testing utility: Examples on Sunday November 02, 2025 @10:31AM (#45791018)
Swagger is a tool for API design and documentation.

Mock on the other hand is an actual API creation utility with which you can define endpoints, execute some logic for each endpoint and then return some data to the client. There are other similar features which are covered in the user guide.

Mock is not: - A tool for API Specs or documentation - A GUI tool.

I admit explaining the usefulness of this tool is not the easiest thing.

Any feedback is welcome!

Re:Mock – An API creation and testing utility: Examples on Sunday November 02, 2025 @09:55AM (#45790759)
I think you intended to post here: https://news.ycombinator.com/item?id=45789474
Re:Mock – An API creation and testing utility: Examples on Sunday November 02, 2025 @08:23AM (#45790135)
Hi! Not yet, unless you use it with containers.
Re:Mock – An API creation and testing utility: Examples on Sunday November 02, 2025 @08:16AM (#45790086)
Hi, thanks for the feedback! I hope it's useful to you.
Re:Mock – An API creation and testing utility: Examples on Sunday November 02, 2025 @08:14AM (#45790068)
Hi, thanks for the feedback!

That's true, it's not a very unique name. I started building it, but only months later I thought of making it public. And then never thought of renaming it.

Re:Mock – An API creation and testing utility: Examples on Sunday November 02, 2025 @08:09AM (#45790031)
Hi thanks for the feedback checking out the project.

> What's the main motivation for creating this tool?

Similar tools exist out there for sure, but they are either complex (more than I wish they'd be) or somehow require you to use a specific programming languages. Mock lets you accomplish this without telling you which language you should use.

Also if you're using mock inside CI pipelines, it also helps the fact that you can just download a executable tool that does not require you the java platform or any other dependency.

> How hard/easy is it to make responses dynamic, i.e. to use something from the request data like query/path param or a body to execute function instead of hardcoding the response

With mock you can use shell scripts as "request handlers". With that said, capturing a query param or a JSON field from the request body is as simple as:

> $ USER_NAME=$(mock get-payload user.name)

> $ SOME_QUERY_STRING_PARAM=$(mock get-query foo)

You can see more of this topic here: https://dhuan.github.io/mock/shell_scripts.html

> I feel like every programming language have similar tool already - WireMock for Java etc. Why should people switch?

True. If people are happy with these tools and needing to use java (or any other lang the tool pulls you into), then there's not much reason to switch.

Re:Ask HN: What are you working on? (May 2025) on Sunday May 25, 2025 @06:10PM (#44091669)
I've been working on mock: https://dhuan.github.io/mock/

the process of creating APIs for testing and automation should be as easy possible. the tools that exist nowadays aren't good enough, they require you to use their programming language of choice or complex procedures for a task that should be simple. I built mock to try to solve that and still continue to maintain it.

Re:Ask HN: What are you working on? (April 2025) on Sunday April 27, 2025 @06:59PM (#43815847)
I've been working on mock: https://dhuan.github.io/mock/

the process of creating APIs for testing and automation should be as easy possible. the tools that exist nowadays for this purpose aren't good enough IMHO, which led me to build it.

Re:Ask HN: What Are You Working On? (February 2025) on Monday February 24, 2025 @09:01AM (#43159649)
I've been working on mock:

https://dhuan.github.io/mock/

the process of creating APIs for testing and automation should be as easy possible. the tools that exist nowadays aren't good enough, they require you to use their programming language of choice or complex procedures for a task that should be simple. I built mock to try to solve that and still continue to maintain it.

Re:Writing and Testing a Paginated API Iterator in Go on Monday December 23, 2024 @11:52AM (#42495754)
that's a really useful testing strategy. I used to to write automated tests using an approach very similar to yours, but I was often bothered that I needed to write code in a programming language to set up the mocked data. After a while the testing code gets really verbose. Not just the mocking setup but also the assertion logic. I wanted an easier way that didn't involve writing much code, so I ended up building "mock":

https://dhuan.github.io/mock/

Show HN: Mock v1.4.3 – create APIs using just shell scripts

https://github.com/dhuan/mock

mock is an API utility - it lets you:- define API routes easily through API configuration files or through command-line parameters. - use shells scripts as response handlers. Or any other type of program can act as response handlers. - test your API - make assertions on whether an endpoint was requested.

( Read More... | no comments | on HN )
I built mock, an api tool and testing utility to be able to quickly manipulate API responses and act as a proxy server at the same time.

After some time, I decided to open-source it:

https://dhuan.github.io/mock/

Hey very useful app, I'll be watching this. I once wanted to set up backend apps during automated CI jobs in order to facilitate e2e tests and ended up making an utility kind of similar - but yours truly goes beyond.

https://dhuan.github.io/mock/

With mock you can set up backend APIs completely from configuration files or even from command-line parameters - such as

$ mock serve --port 3000 --route 'say_hi/{name}' --method GET --response 'Hello world! My name is ${name}.' --route "what_time_is_it" --method GET --exec 'printf "Now it is %s" $(date +"%H:%M") > $MOCK_RESPONSE_BODY'

Older »