If you don't want to piece things together yourself (and want a more Rails-like experience), Buffalo[8] is probably your best bet.
[1] https://echo.labstack.com/
[2] https://github.com/valyala/quicktemplate
[3] https://github.com/flosch/pongo2
[4] https://github.com/CloudyKit/jet
[5] https://github.com/jmoiron/sqlx
[6] https://github.com/jinzhu/gorm
And I also use "bindata" to compile all my static files into the final binary [10].
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, enforce authentication, &c, passing things like "current user" and "current session" down to standard net/http Handlers through Context.
- 10-or-so JSON utility functions I take with me from project to project.
- React, via create-react-app, so I all my templating is done in JSX.
- net/http/httptest for testing.
(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.)
At Globality[1], we use microcosm [2], an internally built framework for crafting applications. We have 45+ microservices, all built on top of it, and it's a joy.
I was looking for a framework that will give me similar benefits with Golang. Something that I can take out of the box with some convention-over-configuration.
I found micro [3] and gizmo [4]. (There are more)
It seems to me that a full-blown web app doesn't come very natural to Golang yet. There isn't a framework that will give you what you are used for from other languages/frameworks.
I have a lot of experience with Golang and built many tools, and it always felt more natural to me when there is no database/models involved.
[1] https://www.globality.com/en-us/
[2] https://github.com/globality-corp/?utf8=%E2%9C%93&q=microcos...
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 of other folks have mentioned Buffalo. It's a great ecosystem for building applications quickly, but I would strongly urge you to go through gluing the packages together yourself first to really understand what is going on underneath the magic.
Am also looking forward to trying the new GoLand IDE from the JetBrains team. Currently using Atom but would be interested in dedicated integrations with gcloud sdk.
Web: https://github.com/blendlabs/go-web
DB: https://github.com/blendlabs/spiffy
Migrations: https://github.com/blendlabs/spiffy/migration
* 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 overarching frameworks. Smaller libraries work better for me.
Big framework comes at big cost when trying to upgrade to a new version because it’s surface area is big.
Gorilla will probably make your life easier. I rely on the mux package quite a bit for routing purposes.
I also use Google's jsonapi package to maintain a semblance of orderliness when it comes to request and response data, but I wouldn't be hurting too much without it.
DB: - dynamodb/psql depending on features. aws-sdk or base go sql package. - redis for caching. go-redis package.
Stats/logging: - statsd/graphite/grafana - sirupsen/logrus for logging
I usually write a wrapper for packages that will automatically report stats + logging.
I've found myself enjoying rolling/being more explicit about what it is that I need, so I now build out small web APIs just using a combination of Gorilla Mux + net/http.
In other words, what is Go's main selling point in competing with Node in terms of its http server, TCP sockets, etc...
Can Go's awesome concurrency patterns be used to optimize server requests? Can it be well utilized as a proxy?
Android uses grpc-java iOS uses grpc-objc Browser uses gRPC-Gateway and the JSON equivalent of the protobuf3 spec.
database: sqlx, upper, sqlboiler
log: zap, zerolog
dependency management: dep
config: viper
cli: cobra
lint: gometalinter
Trying https://github.com/improbable-eng/grpc-web and http://rest-layer.io
At my day job I use the standard library.
Here is what the inside of the <script> 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