Live data from Hacker News

Show HN: Copper – A Go framework for your projects

github.com

71–80 of 86 posts

Re: Show HN: Copper – A Go framework for your projects

#71

Congrats! > One Binary > Build frontend apps along with your backend and ship everything in a single binary. I'm doing something similar and love it. Do you embed the entire `public` directory and then traverse the embed.FS to access the files in memory?

Thank you! Go supports embedding static files natively [1]. Copper builds on top of it and provides the tooling to do it seamlessly for web projects.

[1]: https://pkg.go.dev/embed

Re: Show HN: Copper – A Go framework for your projects

#72

Earlier quoted context omitted.

I think an ORM like https://github.com/xo/xo with https://sqlc.dev/ as a fallback for complex queries will be a killer combo!

Two high level abstractions that compile into another high level abstraction called SQL. Why increase the complexity of something that's already a high level abstraction? Abstractions are about simplification. An orm and sqlc are not it.

https://sqlc.dev/ is not an ORM. It's not an abstraction over SQL. It is a brilliant way to make SQL the focus of your models by generating the code from your SQL, instead of the other way around.

Re: Show HN: Copper – A Go framework for your projects

#74
post #29

Earlier quoted context omitted.

Building a "Rails-like" framework in Go is honestly totally antithetical to the "Go way" of doing things. Rails has a ton of magic, implicit behaviours, monkey patching, ERB, and so on. Go is a touch below Java verbose, explicit, no magic, every function call can be very easily traced without having to do meta programming and code generation in your head to understand what's going on. In my 8 years of writing Go, I w…

Go needs a better ORM story, it is unfortunate Prisma abandoned their Go port.

ORM's help do simple stuff well enough, but they sure make hard tasks harder. Ever try to construct a 30 line report query using this years language flavor of an ORM?

https://sqlc.dev/ makes your SQL the focus, not your Go-specific query code.

Re: Show HN: Copper – A Go framework for your projects

#75

Earlier quoted context omitted.

Two high level abstractions that compile into another high level abstraction called SQL. Why increase the complexity of something that's already a high level abstraction? Abstractions are about simplification. An orm and sqlc are not it.

https://sqlc.dev/ is not an ORM. It's not an abstraction over SQL. It is a brilliant way to make SQL the focus of your models by generating the code from your SQL, instead of the other way around.

Ah I see. My mistake.

Re: Show HN: Copper – A Go framework for your projects

#77

Congrats! > One Binary > Build frontend apps along with your backend and ship everything in a single binary. I'm doing something similar and love it. Do you embed the entire `public` directory and then traverse the embed.FS to access the files in memory?

embed.FS is really cool. If you wanna see what it looks like, check out how I build ntfy [0]. It ships with the docs (built from mkdocs, see [1]) and the React web app [2] all in a single binary.

Here are the embed statements [3]. One thing to note is that embed.FS does not send 304 Not Modified status back, which is why I made a CachingEmbedFS [4].

[0] https://github.com/binwiederhier/ntfy/blob/main/Makefile#L77

[1] https://ntfy.sh/docs/

[2] https://ntfy.sh/app

[3] https://github.com/binwiederhier/ntfy/blob/main/server/serve...

[4] https://github.com/binwiederhier/ntfy/blob/main/util/embedfs...

Re: Show HN: Copper – A Go framework for your projects

#78
post #11

Devs interested in this may also be interested in Pagoda [1], a rapid, easy full-stack web development starter kit in Go that I wrote. It leverages popular frameworks and modules that you can easily swap out, if desired. The readme contains full documentation and it's very much batteries-included. [1] https://github.com/mikestefanello/pagoda

just wanted to say i really like the approach of a "template/starter" that you took. My team isn't starting a new project anytime soon to really make full use of it, but we have pretty much adopted the pagoda service container approach in our home-grown "framework".

Re: Show HN: Copper – A Go framework for your projects

#79
post #29

Earlier quoted context omitted.

Go needs a better ORM story, it is unfortunate Prisma abandoned their Go port.

SQL is an incredible language with decades of theory and implementation behind it. I have never found an ORM to be better or faster or more useful than hand-written SQL for anything but the simplest of queries, and even then the benefit is debatable.

99% of a CRUD app -- which is most of them -- is going to be simple CRUD stuff. Load a thing from database, let user edit it, save it. Doing that in 'plain' sql, even with templating, is repetitive and error prone.

An ORM that didn't let you escape to SQL when you wanted to do more complex things would be a total failure, of course -- but to suggest that they're not more convenient for the 80/20 or even 90/10 use case is just really hard to understand. Must be NIH syndrome.

Re: Show HN: Copper – A Go framework for your projects

#80
post #29

Earlier quoted context omitted.

Go needs a better ORM story, it is unfortunate Prisma abandoned their Go port.

ORM's help do simple stuff well enough, but they sure make hard tasks harder. Ever try to construct a 30 line report query using this years language flavor of an ORM? https://sqlc.dev/ makes your SQL the focus, not your Go-specific query code.

Lots of ORMS have an escape to SQL for querying, or you can choose to ignore the ORM for querying. As an example, ActiveRecord allows you to do this:

  Client.find_by_sql("
  SELECT * FROM clients
  INNER JOIN orders ON clients.id = orders.client_id
  ORDER BY clients.created_at desc
  ")
Which returns Client objects. Insert your own vastly more complex query above.
Post reply on HN