{"id":16261027,"url":"https://github.com/piyush-linux/jwt","last_synced_at":"2025-06-22T19:07:39.607Z","repository":{"id":157592774,"uuid":"381319709","full_name":"Piyush-linux/JWT","owner":"Piyush-linux","description":null,"archived":false,"fork":false,"pushed_at":"2021-07-05T06:11:49.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-22T19:06:54.022Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/Piyush-linux.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":"2021-06-29T10:05:02.000Z","updated_at":"2021-07-05T06:11:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"ac2abdaf-0ffd-476c-b177-b0b0537af8e8","html_url":"https://github.com/Piyush-linux/JWT","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Piyush-linux/JWT","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Piyush-linux%2FJWT","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Piyush-linux%2FJWT/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Piyush-linux%2FJWT/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Piyush-linux%2FJWT/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Piyush-linux","download_url":"https://codeload.github.com/Piyush-linux/JWT/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Piyush-linux%2FJWT/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261348748,"owners_count":23145312,"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-10-10T16:40:16.983Z","updated_at":"2025-06-22T19:07:34.592Z","avatar_url":"https://github.com/Piyush-linux.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TODO\n\n- [ ] connect F to B\n- [x] F: login\n- [ ] F: profile\n- [ ] R\u0026D : site's to deploy F+B app\n- [ ] future : usr del profile , update psw\n\n\n\u003e Remmebr to open mongodb atlas to begin operation or chenge IP but related to MongoDB_Atlas Only\n\n# Frontend\nhttps://ionify.com/\n```yaml\n!Asset\ncol: [pr: 1abc9c, bg: ecf0f1]\nfnt: Croissant One\n\n!wire\ncol-1:\n    - h1 \u003e p10 \u003e btn\ncol-2:\n    - h2 \u003e p4 \u003e inp*3 \u003e btn\n\n```\n\n# Backend \n\n0. PrePlan\n- `npm init -y`\n- Know your intension\n- file str properly\n```sh\n/.env\n/node_modules\n/server.js\n/middleware/jwt.js\n/router/{ auth.js , profile.js }\n/model/{ user.js , validation.js }\n/views/{index.pug , /partial/(navbar.pug , footer.pug...) }\n/public\n    /css/{style.css,lib.css}\n    /js/form.js\n    /img/\n/README.md\n```\n1. Server Listening\n    - npm i nodemon express\n    - init express App\n2. Routes Rendering\n    - init exp_router\n    - get , post\n3. Connect to db\n    - Have MongoDB Atlas : user \u003e IP \u003e Cluster\n    - npm i mongoose dotenv\n    - mongoose connect to db\n    - env store user\u0026pasw : .env \u003e DB=b3j24h3jh4b5345h4b\n4. Test CRUD\n    - npm i body-parser : to rec data from usr\n    - make rules \u0026 fields (Schema,model)\n    - CRUD operation\n5. Data Validation\n    1. chk if data is valid\n        - Validate\n        - `npm i @hapi`\n            - `rules = { attr : joi.rule1().rule() }`\n            - `{ err } = joi.validate(req.body,rules)`\n        - encrpt/decrypt : `npm i joi bcrypt`\n            = encrypt( NormalPasw , encoder )\n            = compare( userPsw , encodedPsw ) =\u003e T:usr_is_valid | F:usr_is_Invalid\n    2. chk if data already exist in DB\n        - N : encrpt psw/id for that usr/data then register\n        - Y : decode and compare with usr.psw then loggin\n6. JWT Token\n    - context\n        - once logged in : A special token will be given to Client so next it automatically get loggedin\n        - Client  \u003c-\u003e server : 1\u003eregister 2\u003elogin(JWT_given) 3\u003eAutoLogin(with_JWT)...\n    - psuedo code\n        - install jwt : npm i jsonwebtoken\n        - token encoding : token( id , psw.env )\n        - token header appending\n        - token verify middleware\n            = 1. chk token avalable \u003e verify \u003e dcrpt usrID \u003e req.usr\n            = chk token availale \u0026 verify\n            = then decrpt to usrID =\u003e req.user\n    \n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiyush-linux%2Fjwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpiyush-linux%2Fjwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpiyush-linux%2Fjwt/lists"}