{"id":13714199,"url":"https://github.com/tompston/go-rest-api-example","last_synced_at":"2025-04-15T02:37:21.714Z","repository":{"id":133895309,"uuid":"590212843","full_name":"tompston/go-rest-api-example","owner":"tompston","description":"Full-stack example, using JWT, SQLC, Cursor Pagination, Vue 3 and Tailwind","archived":false,"fork":false,"pushed_at":"2023-01-19T20:10:37.000Z","size":166,"stargazers_count":21,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T14:22:12.734Z","etag":null,"topics":["cursor-pagination","go","jwt-authentication","postgresql","rest-api","sqlc","tailwind","typescript","vue"],"latest_commit_sha":null,"homepage":"","language":"PLpgSQL","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/tompston.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-01-17T22:25:13.000Z","updated_at":"2025-03-19T20:36:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"31416f11-4684-4cda-a0ee-f419e3280ed6","html_url":"https://github.com/tompston/go-rest-api-example","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/tompston%2Fgo-rest-api-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tompston%2Fgo-rest-api-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tompston%2Fgo-rest-api-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tompston%2Fgo-rest-api-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tompston","download_url":"https://codeload.github.com/tompston/go-rest-api-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248995101,"owners_count":21195497,"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":["cursor-pagination","go","jwt-authentication","postgresql","rest-api","sqlc","tailwind","typescript","vue"],"created_at":"2024-08-02T23:01:54.577Z","updated_at":"2025-04-15T02:37:21.691Z","avatar_url":"https://github.com/tompston.png","language":"PLpgSQL","readme":"## Full-Stack app for creating transactions\n\nhttps://user-images.githubusercontent.com/82293948/213549059-0cdc7ddc-fabe-4d7f-92c3-1844c08ccbb5.mp4\n\n- Backend\n  - Golang, Chi Framework \n  - JWT for authentication\n  - Rate limiting for registration endpoint\n  - Payload validation using validate package\n  - Cursor Pagination for Users and Transactions endpoints (using `uuids` and `created_at` values)\n  - SQLC for getting the data, dbmate for managing migrations.\n  - If you want to preview the backend endpoints, just copy `gomarvin.json` content in the [editor](https://gomarvin.pages.dev/) (Settings -\u003e Import Tab)\n- Frontend\n  - Vue 3 + Vite + Tailwind.\n  - Registration and Login views\n    - Field validation errors are returned from the database\n    - Custom Login error messages if the user does not exist or the password is incorrect\n  - Home view is guarded by authentication check. If the user has an invalid token, that route is not accessible.\n- Other\n  - Deno and Faker used for seeding the database (using the generated gomarvin client\n  - Backend code baseline and frontend fetch functions generated with gomarvin.\n\n### DISCLAIMER\n\nA lot of parts are rough around the edges and can be improved to avoid code duplication.\n\n- JWT Auth flow in the frontend is lacking\n  - `access_token` expiration is 15mins, no flow for re-authentication\n- DB tables can be improved\n- There are endpoints which don't execute any queries.\n- Frontend is as minimal as possible\n  - No loading states while fetching the data\n\n### Setup\n\n- Use the db dump to create the db schemas and rows.\n- Edit `/backend/.env` if needed\n\n```bash\n# run backend\ncd backend\ngo mod tidy\ngo mod download\ngo run main.go\n\n# run frontend\ncd frontend\nnpm i\nnpm run dev\n```\n\n#### Other\n\n```bash\n# seeder (using deno with faker)\ndeno run --allow-net ./seeder.ts\n\n# dump database info for test_db\nsudo pg_dump -U postgres test_db \u003e ./dump.sql\n```\n","funding_links":[],"categories":["Repositories"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftompston%2Fgo-rest-api-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftompston%2Fgo-rest-api-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftompston%2Fgo-rest-api-example/lists"}