Elm + PostgREST

Hi there,

I’m trying to find out if Elm + PostgREST would be a good stack to reduce overall complexity and longevity of a system. I have played with postgrest before and really liked the experience. I am also quite a big fan of the postgresql database. I’m starting to learn Elm and saw that John Kelly has made a package available for Elm Postgrest interop.

Have you made experience with this stack?

I evaluated this stack for a project but I went with a more classical approach because I was a little hesistant to expose the database in such a direct manner. Of course, you can limit access with Postgres but there is still a risk.

But I really like the general idea and it could indeed make an application less complex.

1 Like

I chatted with @michi-zuri on slack but I’ll respond here briefly for anyone else interested.

I’m no longer maintaining john-kelly/elm-postgrest and I haven’t updated for the latest elm or postgrest version.

With that being said, I imagine the API of the library wouldn’t need to change much to get to a working state.

Also, although I’m not actively working on this, I’d be more than happy to chat with anyone about elm + postgrest in more detail. Just ping me on slack

1 Like

Hi @michi-zuri

I’ve been using alex-tan/postgrest-client package for a generic admin interface that reads the OpenApi schema definition to build dynamic filterable listings and forms for resources, and I am quite satisfied with the API. My use case is to build simple custom made CMS’, I’ve been relying on Rails’ Active Admin but I want a simpler stack.

If you’re curious here’s my app, still in progress.

Another option if you’re okay not using Postgrest is using a GraphQL layer. Hasura is a big player and pg_graphql is a newcomer. It has the same “generate a schema from your DB” way of working but then you can use elm-graphql, which AFAIK is maintained, to get the Elm compiler to know about your schema.

Of course, that would mean not using REST to communicate with your app, which could be a hard stop. You can always have REST endpoints with Hasura or still enable Postgrest.