TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Octo – Generate a serverless API from an SQL query

241 pointsby khalidlafiover 4 years ago

18 comments

eatonphilover 4 years ago
I&#x27;ve got a similar project that reads your db schema and generates a Go REST API and a TypeScript&#x2F;React web interface. (The code-generation is language agnostic so at some point I&#x27;d like to add at least a Java REST API as well.) It supports PostgreSQL, MySQL, and SQLite.<p>Unlike PostgREST&#x2F;Hasura and some other dynamic tools you can &quot;eject&quot; at this point if you&#x27;d like and continue on development without the generator in a language you already know. But I&#x27;m working on exposing Lua-based hooks you could carry across whatever backend language you choose to generate and avoid the need to eject.<p>It has builtin support for paginated bulk GET requests with filtering, sorting, limiting. Built-in support for bcrypt-password authentication and optional SQL filters specified in configuration for authorization of particular endpoints based on session and request metadata.<p>Still very much a work in progress but the goal is to push the envelope on application boilerplate.<p>Screenshots are of the example&#x2F;notes project in the repo.<p><a href="https:&#x2F;&#x2F;www.dbcore.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.dbcore.org&#x2F;</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;eatonphil&#x2F;dbcore" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;eatonphil&#x2F;dbcore</a>
评论 #24443484 未加载
评论 #24446627 未加载
评论 #24447624 未加载
Trisellover 4 years ago
The idea is interesting. But it looks like you end up with a yaml file that enumerates each of your tables&#x2F;endpoints and the queries that back them. So are we exchanging the “complexities” of code, where we have control and testing, for the “lack of complexity” of yaml that becomes unwieldy and untestable in the name of “simplicity?”
评论 #24442817 未加载
Glyptodonover 4 years ago
One of the things that&#x27;s not obvious to me about things like this (and other similar tools) is where&#x2F;how scopes&#x2F;limitations&#x2F;permissions are handled. I assume they either are or can be, I just never see it spelled out clearly. What am I missing?
评论 #24442764 未加载
评论 #24443007 未加载
akieover 4 years ago
Perhaps I&#x27;m old, but who needs an API for an SQL query? I&#x27;m not sure I understand the use case, or the advantage of something like this over a regular API call to a backend which would also allow you to do e.g. authentication. Enlighten me?
评论 #24443825 未加载
评论 #24444191 未加载
评论 #24445718 未加载
cube2222over 4 years ago
Looks great!<p>If you like this, check out OctoSQL[0]... Also in Go... Though OctoSQL lets you query multiple databases &#x2F; files &#x2F; event streams like kafka using SQL from your command line, not as a server, so a fairly different use case, but you should check it out nevertheless!<p>The naming clash is funny.<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;cube2222&#x2F;octosql" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cube2222&#x2F;octosql</a>
评论 #24446094 未加载
ForHackernewsover 4 years ago
Looks vaguely similar to <a href="http:&#x2F;&#x2F;postgrest.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;postgrest.org&#x2F;</a>
评论 #24442730 未加载
alexellisukover 4 years ago
Nice to see openfaas featured here and thanks for your PRs to Arkade. I do wonder what your strategy is on connection pooling and authentication?<p>Also not keen on the passwords being kept in a plaintext file - someone will check that into git. OpenFaaS has secret support which you can use Amal. So does Knative.
mitjamover 4 years ago
Reminds me of the venerable Datasette by Simon Willison: <a href="https:&#x2F;&#x2F;github.com&#x2F;simonw&#x2F;datasette" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;simonw&#x2F;datasette</a>
o1labover 4 years ago
Interesting concept and quite liked the playful logo. Can we pass in env variables to db connection ?<p>We are in similar space, we take input params of db and generate CRUD apis with Auth+ACL and then APIs are packed into a single lambda function. There is support for serverless framework as well.<p>[1]: <a href="https:&#x2F;&#x2F;github.com&#x2F;xgenecloud&#x2F;xgenecloud" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;xgenecloud&#x2F;xgenecloud</a>
评论 #24445331 未加载
alexzenderover 4 years ago
Interesting, I&#x27;ve built a similar project that generates GraphQL API based on your database schema - <a href="https:&#x2F;&#x2F;okdb.io" rel="nofollow">https:&#x2F;&#x2F;okdb.io</a>
bobbywilson0over 4 years ago
My main purpose of tools like these has always been prototypes, or hobby one-off type stuff. For SPAs, or a sketch with a Jupyter notebook. They&#x27;re great for this sort of thing because in my experience, this used to require building some sort of API just to get a simple json interface to the database. It was my understand that the purpose of these types of tools was mostly that.<p>Are folks using these kind of things for non-trivial production applications?
hn_throwaway_99over 4 years ago
I fear that all of these &quot;expose your DB as an API&quot; tools like this, Postgraphile, Hasura, etc. are going to set up folks for a world of hurt down the road. Tightly coupling your end clients to your database schema can make it extremely difficult, if not impossible, to refactor your DB in you need to (which is highly likely).
评论 #24449614 未加载
评论 #24449715 未加载
modartsover 4 years ago
Looks like someone took this tweet literally <a href="https:&#x2F;&#x2F;twitter.com&#x2F;davecheney&#x2F;status&#x2F;1296033304756404225" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;davecheney&#x2F;status&#x2F;1296033304756404225</a>
rimkmsover 4 years ago
Logo is looking good , gj
revskillover 4 years ago
Do u know any similar tool wwhich supports group by query ?
amani92over 4 years ago
Very impressive, Great job.
WrtCdEvrydyover 4 years ago
Your timing is perfect.
ahmadbanaover 4 years ago
Very interesting projects and can be scalable Keep up the good work