{"id":20774008,"url":"https://github.com/secjs/base","last_synced_at":"2025-04-30T15:13:56.512Z","repository":{"id":45462535,"uuid":"376582090","full_name":"SecJS/Base","owner":"SecJS","description":"📐 Base classes with prebuild methods for Node.js","archived":false,"fork":false,"pushed_at":"2021-12-17T20:25:52.000Z","size":1222,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T21:25:51.743Z","etag":null,"topics":["base","nodejs","prebuild"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/SecJS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"open_collective":"secjs"}},"created_at":"2021-06-13T15:50:29.000Z","updated_at":"2021-12-17T20:25:13.000Z","dependencies_parsed_at":"2022-07-14T14:47:23.666Z","dependency_job_id":null,"html_url":"https://github.com/SecJS/Base","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SecJS%2FBase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SecJS%2FBase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SecJS%2FBase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SecJS%2FBase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SecJS","download_url":"https://codeload.github.com/SecJS/Base/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251729734,"owners_count":21634281,"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":["base","nodejs","prebuild"],"created_at":"2024-11-17T12:27:59.482Z","updated_at":"2025-04-30T15:13:56.430Z","avatar_url":"https://github.com/SecJS.png","language":"TypeScript","funding_links":["https://opencollective.com/secjs","https://www.buymeacoffee.com/secjs"],"categories":[],"sub_categories":[],"readme":"# Base 📐\n\n\u003e Base stuffs for any NodeJS project\n\n[![GitHub followers](https://img.shields.io/github/followers/jlenon7.svg?style=social\u0026label=Follow\u0026maxAge=2592000)](https://github.com/jlenon7?tab=followers)\n[![GitHub stars](https://img.shields.io/github/stars/secjs/base.svg?style=social\u0026label=Star\u0026maxAge=2592000)](https://github.com/secjs/base/stargazers/)\n\n\u003cp\u003e\n    \u003ca href=\"https://www.buymeacoffee.com/secjs\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png\" alt=\"Buy Me A Coffee\" style=\"height: 41px !important;width: 174px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;\" \u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp\u003e\n  \u003cimg alt=\"GitHub language count\" src=\"https://img.shields.io/github/languages/count/secjs/base?style=for-the-badge\u0026logo=appveyor\"\u003e\n\n  \u003cimg alt=\"Repository size\" src=\"https://img.shields.io/github/repo-size/secjs/base?style=for-the-badge\u0026logo=appveyor\"\u003e\n\n  \u003cimg alt=\"License\" src=\"https://img.shields.io/badge/license-MIT-brightgreen?style=for-the-badge\u0026logo=appveyor\"\u003e\n\n  \u003cimg alt=\"Commitizen\" src=\"https://img.shields.io/badge/commitizen-friendly-brightgreen?style=for-the-badge\u0026logo=appveyor\"\u003e\n\u003c/p\u003e\n\nThe intention behind this repository is to always maintain a `Base` project to any NodeJS project.\n\n\u003cimg src=\".github/base.png\" width=\"200px\" align=\"right\" hspace=\"30px\" vspace=\"100px\"\u003e\n\n## Installation\n\n\u003e To use the high potential from this package you need to install first this other packages from SecJS, \n\u003e it keeps as dev dependency because one day `@secjs/core` will install everything once.\n\n```bash\nnpm install @secjs/contracts @secjs/exceptions @secjs/utils\n```\n\n\u003e Then you can install the package using:\n\n```bash\nnpm install @secjs/base\n```\n\n### BaseService\n\n\u003e Use to get nice methods to use with @secjs/base repositories\n\n```ts\nimport { User } from 'app/Models/User'\nimport { NotFoundException } from '@nestjs/common'\nimport { BaseService } from '@secjs/base/services/BaseService'\nimport { ContactResource } from 'app/Resources/ContactResource'\nimport { ContactRepository } from 'app/Repositories/ContactRepository'\n\nclass ContactService extends BaseService\u003cUser\u003e {\n  protected resourceName = 'contact'\n  protected resource = new ContactResource()\n  protected repository = new ContactRepository()\n  protected NotFoundException: any = NotFoundException // Define exception or use NotFoundException default from @secjs/exceptions\n\n  // You can subscribe BaseService methods in here if you want!\n}\n```\n\n---\n\n### LucidRepository\n\n\u003e Use LucidRepository to get nice methods based on ApiRequestContract\n\n```ts\nimport { User } from 'app/Models/User'\nimport { LucidRepository } from '@secjs/base/repositories/LucidRepository'\n\nclass UserRepository extends LucidRepository\u003cUser\u003e {\n  model = User // Give the Model value to Lucid, so he knows what to work with.\n\n  wheres = ['id', 'name'] // What wheres can be executed by client\n  relations = ['contacts'] // What relations can be get by client\n\n  // Both, wheres and relations will only work for external requests.\n  \n  // You can subscribe LucidRepository methods in here if you want!  \n}\n```\n\n---\n\n### TypeOrmRepository\n\n\u003e Use TypeOrmRepository to get nice methods based on ApiRequestContract\n\n```ts\nimport { User } from 'app/Models/User'\nimport { TypeOrmRepository } from '@secjs/base/repositories/TypeOrmRepository'\n\nclass UserRepository extends TypeOrmRepository\u003cUser\u003e {\n  model = User // Give the Model value to Lucid, so he knows what to work with.\n  \n  wheres = ['id', 'name'] // What wheres can be executed by client\n  relations = ['contacts'] // What relations can be get by client\n  \n  // Both, wheres and relations will only work for external requests.\n  \n  // You can subscribe TypeOrmRepository methods in here if you want!\n}\n```\n\n---\n\n### MongooseRepository\n\n\u003e Use MongooseRepository to get nice methods based on ApiRequestContract\n\n```ts\nimport { User, UserDocument } from 'app/Schemas/User'\nimport { MongooseRepository } from '@secjs/base/repositories/MongooseRepository'\n\nclass UserRepository extends MongooseRepository\u003cUserDocument\u003e {\n  model = User // Give the Model value to Mongoose, so he knows what to work with.\n\n  wheres = ['id', 'name'] // What wheres can be executed by client\n  relations = ['contacts'] // What relations can be get by client\n  \n  // Both, wheres and relations will only work for external requests.\n\n  // You can subscribe MongooseRepository methods in here if you want!  \n}\n```\n\n---\n\n### PrismaRepository\n\n\u003e Use PrismaRepository to get nice methods based on ApiRequestContract\n\n```ts\nimport { User } from 'app/Models/User'\nimport { PrismaRepository } from '@secjs/base/repositories/PrismaRepository'\n\nclass UserRepository extends PrismaRepository\u003cUser\u003e {\n  model = User // Give the Model value to Lucid, so he knows what to work with.\n\n  wheres = ['id', 'name'] // What wheres can be executed by client\n  relations = ['contacts'] // What relations can be get by client\n  \n  // Both, wheres and relations will only work for external requests.\n\n  // You can subscribe PrismaRepository methods in here if you want!\n}\n```\n\n---\n\n## License\n\nMade with 🖤 by [jlenon7](https://github.com/jlenon7) :wave:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecjs%2Fbase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsecjs%2Fbase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsecjs%2Fbase/lists"}