from Hacker News

Show HN: Copper – A Go framework for your projects

by tusharsoni on 7/2/22, 1:30 PM with 80 comments

Hey HN! I've been working with Go for the last 5+ years at large-ish companies building products that many of you may use regularly.

A ton of people say that Go's standard library is really powerful and usually enough to get by without external dependencies. I think that's true for companies that have the resources to build and maintain packages to reduce code duplication. For everyone else, we're left to finding the right set of packages to build our projects. So, I built Copper - a toolkit that helps you get your project off the ground with minimal dependencies. It covers everything from routing, html, storage to tooling and more.

Check it out, star it, and feel free to ask questions!

P.S. I also have a video demo building an HN clone in the docs

[1] https://gocopper.dev/

  • by matthewmueller on 7/2/22, 4:53 PM

    Author of https://github.com/livebud/bud here, congrats on the launch Tushar! Looking forward to building up the Go web framework ecosystem with you!
  • by theplumber on 7/2/22, 2:53 PM

    Am I do only one who hates frameworks that need a cli to get started?
  • by mstef9 on 7/2/22, 2:51 PM

    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

  • by telesoft on 7/2/22, 2:52 PM

    Cool project. I'm currently building something similar to hacker news using only the standard library. How could this project help me?

    The way I use the standard library is like a super condensed version of React. Templates are my components. Since templates can be nested, templates can be used to build "components" and those components can be stored in separate files and compiled together at run time with a "model" being fed to the template(s) via a state object passed by the application.

    So I may have a few dozen template files in a folder called /components, and another folder called /pages with a few templates that use these components. When a user visits a "page", the template file is "compiled" with the appropriate components.

    A page might look like this:

      <html>
        {{template "nav"}}
        {{template "thread" .Thread}}
        {{template "footer"}}
      </html>
    
    And "nav", "thread", and "footer" are all components defined in another file. This allows for re-use across multiple pages.

    I want to do a write-up on it but I'm not sure if it's a novel idea.

  • by jjtheblunt on 7/2/22, 2:00 PM

    Doesn't the Go standard library do what you mentioned above?
  • by icod1 on 7/4/22, 12:37 PM

    Reading through the comments, most of you are either new to Go or new to web dev in general. Only that would explain how this SHITSHOW of a "framework" would get any praise at all.

    What he copy/pasted already exists, only better.

    The HN audience doesn't seem very sophisticaed. Hell even reddit's /r/golang is better informed than HN in this regard. Just read through all the issues people have with gorm and if you've ever did any real Go development you would not pick gorm as the default database package in the first place.

    Amateurs all of you, I'm seriously sick of your unprofessional lack of knowledge and experience.

    HackerNews my ass, more like NoobNews. GTFO

  • by thiht on 7/3/22, 7:46 AM

    Too bad it uses Wire. There’s absolutely no need for dependency injection frameworks in Go, you can just inject directly to receiver functions. It does the same thing without the crappy indirection added by this kind of frameworks.
  • by bestinterest on 7/2/22, 3:15 PM

    So many frameworks in other languages are trying to get to the productivity of Rails but they just don't have the same spark imo.

    There is no Rails equivalent in JS, theres lots of competitors that feel years away like SailsJS, the new Deno Fresh one etc, Adonisjs... Is NextJS/SvelteKit/RemixRun considered also? I don't even know if they have a standardised background job processor in JS land.

    Java's solutions are dreadful imo for if you want to compare to Rails. Quarkus/SpringBoot/Micronaut are nowhere near productivity levels for a fullstack app. They lean heavily on the API only side of things. (I do like Java oddly enough)

    PHP is the main competitor to Rails oddly enough, Laravel seems brilliant.

    Go is just starting up in this space it looks like, Bud is another attempt at Rails in another language https://github.com/livebud/bud. However the Go ecosystem is heavily API only side of things instead of SSR. Go's templating libs suck imo.

    Elixir of course has Phoneix which is apparently great, purely functional langs unfortunately dont fit my head and feel to abstract for myself (don't hate me)

    Its no wonder we have the backend / frontend developer split nowadays.

  • by andreygrehov on 7/2/22, 6:30 PM

    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?

  • by ge96 on 7/2/22, 2:06 PM

    I saw on the "who's hiring" for July Go is at the same level of demand as Node pretty cool

    Gotta put Go on my list of things to learn

  • by pram on 7/2/22, 3:28 PM

    Haha, moscow mule? I appreciate the alcohol name theme to go with all the other Go web frameworks. ;P
  • by zinodaur on 7/2/22, 2:59 PM

    Copper looks really cool - bringing the rapid dev of Rails to golang. Very tight demo btw
  • by synergy20 on 7/2/22, 3:53 PM

    So go is trying to be a server-side-render framework here, what about the SPA style in that go is a simple json-api server, and let SPA to do all the template and render, is gin the best framework for that? new to golang here.
  • by born-jre on 7/2/22, 2:59 PM

    this looks fine but not a fan of gorm.

    but it could be decent choice if u want to build integrated framework i can understand why people would choose it, another option is code_generation_meta_hell with sqlboiler. upper db [0] would have been perfect fit for this kind of project but is not that famous, its development is slow but stable.

    ps: i like sqlboiler what i am saying is if u are building framework top on it then not that fun

    [0]: https://github.com/upper/db

    edit: include link

  • by al_mandi on 7/3/22, 11:45 PM

    How would you compare what you wrote with what Uber built (gofx, glue, etc?)
  • by irq-1 on 7/2/22, 7:50 PM

    wire.go should have been named patina.go