realworld backend implementation with Go
  • Go 99.7%
  • Dockerfile 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ralph Schaer 0ba51c8d11 upgrade
2026-09-12 13:48:21 +02:00
cmd Fix lint issues 2026-09-03 18:48:30 +02:00
internal Refactor user authentication and response handling 2026-09-03 18:23:05 +02:00
migrations Refactor user authentication and response handling 2026-09-03 18:23:05 +02:00
postman Refactor user authentication and response handling 2026-09-03 18:23:05 +02:00
sqlboiler Upgrade 2025-07-10 06:27:29 +02:00
.gitignore Migrate to postgres 2022-11-24 11:25:30 +01:00
.golangci.yml upgrade 2026-05-31 15:52:53 +02:00
app.env Migrate to postgres 2022-11-24 11:25:30 +01:00
CODE_OF_CONDUCT.md Initial commit 2022-11-19 13:27:49 +01:00
docker-compose.yml Upgrade 2025-07-10 06:27:29 +02:00
favicon.ico Initial commit 2022-11-19 13:27:49 +01:00
go.mod upgrade 2026-09-12 13:48:21 +02:00
go.sum upgrade 2026-09-12 13:48:21 +02:00
LICENSE Initial commit 2022-11-19 13:27:49 +01:00
logo.png Initial commit 2022-11-19 13:27:49 +01:00
README.md Upgrade 2025-07-10 06:27:29 +02:00
Taskfile.yml upgrade 2026-09-04 16:01:18 +02:00

RealWorld Example App with Go, Chi and SQLBoiler

realworld-go codebase containing a real-world example (CRUD, auth, advanced patterns, etc.) that adheres to the RealWorld spec and API.

Demo    RealWorld

This codebase was created to demonstrate a fully-fledged backend application built with Go, Chi, and SQLBoiler, including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the Go community style guides & best practices.

For more information on how this works with other frontends/backends, head over to the RealWorld repo.

Develop

Task: build tool

This project uses Task as task runner and build tool. Checkout the installation instruction here:
https://taskfile.dev/installation/

Goose: database migration

goose is used as database migration tool. The migration SQL scripts are in the migrations folder. The source code of the migration tool is located here: cmd/migrate/main.go

To build the migration tool, run task build-goose. The migration reads the database connection configuration from the app.env file.

Migration related tasks:

Task Description
db-migration-new-go Creates an empty Go migration file
db-migration-new Creates an empty SQL migration file
db-migration-reset Reverts all migrations. Results in an empty database
db-migration-status Shows the current applied migration version
db-migration-up Runs all migrations if not already applied

SQLBoiler: database access

The project utilizes SQLBoiler as the database access layer. SQLBoiler depends on generated code that needs to be re-generated each time the database schema changes. SQLBoiler reads the information from the database and creates files in the folder internal/models. Database connection parameters are configured in the file sqlboiler/sqlboiler.toml. First apply the schema changes with goose and then run task db-codegen to generate the database code.

Getting started

  1. Install Task
  2. Start PostgreSQL with docker compose up -d
  3. Apply database migration task db-migration-up
  4. Start API with task run
  5. Run the realworld Postman collection
 cd postman   
 npm install   
 npm start