Live data from Hacker News

Show HN: Instant API – Build type-safe web APIs with JavaScript

github.com

1–10 of 88 posts

Show HN: Instant API – Build type-safe web APIs with JavaScript

#1
Hey there HN! I just wrapped up an all-day documentation spree for Instant API, a JavaScript framework for easily building web APIs that implements type safety at the HTTP interface. It uses a function-as-a-service approach combined with a slightly modified JSDoc spec to automatically enforce parameter and schema validation before HTTP requests make it through to your code. You just write comments above your endpoint functions and voila, enforced type safety contracts between your API endpoints and your developers. OpenAPI specifications are generated automatically as a byproduct of simply building your endpoints.

This eliminates the need for most schema validation libraries, automates user input sanitization, and prevents your team from developing carpal tunnel syndrome trying to keep your OpenAPI / Swagger specifications up-to-date. We developed it as a side effect of building our own serverless API platform, where it has scaled to handle over 100M requests from users per day. This is an early release, but Instant API has had about six years of consistent development as proprietary software to get to the point it is at today. We have spent the last couple of months modernizing it.

We have command line tools that make building, testing, and deploying Instant API to Vercel or AWS a breeze. Additionally, there is a sister package, Instant ORM, that provides a Ruby on Rails-like model management, migration and querying suite for Postgres. Everything you need to build an API from scratch.

Finally -- LLMs and chatbots are the the top of the hype cycle right now. We aren't immune, and have developed a number of LLM-integrated tools ourselves. Instant API comes with first-class Server-Sent Event support for building your own assistants and a few other nifty tools that help with AI integrations and chatbot webhook responses, like executing endpoints as background jobs.

This has been a huge labor of love -- it has become our "JavaScript on Rails" suite -- and we hope y'all enjoy it!

Show HN: Instant API – Build type-safe web APIs with JavaScript
github.com

Re: Show HN: Instant API – Build type-safe web APIs with JavaScript

#2
Neat. I like the fresh take on validation. It’s not necessarily unique, but it may be cleaner / more efficient than previous attempts. The mixing of backend processing and the http layer reminds me of my CouchDB days. @stream seems potentially tricky to implement at scale but very useful. And a few nits here and there (eg maybe return a 202 instead of a 200 on accept), but overall pretty slick. Any numbers on performance and/or scalability in production?

Re: Show HN: Instant API – Build type-safe web APIs with JavaScript

#3

Neat. I like the fresh take on validation. It’s not necessarily unique, but it may be cleaner / more efficient than previous attempts. The mixing of backend processing and the http layer reminds me of my CouchDB days. @stream seems potentially tricky to implement at scale but very useful. And a few nits here and there (eg maybe return a 202 instead of a 200 on accept), but overall pretty slick. Any numbers on perform…

@stream is actually straightforward in Node; it’s just part of the http request. Typically Instant API waits until the full request is processed to return headers and body as the endpoint implementation could modify headers; but with streaming headers are sent immediately and then the rest of the response streamed with .stream() injecting text.

In serverless environments — where we have used the framework as a gateway with endpoints being executed inside of Lambdas — streaming is accomplished using Redis broadcasting and channels are managed via UUIDs. We may open source this at some point but an enterprising engineer could fork and implement this.

Re; scaling. As mentioned in README we’ve scaled horizontally to 100M requests / day or about 1,157 RPS without issue on older, proprietary versions. Candidly this early release is designed for usability over performance but I wouldn’t be surprised in either direction. :)

Re: Show HN: Instant API – Build type-safe web APIs with JavaScript

#5

I was looking at ChatGPT plugins today and they use the OpenAPI convention. Is it called OpenAPI because it was created by "Open"AI or it's something completely independent of OpenAI that they chose to adopt?

The naming is completely coincidental and probably a little confusing / unfortunate. OpenAPI is a rebranding of Swagger, a really popular open source API specification. Incidentally the OpenAPI initiative only predates OpenAI by a month so I don’t think Sam, Greg & co could have known better at the time.

But OpenAPI is the “gold standard” machine readable API specification format so it makes sense that OpenAI would rely on it!

Re: Show HN: Instant API – Build type-safe web APIs with JavaScript

#6

I was looking at ChatGPT plugins today and they use the OpenAPI convention. Is it called OpenAPI because it was created by "Open"AI or it's something completely independent of OpenAI that they chose to adopt?

OpenAPI predates OpenAI by quite some time. OpenAI has adopted usage of OpenAPI.

I do find myself accidentally saying one and meaning the other, in both directions too!

Re: Show HN: Instant API – Build type-safe web APIs with JavaScript

#7

I was looking at ChatGPT plugins today and they use the OpenAPI convention. Is it called OpenAPI because it was created by "Open"AI or it's something completely independent of OpenAI that they chose to adopt?

OpenAPI predates OpenAI by quite some time. OpenAI has adopted usage of OpenAPI. I do find myself accidentally saying one and meaning the other, in both directions too!

Actually only a month! I just looked it up and was surprised myself.

Re: Show HN: Instant API – Build type-safe web APIs with JavaScript

#9

Earlier quoted context omitted.

OpenAPI predates OpenAI by quite some time. OpenAI has adopted usage of OpenAPI. I do find myself accidentally saying one and meaning the other, in both directions too!

Actually only a month! I just looked it up and was surprised myself.

According to Wikipedia[1] it looks like the rebranding effort from Swagger -> OpenAPI was in November 2015, but the OpenAPI Specification was only officially renamed on 1st January 2016. OpenAI was founded on 10th December 2015. So it depends how pedantic we are being -- technically on branding, OpenAI predates OpenAPI by 21 days. In terms of the spec itself (as in, the thing they adopted), Swagger v1 was released August 2011.

[1] https://en.wikipedia.org/wiki/OpenAPI_Specification

Re: Show HN: Instant API – Build type-safe web APIs with JavaScript

#10

Earlier quoted context omitted.

Actually only a month! I just looked it up and was surprised myself.

According to Wikipedia[1] it looks like the rebranding effort from Swagger -> OpenAPI was in November 2015, but the OpenAPI Specification was only officially renamed on 1st January 2016. OpenAI was founded on 10th December 2015. So it depends how pedantic we are being -- technically on branding, OpenAI predates OpenAPI by 21 days. In terms of the spec itself (as in, the thing they adopted), Swagger v1 was released Au…

Worry not, this is Hacker News. Pedantry is more valuable as currency than H100s here.
Post reply on HN