Live data from Hacker News

Ask HN: What is your Golang web-dev tech stack?

news.ycombinator.com

31–40 of 47 posts

Re: Ask HN: What is your Golang web-dev tech stack?

#32
I've been using a starter kit[1] to build our API.For database access using Modl[2] similar to gorp but uses sqlx internally. Much of the data access code is generated as I'm of opinion reflection based ORM doesn't lend itself well in Go.

[1]https://github.com/qiangxue/golang-restful-starter-kit

[2]https://github.com/jmoiron/modl

Re: Ask HN: What is your Golang web-dev tech stack?

#36
post #22

* Standard library for a lot of things. * https://github.com/go-chi/chi is pretty good. I have a need for a lot of custom middlewares, so I need something more fleshed out than net/http. * All config files are written in TOML: https://github.com/BurntSushi/toml * https://github.com/gocql/gocql for all Cassandra needs. * Development work is done in Docker so everyone has a consistent env. That's all, I tend to dislike…

Just took a look at Chi's RESTful API example, I like it. I also like the benchmarks. Judging by most of the comments on this thread, it looks like the community favors modular small tools over big fat frameworks, is that true?

Re: Ask HN: What is your Golang web-dev tech stack?

#37
post #12

Even though I know they're well-designed, I find Go's web templates hard to work in. So I avoid them. My stack is basically: - Postgres, using pq and sqlx - A codegen ORM I wrote that scrapes schemas and generates CRUD and lookup functions for all my database types. I don't think dynamic ORMs like gorm are the way to go for Go. - A session library I wrote a year ago, and simple Go wrapper handlers to require sessions…

Any chance you have that ORM of yours open-sourced somewhere?

Re: Ask HN: What is your Golang web-dev tech stack?

#38

Gophers tend to roll their own and forego larger frameworks. Piecing together libraries can absolutely be daunting, but once you get a starter app built your productivity will go way, way up. I'd really recommend this (paid) course at https://www.usegolang.com It walks you through pulling in different libraries (Gorilla Mux, GORM, etc), gluing them together, and structuring your code in a maintainable way. A couple o…

Solid advice. I will take a look at the course, looks interesting. Thanks for sharing.

Re: Ask HN: What is your Golang web-dev tech stack?

#39
post #35

I use Buffalo for an API and Vue.js with TypeScript as a frontend.

Cool. How do you serve your frontend app? Do you do it via Buffalo or nodejs?

Currently? I run them on separate ports and use axios[0] to make requests against Buffalo routes. I had to use the github.com/rs/cors[1] package with Buffalo for CORS so that Vue doesn't yell at me. So I run `buffalo dev` in one tmux pane and `yarn dev` in another.

Here is what the inside of the portion of a component may look like: https://gist.github.com/howdoicomputer/cdadba6e47021ba90b7f7...

And here is the code for adding cors to Buffalo: https://gist.github.com/howdoicomputer/17366df6cd7b8208a22a8... I got that from a PR for pre-app handlers. [2]

Eventually, I'll hook everything up to Nginx for deployment.

[0] https://github.com/axios/axios [1] https://github.com/rs/cors [2] https://github.com/gobuffalo/buffalo/issues/609

Re: Ask HN: What is your Golang web-dev tech stack?

#40
post #37
post #12

Even though I know they're well-designed, I find Go's web templates hard to work in. So I avoid them. My stack is basically: - Postgres, using pq and sqlx - A codegen ORM I wrote that scrapes schemas and generates CRUD and lookup functions for all my database types. I don't think dynamic ORMs like gorm are the way to go for Go. - A session library I wrote a year ago, and simple Go wrapper handlers to require sessions…

Any chance you have that ORM of yours open-sourced somewhere?

No, but (1) sqlboiler is a much better ORM, and (2) it is surprisingly easy to build these things yourself; mine's just a bunch of text/template templates and ~100 lines of Go code to scrape a Postgres schema.

(I mean: this code will be open sourced pretty soon, since it's part of a bigger open source thingy I'm releasing, but the ORM isn't very good, just as good as I needed it to be; nobody should ever use it for another project.)

Post reply on HN