Live data from Hacker News

A Poor Man's API

blog.frankel.ch

51–60 of 127 posts

Re: A Poor Man's API

#51
post #23
post #22

Ehh this seems more annoying than just writing an MVP in (your language of choice) given you already have the expertise.

Many projects grow to the point that the limitations of writing everything in views and stored procedures becomes more painful than writing the CRUD code in Python, Node, Ruby, PHP, or whatever. Personally, I’d give a shout for https://api-platform.com/ .

What are the particular pain points for you?

For me - using a similar system (Hasura), it's migrating things dependent on views. Feels like this should be a solved problem (database migration issue, not due to Hasura).

But I still prefer it over writing CRUD.

Re: A Poor Man's API

#52
post #49

> when you’ve validated the requirements, you can keep the existing façade and replace PostgREST with your custom-developed API. Why? What is it about postgrest which makes it unsuitable for "real" usage? The author doesn't mention it.

I would go the other way around. Why start with an SQL database? When I start something new, I don't want to fiddle around with tables every time I change my model.

I agree but the baby of “joins” is often thrown out with the bathwater of “schemas”

Is there a relational schemaless DB I wonder?

Re: A Poor Man's API

#53
post #24

Earlier quoted context omitted.

Supabase has a free tier with all this included, plus more. It's the best install of postgres I've seen and I'm obsessed with how it makes triggers, auth, etc., all included.

Did a user group presentation on Supabase, no one in the audience had ever heard of it. I came away quite impressed. Plan on building a complex API with it soon. If I was currently employed as a backend developer I'd be worried.

Don't worry, somebody still has to design all the database tables/relations, views, triggers, etc. Which means we all become better database developers, which is a very good thing.

Also, these tools can't handle certain back end logic (ie, API interactions and integrations, long running processes, etc). Which is the complex bit, anyways.

Re: A Poor Man's API

#54
This is far from what I'd call "poor man's" thing.

I'd want to host it for free, so Vercel and Netlify comes to my mind. But to go real poor man style, I'd use Google sheets as a backend and throw some caching layer on top of it. Firebase or one of its competitors is also a good idea to get some API up and running for free.

Re: A Poor Man's API

#55

Earlier quoted context omitted.

NKOTB: https://neon.tech/ Free Tier includes: compute up to 1 vCPU / 256 MB storage up to 10 GiB 3 projects per user

Neon is fresh out of private beta (or should be soon). I can't wait to play with it. However they're all about Hasura lately rather than PostgREST, which this article talks about. Nikita, their CEO, was a guest on the Changelog[0] podcast a month or so ago. Well worth a listen, great episode. [0] https://changelog.com/podcast/510

Supabase requires Postgres logical replication which Neon doesn't quite have yet have (but it's on the roadmap)

https://community.neon.tech/t/plans-for-logical-replication/...

I'm also really excited about Neon.

My dream stack is Neon (Postgres) + ReadySet (database caching proxy) + Supabase.

Re: A Poor Man's API

#56

This is far from what I'd call "poor man's" thing. I'd want to host it for free, so Vercel and Netlify comes to my mind. But to go real poor man style, I'd use Google sheets as a backend and throw some caching layer on top of it. Firebase or one of its competitors is also a good idea to get some API up and running for free.

Stick it on the Render free or cheap tier. Or Supabase for free in just a single click:

https://supabase.com/pricing

You're better off starting with Postgres than having to migrate from some kind of no-sql setup later.

Re: A Poor Man's API

#57
Maybe I am biased, but at this point I would find simpler to just give access to the DB.

Let user write their own SQL queries and meter how much time they use for billing or abuse prevention.

Re: A Poor Man's API

#58
post #17

> Creating a full-fledged API [...]. You need to think about [...] the REST principles I can assure you you don't need to do that. And most people don't. It's perfectly possible to create a useful API without adhering to the REST principles. [Edit, having read the rest of the article]: Case in point, this very PostgREST tool promoted in the article appears very useful, while not thinking about the REST principles.

What is the acronym for when something needs to be done, so you create an endpoint to do that thing, maybe return HTML if convenient (if it is a page request) or JSON if it is XHR, and then move on to the next user story?

It's called ReRe, Return Response

Re: A Poor Man's API

#59
post #23

Earlier quoted context omitted.

Many projects grow to the point that the limitations of writing everything in views and stored procedures becomes more painful than writing the CRUD code in Python, Node, Ruby, PHP, or whatever. Personally, I’d give a shout for https://api-platform.com/ .

What are the particular pain points for you? For me - using a similar system (Hasura), it's migrating things dependent on views. Feels like this should be a solved problem (database migration issue, not due to Hasura). But I still prefer it over writing CRUD.

At some point CRUD goes from being pure CRUD to mostly CRUD with a few special requirements - e.g. complex RBAC rules, decorating data, API versions, integrating third-party APIs, scaling. They're easy to do in most app frameworks (Laravel, Django, Rails), tricky in something like Postgrest. I haven't use Hasura.

Re: A Poor Man's API

#60

Not to be mean, but from my reading this needs Heroku free tier which no longer exists? I am very sorry if I got that wrong.

Supabase has a free tier with all this included, plus more. It's the best install of postgres I've seen and I'm obsessed with how it makes triggers, auth, etc., all included.

I think they should create a tier between the free and pro with a price of USD5 that doesn't pause projects and has backups
Post reply on HN