High quality web application examples

I’d like to solicit opinions from the community.

Can anyone recommend (and link to) some non-trivial, open-source web applications or web API examples written in Go? I’m looking for examples that talk to external services or databases.

What do I mean by non-trivial? Most frameworks and libraries provide short examples, but many do not show anything beyond one or two files.

Open source examples are hard to find, so if you have a project that you are willing to share (without any secrets in your repo), please share them here.

As an aside, this talk by Kathy Sierra is an inspiration for this question: https://www.youtube.com/watch?v=FKTxC9pl-WM The thesis is that we learn by “pattern recognition”, so repeated exposure to non-trivial real-world examples is a must.

6 Likes

I’d suggest the Caddy project by @matt:

http://caddyserver.com/

Definitely not a trivial Go HTTP server implementation :smile:

Second: http://getqor.com/ - E-Commerce and CMS in Go
Third: http://traefik.github.io/ - Reverse proxy in Go

2 Likes

Drone.io (https://drone.io/) - a CI service - has their entire web application on GitHub: https://github.com/drone/drone/tree/master/server

It’s a good example of a top to bottom web application in Go with tests, a separate DB interface, templating, etc.

5 Likes

Hmm… Gogs ( https://github.com/gogits/gogs )

3 Likes

Maybe https://github.com/mattermost/platform a slack alternative written in go.

2 Likes

Here’s a work in progress project I am working on, it is not extensively documented, but probably you can get the hang of it from the code - https://github.com/go-neutrino/neutrino. Feel free to ask if you have questions.

1 Like

I’ve been working on a simple news site (HN-like) posted earlier today:

I’m not sure I’d call it high quality :slight_smile: but it has all the bits you’d expect in a web app like users, auth, views, models etc. and a command line tool to help with code generation, migrations, deployment etc. which might be familiar if you’ve used rails before for building sites. Also, a second for mattermost, which is a complete and polished app.

If learning, you might find it useful to pick one of the apps suggested above and try contributing to it, or have a look at some of the web app frameworks which are available - gorilla, revel, gin, etc. Those typically come with example apps as well and docs explaining their approach. Even if you don’t go all-in on a framework (you can certainly do a lot with the std lib) it can be useful to see how they have tackled certain problems like CSRF, form helpers, or sanitisation.

Thank you all for the help. I have not read through them all, but I will. The drone project’s main method is a good example of what I was looking for:

https://github.com/drone/drone/blob/master/server/main.go

It does the following

  • Loads configurations from a custom config package
  • Parses flags
  • Serves static assets with standard net/http
  • Serves an api using mux router
  • Uses http context libraries
  • Uses middlewares
2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.