{"id":18989398,"url":"https://github.com/source-academy/stories-backend","last_synced_at":"2025-08-03T19:36:07.164Z","repository":{"id":176815105,"uuid":"658563551","full_name":"source-academy/stories-backend","owner":"source-academy","description":"Backend of Source Academy extension for Stories support.","archived":false,"fork":false,"pushed_at":"2024-12-11T23:49:18.000Z","size":239,"stargazers_count":0,"open_issues_count":22,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-01-01T14:09:06.745Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/source-academy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"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}},"created_at":"2023-06-26T03:58:36.000Z","updated_at":"2024-05-12T09:55:41.000Z","dependencies_parsed_at":"2024-04-12T03:47:55.377Z","dependency_job_id":null,"html_url":"https://github.com/source-academy/stories-backend","commit_stats":null,"previous_names":["source-academy/stories-backend"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/source-academy%2Fstories-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/source-academy%2Fstories-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/source-academy%2Fstories-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/source-academy%2Fstories-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/source-academy","download_url":"https://codeload.github.com/source-academy/stories-backend/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240002130,"owners_count":19732164,"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":[],"created_at":"2024-11-08T17:06:28.579Z","updated_at":"2025-02-21T10:43:48.029Z","avatar_url":"https://github.com/source-academy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Backend for Source Academy Stories\n\n[![Coverage Status](https://coveralls.io/repos/github/source-academy/stories-backend/badge.svg?branch=main)](https://coveralls.io/github/source-academy/stories-backend?branch=main)\n\n## Setup\n\n### Installing languages and tools required\n\nInstall Golang and PostgresSQL. We recommend using a version manager like [asdf](https://asdf-vm.com/) to manage your installations. Use the versions of the tools listed in the `.tool-versions` file.\n\n* (For `asdf` only) if not already installed, install the necessary plugins:\n\n  ```bash\n  asdf plugin add golang\n  asdf plugin add postgres\n  ```\n\n* Install the required versions of the tools:\n\n  ```bash\n  asdf install golang 1.21.5\n  asdf install postgres 14.8\n  ```\n\nTo work with and debug the API, we also strongly recommend installing tools like [Postman](https://www.postman.com/downloads/).\n\n### Setting up git hooks\n\nWe use pre-commit and pre-push hooks to ensure that code is formatted and linted before committing and pushing. To set up the hooks, run the following commands:\n\n```bash\nmake hooks\n```\n\n**Notes:**\n\n* Hooks only work on macOS/Linux. Support for Windows is coming soon.\n* You will need to install golangci-lint locally for git hooks to work. See [Running linter](#running-linter) for instructions.\n\n### Setting up the database\n\n#### Creating the database\n\nRun the following command to create the database:\n\n```bash\nmake db_create\n```\n\n#### Migrating the database\n\nFor this step onwards, make sure you have your environment variables set up correctly. See [Setting up environment variables](#setting-up-environment-variables) for more details.\n\nRun the migration target to migrate the database:\n\n```bash\nmake db_migrate\n```\n\nBy default, the migration target will run all pending migrations (visible using `make db_status` command). To only run a certain number of migrations forward, use the `steps` argument:\n\n```bash\nmake db_migrate steps=1\n```\n\n#### Rolling back migrations\n\nTo roll back the most recent migration, run the following command:\n\n```bash\nmake db_rollback\n```\n\nTo roll back a certain number of migrations, use the `steps` argument:\n\n```bash\nmake db_rollback steps=1\n```\n\n### Setting up environment variables\n\nCopy `.env.example` to `.env` and fill in/modify the required values as needed.\n\n## Development\n\n### Starting the server\n\n```bash\nmake dev\n```\n\n### Running linter\n\nStep 1: Install [golangci-lint](https://golangci-lint.run/usage/install/#local-installation) locally.\n\nStep 2: Run the lint commmand:\n\n```bash\nmake lint\n```\n\n### Testing your code\n\nBy convention, test files are named `*_test.go` and are placed in the same directory as the code they are testing.\n\nTo run all tests:\n\n```bash\nmake test\n```\n\nTo run all tests and view test coverage:\n\n```bash\nmake coverage\n```\n\n## Building for production\n\n```bash\nmake build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsource-academy%2Fstories-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsource-academy%2Fstories-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsource-academy%2Fstories-backend/lists"}