{"id":27349560,"url":"https://github.com/benjaminpla/node_api","last_synced_at":"2025-04-12T19:17:51.079Z","repository":{"id":286029053,"uuid":"960101158","full_name":"benjaminPla/node_api","owner":"benjaminPla","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-04T10:33:56.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T19:17:47.002Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/benjaminPla.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":"2025-04-03T21:29:02.000Z","updated_at":"2025-04-04T10:33:59.000Z","dependencies_parsed_at":"2025-04-03T23:39:40.386Z","dependency_job_id":null,"html_url":"https://github.com/benjaminPla/node_api","commit_stats":null,"previous_names":["benjaminpla/node_api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjaminPla%2Fnode_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjaminPla%2Fnode_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjaminPla%2Fnode_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjaminPla%2Fnode_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benjaminPla","download_url":"https://codeload.github.com/benjaminPla/node_api/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248618222,"owners_count":21134202,"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":"2025-04-12T19:17:50.530Z","updated_at":"2025-04-12T19:17:51.061Z","avatar_url":"https://github.com/benjaminPla.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rindus\n\n## overview\n\nthis api is built with node.js, express, postgresql, sequelize, and redis. it includes:\n\n- user management with roles (admin, client).\n- authentication via jwt and bcrypt for password hashing.\n- crud operations\n- rate limiting and basic security measures to mitigate bot attacks.\n- fully documented and tested using postman.\n- dockerized with docker and docker compose, ready to run with postgresql and redis containers.\n\naimed to showcase my skills with minimal code (limited time!).\n\n## documentation\n\nhttps://documenter.getpostman.com/view/16085603/2sB2cSiQ4r\n\n## structure\n\n```\n.\n├── build\n│   └── src\n│       ├── controllers\n│       │   ├── health.js\n│       │   └── user\n│       │       ├── create.js\n│       │       └── get.js\n│       ├── helpers\n│       │   └── index.js\n│       ├── index.js\n│       └── routes\n│           └── index.js\n├── docker-compose.yml\n├── Dockerfile\n├── package.json\n├── package-lock.json\n├── README.md\n├── src\n│   ├── controllers\n│   │   ├── authentication\n│   │   │   └── authenticate.ts\n│   │   ├── health.ts\n│   │   ├── post\n│   │   │   ├── delete.ts\n│   │   │   ├── get.ts\n│   │   │   ├── post.ts\n│   │   │   └── put.ts\n│   │   ├── syncDb.ts\n│   │   └── user\n│   │       ├── create.ts\n│   │       └── get.ts\n│   ├── extended.d.ts\n│   ├── helpers\n│   │   └── index.ts\n│   ├── index.ts\n│   ├── middlewares\n│   │   ├── authenticateToken.ts\n│   │   ├── checkAdmin.ts\n│   │   ├── checkReq.ts\n│   │   └── checkValidId.ts\n│   ├── models\n│   │   ├── post.ts\n│   │   └── user.ts\n│   └── routes\n│       └── index.ts\n└── tsconfig.json\n```\n\n## how to run it\n\n### local\n\n1. clone the repo\n2. add an _.env_ file\n\n```\nADMIN_EMAIL=rindus@email.com\nADMIN_PASSWORD=rindus12345\nBCRYPT_SALT=10\nDB_HOST=localhost\nDB_NAME=rindus\nDB_PASSWORD=rindus12345\nDB_PORT=5432\nDB_USERNAME=rindus\nENV='dev'\nJWT_EXPIRES_MS=900000\nJWT_SECRET=rindus12345\nPORT=3000\nRATE_LIMITER_MAX=30\nRATE_LIMITER_WINDOW_MS=900000\nREDIS_EX_S=30\nREDIS_URL=redis://localhost:6379\nSPEED_LIMITER_DELAY_AFTER=5\nSPEED_LIMITER_DELAY_MS=100\nSPEED_LIMITER_WINDOW_MS=900000\n```\n\n3. you would need a postgres and a redis client running on your pc, you can run:\n\n```\ndocker run -d \\\n --name postgres-rindus \\\n -e POSTGRES_USER=rindus \\\n -e POSTGRES_PASSWORD=rindus12345 \\\n -e POSTGRES_DB=rindus \\\n -p 5432:5432 \\\n postgres\n\ndocker run -d --name redis -p 6379:6379 redis\n```\n\n4. run `npm run build \u0026\u0026 npm run start`\n5. sync and populate the db hitting one `syncDb` enpoint, this will create an admin user accoding the _.env_ vars _(this is a bad practice and of course unsecured but I had no more time really)_\n6. call the api with any http client following the documentation\n\n### docker\n\n1. run `docker-compose up`\n2. sync and populate the db hitting one `syncDb` enpoint, this will create an admin user accoding the _.env_ vars _(this is a bad practice and of course unsecured but I had no more time really)_\n3. call the api with any http client following the documentation\n\n## todo\n\n- [ ] saml || oauth\n- [x] docker\n- [x] roles\n- [x] rate limiter + slow down\n- [x] middlewares\n- [x] cache\n- [x] fk\n- [ ] soft delete\n- [x] jwt\n- [x] test\n- [ ] refresh token\n- [ ] sessionId\n- [x] role middleware\n- [ ] sequelize pool\n- [x] optimistic locking\n- [x] documentation\n- [ ] modulize router\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjaminpla%2Fnode_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenjaminpla%2Fnode_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjaminpla%2Fnode_api/lists"}