frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Show HN: APIs as First-Class Citizen

1•battery8318•56m ago
A few years ago, I encountered neovim and a new concept: APIs as first-class citizens.

As I used it more and more in my work, I became increasingly aware of its importance.

Exposing the software's state and operations through APIs greatly improves the debugging experience, provides extensibility, and makes it very convenient for other programs to call them.

On the other hand, centering on APIs can also improve program structure, because the entire program is written around a single context.

Currently, I usually use HTTP as the external interface because it allows for operations using curl and exposes these operations to the front end.

Previously, I used Axum as the HTTP server and utoipa to export the API to OpenAPI. Then, I used tools to convert the OpenAPI as TypeScript code for front-end.

However, I quickly encountered some problems. First, utoipa's documentation isn't generated during the build process; I need to run `cargo test` separately to generate the OpenAPI documentation. Second, utoipa's procedural macros are sometimes complex than the functions themselves. Finally, Axum's type system is overly complex, making every interface writing or modification a painful experience.

Furthermore, while OpenAPI to TypeScript tools are available, their quality is often inconsistent, and the generated code is rarely usable.

I'm hoping for a tool that generates Rust/OpenAPI/TypeScript code by writing something like a proto file. For Rust, ideally, it would generate a trait, so implementing the trait would automatically implement the HTTP interface. In other words, I'd like a tool like this:

```

interface API {

    @get

    void hello_world();

    
    @post

    string hello_world2();
};

```

I've carefully studied tools like gRPC/TypeSpec, but I'm not entirely satisfied.

Since I have prior experience writing parsers and code generation tools, I finally decided to create my own—[XIDL](https://github.com/xidl/xidl). I made the following improvements:

First, I generated the trait and OpenAPI documentation using `xidl-build`, thus resolving the inconsistency in OpenAPI generation time.

Second, I exposed the HTTP interface as an asynchronous trait, hiding its internal complexity within the generated codes. This eliminates the need for developers to struggle with Axum's complex types.

Furthermore, I strictly defined the interface behavior using RFCs, ensuring consistent presentation across different languages. Simultaneously, I used [behave](http://behave.readthedocs.io/en/stable/) and [hurl](http://hurl.dev/) to ensure interoperability among all generators.

Furthermore, I wrote a simple [LSP](https://github.com/xidl/idl-language-server) that allows real-time preview of the OpenAPI interface via scalars. This enables direct HTTP API calls within the browser.

Comments

invincible703•54m ago
ohh ok

DMARC Has Been Public Since 2012. 68.4% of Domains Still Don't Enforce It

https://ciphercue.com/blog/dmarc-enforcement-gap-rua-fragmentation-2026
2•adulion•4m ago•0 comments

Tideman

https://cs50.harvard.edu/x/psets/3/tideman/
1•microsoftedging•6m ago•0 comments

Pre-registered trading backtests – 27 kills, 2 passes, 0 funded

https://strategygraveyard.com
1•Strawburry•13m ago•0 comments

Super Simple Sync with Durable State and TanStack DB

https://streamsy.gandrew.com/articles/the-simplest-possible-sync-engine
1•ghendrix•16m ago•0 comments

My best friend vouched for the developer who took my money

https://fablesofafailedfounder.substack.com/p/yeah-okay-thats-fine
1•OroOmi•16m ago•0 comments

AI sell-off intensifies as investors ditch chip stocks

https://www.theguardian.com/business/2026/jul/28/ai-sell-off-chip-stocks-sk-hynix-samsung
2•lilerjee•16m ago•0 comments

Draws fractals defined by iterated function systems (IFS) using the chaos game

https://opam.ocaml.org/packages/ifs-fractals/
1•cedricbonhomme•22m ago•0 comments

Radio Image Framing Protocol (RIFP)

https://www.ietf.org/archive/id/draft-dulaunoy-rifp-00.html
2•_____k•22m ago•0 comments

Twitter raving about one-shot games with Sol-5.6 and Opus 5

https://xcancel.com/antibot/captcha
3•spwa4•23m ago•2 comments

Insurtech Amsterdam Announces Third Edition of Its Magazine

https://insurtechamsterdam.com/magazine/Insurtech-Digest-Announces-Third-Edition-of-Its-Magazine-...
1•Venesha•24m ago•0 comments

Radio Image Framing Protocol over low-rate radio links

https://github.com/adulau/rifp
1•adulau•25m ago•0 comments

Google's Beyond Zero: Enterprise Security for the AI Era

https://spawn-queue.acm.org/doi/10.1145/3819083
2•jordigg•26m ago•0 comments

We Built Our Knowledge Base

https://www.cerebras.ai/blog/how-we-built-our-knowledge-base
1•cesarrg•30m ago•0 comments

High energy prices force Playmobil to end production in Germany

https://brusselssignal.eu/2026/06/high-energy-prices-force-playmobil-to-end-production-in-germany/
2•Markoff•30m ago•0 comments

Ask HN: Thoughts on AMD Ryzen AI MAX+ 395 for Local AI?

1•mempirate•31m ago•1 comments

What Even Are Microservices?

https://var0.xyz/posts/what-even-are-microservices.html
13•tuxie_•33m ago•18 comments

Intel shows off Starfire, a new space grade chip

https://www.tomshardware.com/tech-industry/semiconductors/intel-shows-off-starfire-space-grade-chip
2•incognito124•33m ago•0 comments

Cooveb Experience – Travel, Refined

https://hotels.cooveb.com
1•sshinde•34m ago•1 comments

Try GossipStack on iOS – a drop-in social SDK for any app

https://gossipstack.com/app-showcase
1•iBuildMobileApp•36m ago•1 comments

Nudists, peaceniks, freeloading travellers: the people keeping Esperanto alive

https://www.theguardian.com/news/ng-interactive/2026/jul/28/nudists-peaceniks-freeloading-travell...
1•trocado•37m ago•0 comments

How to Download and Run Kimi K3 Open Weights

https://comfyfile.com/blog/how-to-download-kimi-k3-open-weights
1•rakibtg•37m ago•0 comments

About the security content of macOS Tahoe 26.6

https://support.apple.com/en-us/128067
18•andor•39m ago•8 comments

Show HN: Kiln – a fast, native batch image processor

https://kilnimage.app
1•the-hangry-dev•40m ago•1 comments

Show HN: DiscountHub – AI-assisted search for deals and promo codes

https://discounthub.uz/
3•MasterBek•40m ago•0 comments

How AI Can Locate Hidden Defence Labs and Military Installations Without Breach

https://zenodo.org/records/21627527
1•sangamdas•41m ago•1 comments

Building Real-Time Analytics with Streaming Engines

https://medium.com/@DolphinDB_Inc/stop-waiting-for-insights-building-streaming-analytics-with-dol...
2•yiweileng•46m ago•0 comments

Can We Hillclimb to Heaven?

https://medium.com/@CasparAddyman/can-we-hillclimb-to-heaven-86e6a2054a99
1•czzprr•47m ago•0 comments

Ask HN: Is there legal risk in AI memory?

1•sarjann•49m ago•0 comments

Someone runs K3 on 80x 5090s, for 20 tok/s

https://twitter.com/totheagi/status/2081855316443205717
3•zkmon•49m ago•0 comments

Randomness in large language models: What researchers need to know (and report)

https://arxiv.org/abs/2607.24372
2•cwbuilds•51m ago•0 comments