←back to thread

207 points todsacerdoti | 9 comments | | HN request time: 0.963s | source | bottom
1. williamcotton ◴[] No.46004377[source]
I've been working on my own web app DSL, with most of the typing done by Claude Code, eg,

  GET /hello/:world
    |> jq: `{ world: .params.world }`
    |> handlebars: `<p>hello, {{world}}</p>`
  
  describe "hello, world"
    it "calls the route"
      when calling GET /hello/world
      then status is 200
      and output equals `<p>hello, world</p>`
Here's a WIP article about the DSL:

https://williamcotton.com/articles/introducing-web-pipe

And the DSL itself (written in Rust):

https://github.com/williamcotton/webpipe

And an LSP for the language:

https://github.com/williamcotton/webpipe-lsp

And of course my blog is built on top of Web Pipe:

https://github.com/williamcotton/williamcotton.com/blob/mast...

It is absolutely amazing that a solo developer (with a demanding job, kids, etc) with just some spare hours here and there can write all of this with the help of these tools.

replies(5): >>46004648 #>>46004743 #>>46005872 #>>46005982 #>>46006162 #
2. keepamovin ◴[] No.46004648[source]
I like this syntax. And yes it amazing. And fun, so fun!
3. shevy-java ◴[] No.46004743[source]
That is impressive, but it also looks like a babelfish language. The |> seems to have been inspired by Elixir? But this is like a mish-mash of javascript-like entities; and then Rust is also used? It also seems rather verbose. I mean it's great that it did not require a lot of effort, but why would people favour this over less verbose DSL?
replies(2): >>46005045 #>>46011174 #
4. williamcotton ◴[] No.46005045[source]
> babelfish language

Yes, exactly! It's more akin to a bash pipeline, but instead of plain text flowing through sed/grep/awk/perl it uses json flowing through jq/lua/handlebars.

> The |> seems to have been inspired by Elixir

For me, F#!

> and then Rust is also used

Rust is what the runtime is written in.

> It also seems rather verbose.

IMO, it's rather terse, especially because it is more of a configuration of a web application runtime.

> why would people favour this

I dunno why anyone would use this but it's just plain fun to write your own blog in your own DSL!

The BDD-style testing framework being part of the language itself does allow for some pretty interesting features for a language server, eg, the LSP knows if a route that is trying to be tested has been defined. So who knows, maybe someone finds parts of it inspiring.

replies(1): >>46007580 #
5. vidarh ◴[] No.46005872[source]
I like the pipe approach. I build a large web app with a custom framework that was built around a pipeline years ago, and it was an interesting way to decompose things.
6. mike_hearn ◴[] No.46005982[source]
FWIW if someone wants a tool like this with better support, JetBrains has defined a .http file format that contains a DSL for making HTTP requests and running JS on the results.

https://www.jetbrains.com/help/idea/http-client-in-product-c...

There's a CLI tool for executing these files:

https://www.jetbrains.com/help/idea/http-client-cli.html

There's a substantially similar plugin for VSCode here: https://github.com/Huachao/vscode-restclient

7. cdaringe ◴[] No.46006162[source]
Cool! Have you seen https://camlworks.github.io/dream/

I get OCaml isnt for everybody, but dream is the web framework i wish i knew first

8. travisjungroth ◴[] No.46007580{3}[source]
> it's just plain fun to write your own blog in your own DSL!

It’s the perfect thing for skill development, too. Stakes are low compared to a project at work, even one that’s not “mission critical”.

9. AdieuToLogic ◴[] No.46011174[source]
> The |> seems to have been inspired by Elixir?

This is an infix operator commonly used to define the Thrush combinator, which transcends Elixir (or any other programming language). It is effectively:

  f (g (x)) = g (x) |> f