{"id":19435996,"url":"https://github.com/ralscha/realworld-go","last_synced_at":"2025-04-24T21:30:49.859Z","repository":{"id":143731544,"uuid":"568066217","full_name":"ralscha/realworld-go","owner":"ralscha","description":"realworld backend implementation with Go","archived":false,"fork":false,"pushed_at":"2025-04-23T18:00:38.000Z","size":7318,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-23T19:20:06.181Z","etag":null,"topics":["chi","go","golang","goose","realworld","realworld-backend","sqlboiler"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ralscha.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-11-19T10:48:50.000Z","updated_at":"2025-04-23T18:00:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"2ceb499a-81ca-40c1-b2be-516563b1d93c","html_url":"https://github.com/ralscha/realworld-go","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralscha%2Frealworld-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralscha%2Frealworld-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralscha%2Frealworld-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ralscha%2Frealworld-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ralscha","download_url":"https://codeload.github.com/ralscha/realworld-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250712883,"owners_count":21475093,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chi","go","golang","goose","realworld","realworld-backend","sqlboiler"],"created_at":"2024-11-10T15:08:54.556Z","updated_at":"2025-04-24T21:30:49.580Z","avatar_url":"https://github.com/ralscha.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![RealWorld Example App with Go, Chi and SQLBoiler](logo.png)\n\n\u003e ### realworld-go codebase containing a real-world example (CRUD, auth, advanced patterns, etc.) that adheres to the [RealWorld](https://github.com/gothinkster/realworld) spec and API.\n\n\n### [Demo](https://demo.realworld.io/)\u0026nbsp;\u0026nbsp;\u0026nbsp;\u0026nbsp;[RealWorld](https://github.com/gothinkster/realworld)\n\n\nThis codebase was created to demonstrate a fully-fledged backend application built with **Go, Chi, and SQLBoiler**, including CRUD operations, authentication, routing, pagination, and more.\n\nWe've gone to great lengths to adhere to the **Go** community style guides \u0026 best practices.\n\nFor more information on how this works with other frontends/backends, head over to the [RealWorld](https://github.com/gothinkster/realworld) repo.\n\n\n# Develop\n\n### Task: build tool\n\nThis project uses [Task](https://taskfile.dev/) as task runner and build tool. Checkout the installation instruction here:    \nhttps://taskfile.dev/installation/  \n\n\n### Goose: database migration\n\n[goose](https://pressly.github.io/goose/) is used as database migration tool. The migration SQL scripts are in the [`migrations`](https://github.com/ralscha/realworld-go/tree/main/migrations) folder. The source code of the migration tool is located here: [`cmd/migrate/main.go`](https://github.com/ralscha/realworld-go/blob/main/cmd/migrate/main.go)\n\nTo build the migration tool, run `task build-goose`. The migration reads the database connection configuration from the [`app.env`](https://github.com/ralscha/realworld-go/blob/main/app.env) file.\n\nMigration related tasks:\n| Task   | Description  |\n|---|---|\n| `db-migration-new-go`  | Creates an empty Go migration file |\n| `db-migration-new`  | Creates an empty SQL migration file |\n| `db-migration-reset`  | Reverts all migrations. Results in an empty database |\n| `db-migration-status`  | Shows the current applied migration version |\n| `db-migration-up`  | Runs all migrations if not already applied |\n\n\n### SQLBoiler: database access\n\nThe project utilizes [SQLBoiler](https://github.com/volatiletech/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`](https://github.com/ralscha/realworld-go/tree/main/internal/models). Database connection parameters are configured in the file [`sqlboiler/sqlboiler.toml`](https://github.com/ralscha/realworld-go/blob/main/sqlboiler/sqlboiler.toml). First apply the schema changes with goose and then run `task db-codegen` to generate the database code.\n\n\n# Getting started\n\n1. Install [Task](https://taskfile.dev/)\n2. Start PostgreSQL with `docker compose up -d`\n3. Apply database migration `task db-migration-up` \n4. Start API with `task run`\n5. Run the realworld [Postman collection](https://realworld-docs.netlify.app/docs/specs/backend-specs/postman)\n```\n cd postman   \n npm install   \n npm start\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fralscha%2Frealworld-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fralscha%2Frealworld-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fralscha%2Frealworld-go/lists"}