{"id":17171488,"url":"https://github.com/roosta/advocado","last_synced_at":"2025-03-24T19:43:45.083Z","repository":{"id":86786703,"uuid":"304303952","full_name":"roosta/advocado","owner":"roosta","description":"Full-stack authentication system set up for a fictive web store called Advocado","archived":false,"fork":false,"pushed_at":"2020-10-15T11:29:34.000Z","size":77,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T00:25:54.110Z","etag":null,"topics":["clojure","clojurescript","example","full-stack"],"latest_commit_sha":null,"homepage":"","language":"Clojure","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/roosta.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-15T11:26:47.000Z","updated_at":"2022-01-06T12:39:49.000Z","dependencies_parsed_at":"2023-03-13T19:53:07.173Z","dependency_job_id":null,"html_url":"https://github.com/roosta/advocado","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/roosta%2Fadvocado","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roosta%2Fadvocado/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roosta%2Fadvocado/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roosta%2Fadvocado/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roosta","download_url":"https://codeload.github.com/roosta/advocado/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245343071,"owners_count":20599851,"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":["clojure","clojurescript","example","full-stack"],"created_at":"2024-10-14T23:34:36.080Z","updated_at":"2025-03-24T19:43:45.062Z","avatar_url":"https://github.com/roosta.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Advocado\n\nFull-stack authentication system set up for a fictive web store called\n'Advocado'. It is written in [Clojure][8], and [ClojureScript][9]. This\nsolution includes among other things:\n\n- Login system authentication system with hashed passwords stored in a PostgreSQL database\n- Token based authentication on frontend, stored in `localStorage` for persistence.\n- Sign up system, allowing new users to register an account.\n- Forgot password system allowing users to reset their password via an email.\n- Basic front-end UI using [Material UI](https://material-ui.com/)\n- Client side routing, and a backend API skeleton.\n- Front-end state management using [re-frame](https://github.com/Day8/re-frame)\n- Front-end and backend input validation using [clojure.spec](https://clojure.org/about/spec)\n\nThis solution was initially generated using [Luminus][4] version `3.67`\n\n## Prerequisites\n\n- You will need [Leiningen][1] 2.0 or above installed.\n- You'll need a [PostgreSQL][2] database\n- A [Mailgun][7] account for email dispatching\n\n### Environment variables\n\nThis app uses [cprop][5] to manage environment variables, to setup a\ndevelopment environment create an `dev-config.edn`:\n\n```edn\n{:dev true\n :port 3000\n ;; when :nrepl-port is set the application starts the nREPL server on load\n :nrepl-port 7000\n\n ; set your dev database connection URL here\n :database-url \"postgresql://localhost/YOUR_DB?user=YOUR-USER\"\n\n ;; Token signing\n :privkey \"auth_privkey.pem\"\n :pubkey \"auth_pubkey.pem\"\n :passphrase \"YOUR PASSPHRASE\"\n\n ;; mailgun\n :mailgun-api-key \"YOUR MAILGUN API KEY\"\n :mailgun-base-url \"https://api.mailgun.net/v3/YOUR_DOMAIN_NAME\"\n }\n```\n**Resources**:\n\n- [tolitius/cprop: likes properties, environments, configs, profiles..](https://github.com/tolitius/cprop)\n- [Environment Variables | Luminus - a Clojure web framework](https://luminusweb.com/docs/environment.html)\n\n### Database access\n\nOnce a PostgreSQL database is setup on your target system, and configured in\neither `dev-config.edn`, or what ever other method you prefer [[1][5],[2][6]],\nthe database can be migrated using this command:\n\n    lein run migrate\n\nThis will setup the needed tables and create a test user with the credentials:\n\n    user: ola\n    pass: admin\n\nYou probably want to change this later, the SQL migration query is located in\n`20200813140733-add-admin-user.up.sql`, and to hash a new password you can do this:\n\n    user=\u003e (hashers/derive \"PASSWORD\" {:alg :pbkdf2+sha256})\n\n**Resources:**\n\n- [Database Access | Luminus - a Clojure web framework](https://luminusweb.com/docs/database.html)\n- [Database Migrations | Luminus - a Clojure web framework](https://luminusweb.com/docs/migrations.html)\n- [PostgreSQL - ArchWiki](https://wiki.archlinux.org/index.php/PostgreSQL)\n\n### Certificates\n\nFor the token you need to generate some certificates. These should be located\nin the `./resources` directory, and can be called whatever you want, just make\nsure to update your `config.edn` with the filenames and passphrase.\n\n```sh\nopenssl genrsa -aes128 -out auth_privkey.pem 2048\n```\n```sh\nopenssl rsa -pubout -in auth_privkey.pem -out auth_pubkey.pem\n```\n\n### Emails\n\nThis app uses [Mailgun][7] to dispatch a \"reset password\" email, you'll need an\naccount there. Additionally this app uses an email template that is called\n`forgot-pass.html`, the content of this template is of little relevance except\nfor a link that contains this template variable:\n\n```html\n\u003ca href=\"{{url}}\"\u003eRESET YOUR PASSWORD\u003c/a\u003e\n```\n\nWhen dispatching an email this app attaches `X-Mailgun-Variables` to the\nrequest parameters, which is the tokenized url to reset a password. See\n`email.clj` in the `src` directory.\n\nAll this can of course be configured, refer to the mailgun documentation for more.\n\n- [User Manual — Mailgun API documentation](https://documentation.mailgun.com/en/latest/user_manual.html#templates)\n\n## Developing\n\nOnce everything is setup you can start a development environment like this:\n\n    lein repl\n    user=\u003e (start)\n    user=\u003e (start-fw)\n\nOpen \u003chttp://localhost:3000\u003e\n\nThis starts the app and starts [figwheel][12] that sets up hot reloading in front-end.\n\n## Running\n\nTo start a web server for the application, run:\n\n    lein run\n\n## Deployment\n\nSee [luminus deployment](https://luminusweb.com/docs/deployment.html) for various deployment options.\n\n## License\n\nCopyright © 2020 Daniel Berg\n\nDistributed under the [MIT License](http://opensource.org/licenses/MIT).\n\n[1]: https://github.com/technomancy/leiningen\n[2]: https://www.postgresql.org/\n[3]: https://wiki.archlinux.org/index.php/PostgreSQL\n[4]: https://luminusweb.com/\n[5]: https://github.com/tolitius/cprop\n[6]: https://luminusweb.com/docs/environment.html\n[7]: https://www.mailgun.com/\n[8]: https://clojure.org/\n[9]: https://clojurescript.org/\n[12]: https://github.com/bhauman/lein-figwheel\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froosta%2Fadvocado","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froosta%2Fadvocado","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froosta%2Fadvocado/lists"}