HandmadeNetwork / hmn

The handmade website for https://handmade.network/
7 stars 2 forks source link

Handmade Network

This is the codebase for the Handmade Network website, located online at https://handmade.network. The website is the home for all Handmade projects, the forums, the podcast, and other various initiatives.

The site is written in Go, and uses the standard library HTTP server with custom utilities for routing and middleware. It uses Postgres for its database, making heavy use of the excellent pgx library along with some custom wrappers. See the documentation in the db package for more details.

We want the website to be a great example of Handmade software on the web. We encourage you to read through the source, run it yourself, and learn from how we work. If you have questions about the code, or you're interested in contributing directly, reach out to us in #network-meta on the Handmade Network Discord!

Prerequisites

You will need the following software installed:

First-time setup

Running the site

Running the site is easy:

go run .

You should now be able to visit http://handmade.local:9001 to see the website!

There are also several other commands built into the website executable. You can see documentation for each of them by running go run . help or adding the -h flag to any command.

Running tests

Also easy:

go test ./...

Note that we have a special coverage requirement for the hmnurl package. We use the tests in this package to ensure that our URL builder functions never go out of sync with the regexes used for routing. As a result, we mandate 100% coverage for all Build functions in hmnurl.

Starter data

The db seed command pre-populates the site with realistic data. It also includes several user accounts that you may log into to test various situations:

Username Password
admin password
alice password
bob password
charlie password

The admin user is a superuser on the site and will have access to all features, as well as the special admin UI for performing site maintenance and moderation. The other users are all normal users.