{"id":15295879,"url":"https://github.com/johncoleman83/cerebrum","last_synced_at":"2025-05-07T05:20:51.146Z","repository":{"id":54523185,"uuid":"162792141","full_name":"johncoleman83/cerebrum","owner":"johncoleman83","description":"🧠 go server with user model \u0026 roles","archived":false,"fork":false,"pushed_at":"2021-02-13T03:08:32.000Z","size":11607,"stargazers_count":4,"open_issues_count":7,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-31T06:41:22.501Z","etag":null,"topics":["docker","golang","gorm","hacktoberfest","jwt","mysql","mysql-database","react","swagger"],"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/johncoleman83.png","metadata":{"files":{"readme":"README.MD","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-22T07:45:25.000Z","updated_at":"2023-02-16T07:06:37.000Z","dependencies_parsed_at":"2022-08-13T18:31:26.468Z","dependency_job_id":null,"html_url":"https://github.com/johncoleman83/cerebrum","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/johncoleman83%2Fcerebrum","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johncoleman83%2Fcerebrum/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johncoleman83%2Fcerebrum/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johncoleman83%2Fcerebrum/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johncoleman83","download_url":"https://codeload.github.com/johncoleman83/cerebrum/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252818785,"owners_count":21808912,"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":["docker","golang","gorm","hacktoberfest","jwt","mysql","mysql-database","react","swagger"],"created_at":"2024-09-30T18:08:29.252Z","updated_at":"2025-05-07T05:20:51.124Z","avatar_url":"https://github.com/johncoleman83.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cerebrum\n\n[![CircleCI](https://circleci.com/gh/circleci/circleci-docs.svg?style=svg)](https://circleci.com/gh/johncoleman83/cerebrum)\n[![codecov](https://codecov.io/gh/johncoleman83/cerebrum/branch/main/graph/badge.svg?token=oIta2VhQc8)](https://codecov.io/gh/johncoleman83/cerebrum)\n[![Go Report Card](https://goreportcard.com/badge/github.com/johncoleman83/cerebrum)](https://goreportcard.com/report/github.com/johncoleman83/cerebrum)\n[![Maintainability](https://api.codeclimate.com/v1/badges/a99a88d28ad37a79dbf6/maintainability)](https://codeclimate.com/github/codeclimate/codeclimate/maintainability)\n\n### Original design from [GORSK - GO(lang) Restful Starter Kit](https://www.ribice.ba/refactoring-gorsk/)\n\nGorsk is a Golang starter kit for developing RESTful services. It is designed to help you kickstart your project, skipping the 'setting-up part' and jumping straight to writing business logic.\n\n#### Updates from GORSK:\n\n* use `gorm` as the ORM\n  * `gorm` doesn't have the limitations indicated by the author of gorsk\n  * `gorm` allows for use of various different DB's\n  * in this case we use **MySQL**\n* get rid of go-swagger\n  * it's too complicated to find Open API docs all throughout the codebase comments\n  * built a new design to organize and compile all Open API doc in `third_party/swaggerui/spec`\n* Updated the swagger distribution and spec file that were out of date.\n* new naming conventions / refactoring\n  * **Account** and **Team** models created and therefore removed **Company** and **Location**\n  * Other packages and directories have been renamed to help ease the understanding of what they are used for\n  * other minor refactoring and renaming of directories such as moving the swagger distribution from `/assets` to `/third_party/swaggerui/dist`\n* Use CirclCI instead of Travis\n* There's no reason to start 10 new docker containers for every test DB test.\n  * Just use 1 test container and be sure to refresh the DB for every test.\n* Removed unused dependencies\n* Added React Redux frontend [website](website)\n\n\n## Dependencies\n\n| PACKAGE                               | LICENSE |\n|---------------------------------------|---------|\n| **Golang**                            |         |\n| github.com/labstack/echo              |   MIT   |\n| github.com/jinzhu/gorm                |   MIT   |\n| github.com/dgrijalva/jwt-go           |   MIT   |\n| github.com/rs/zerolog                 |   MIT   |\n| github.com/go-playground/validator    |   MIT   |\n| github.com/nbutton23/zxcvbn-go        |   MIT   |\n| github.com/stretchr/testify           |   MIT   |\n| github.com/go-yaml/yaml               |  Apache |\n| **node.js**                           |         |\n| npmjs.com/package/multi-file-swagger  |   MIT   |\n\n## Project Structure\n\n* Started with the [project structure](https://github.com/ribice/gorsk#project-structure) from gorsk\n\n* trying to maintain [golang-standards](https://github.com/golang-standards/project-layout) for project layout\n\n\n## Development\n\nensure that you have properly setup dependencies\n\n```\n$ make deps\n```\n\nuse make to help with development\n\n* just run make help to see all the automated support with `make`\n  ```\n  $ make help\n  ```\n\n* run `make setup` then after that, `make serve` to use [swagger](https://github.com/johncoleman83/cerebrum#swagger) to test endpoints.\n\n* or use `curl` to login with bootstrap data\n  ```\n  $ curl -X POST \"http://localhost:8080/login\" \\\n      -H \"accept: application/json\" \\\n      -H \"Content-Type: application/json\" \\\n      -d \"{ \\\"password\\\": \\\"admin\\\", \\\"username\\\": \\\"admin\\\"}\"\n  ```\n\n## Swagger\n\nVisit `http://localhost:8080/swaggerui/` (with trailing slash) in your browser to test out some endpoints!\n\n* use `make TYPE=yaml swagger` or [multi-file-swagger](https://www.npmjs.com/package/multi-file-swagger) to generate the swagger `.yaml` spec file.\n* more docs on creating a swagger server: https://goswagger.io/use/spec.html#parsing-rules\n* this application uses the latest distribution from [github.com/swagger-api/swagger-ui](https://github.com/swagger-api/swagger-ui/tree/master/dist)\n  * this repo uses swagger docs file `full_spec.yaml` as an update from the\n    upstream branch\n\n## Endpoints\n\nThe application runs as an HTTP server at port 8080. It provides the following RESTful endpoints:\n\n* `POST /login`: accepts username/passwords and returns jwt token and refresh token\n* `GET /refresh/:token`: refreshes sessions and returns jwt token\n* `GET /me`: returns info about currently logged in user\n* `GET /swaggerui/` (with trailing slash): launches swaggerui in browser\n* `GET /v1/users`: returns list of users\n* `GET /v1/users/:id`: returns single user\n* `POST /v1/users`: creates a new user\n* `PATCH /v1/password/:id`: changes password for a user\n* `DELETE /v1/users/:id`: deletes a user\n\n* You can log in as admin to the application by sending a post request to localhost:8080/login with username `admin` and password `admin` in JSON body.\n\n* When sending the Authorization header use this format: `Authorization: Bearer TOKEN_HASH`\n\n## License\n\nCurrently licensed under MIT, check the [LICENSE](LICENSE.md) file for details.\n\n## Author\n\n[David John Coleman II](https://davidjohncoleman.com)\n**[Initial Commit by GORSK](https://www.ribice.ba/refactoring-gorsk/)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohncoleman83%2Fcerebrum","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohncoleman83%2Fcerebrum","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohncoleman83%2Fcerebrum/lists"}