{"id":22663235,"url":"https://github.com/mongark/nanoerp-api","last_synced_at":"2026-04-12T00:10:18.952Z","repository":{"id":64459559,"uuid":"524611877","full_name":"Mongark/nanoerp-api","owner":"Mongark","description":"Small API that communicates with a MongoDB database. Used in the NanoERP project.","archived":false,"fork":false,"pushed_at":"2023-04-09T19:06:25.000Z","size":610,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T09:14:07.364Z","etag":null,"topics":["api","docker","docker-compose","express-js","mongodb","mongoose","typescript"],"latest_commit_sha":null,"homepage":"","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/Mongark.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":"2022-08-14T08:17:09.000Z","updated_at":"2023-04-09T18:53:40.000Z","dependencies_parsed_at":"2025-02-03T23:39:18.824Z","dependency_job_id":"12319b0f-846b-4ccf-8ac0-71e94cfd24d3","html_url":"https://github.com/Mongark/nanoerp-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Mongark/nanoerp-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mongark%2Fnanoerp-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mongark%2Fnanoerp-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mongark%2Fnanoerp-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mongark%2Fnanoerp-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mongark","download_url":"https://codeload.github.com/Mongark/nanoerp-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mongark%2Fnanoerp-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263279304,"owners_count":23441683,"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":["api","docker","docker-compose","express-js","mongodb","mongoose","typescript"],"created_at":"2024-12-09T12:17:46.043Z","updated_at":"2025-10-09T14:52:59.210Z","avatar_url":"https://github.com/Mongark.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NanoERP API\n\n![TypeScript](https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge\u0026logo=typescript\u0026logoColor=white) ![Express.js](https://img.shields.io/badge/express.js-%23404d59.svg?style=for-the-badge\u0026logo=express\u0026logoColor=%2361DAFB) ![MongoDB](https://img.shields.io/badge/MongoDB-%234ea94b.svg?style=for-the-badge\u0026logo=mongodb\u0026logoColor=white) ![JWT](https://img.shields.io/badge/JWT-black?style=for-the-badge\u0026logo=JSON%20web%20tokens)\n\n![GitHub repo size](https://img.shields.io/github/repo-size/Mongark/nanoerp-api)\n\nSmall API that communicates with a MongoDB database. Used in the NanoERP project.\n\nIt bases itself on the concept of generating code through specification.\n\n## How to Use the Router Generator\n\n### Schema and Model\n\nFirst, you must create a Mongoose Model from a Schema that an endpoint can use. Example:\n\n```typescript\nconst SampleSchema = new Schema({\n    name: {\n        required: true,\n        type: String,\n    },\n});\n\nconst SampleModel = model('Sample', SampleSchema);\n```\n\nYou can find more information about it [here](https://mongoosejs.com/docs/models.html).\n\n### Router Generation\n\nWith a Model, you can generate an Express router based on an array of endpoints. Each endpoint must be defined according to the EndpointType interface, and endpoint queries can ben passed through the `uri` string.\n\n```typescript\nconst router_config: Array\u003cRouterConfig\u003e = [\n    {\n        type:       \"GET\",\n        uri:        \"/:id\",\n        middleware: ControllerFactory.create(\"GET_BY_ID\", SampleModel),\n    },\n    {\n        type:       \"POST\",\n        uri:        \"/\",\n        middleware: ControllerFactory.create(\"POST_ONE\", SampleModel),\n    },\n]\n\nconst sample_router = RouterFactory.createRoute(config);\n```\n\n### Adding to the API\n\nLastly, youd just have to use the created route in your Express API.\n\n```typescript\nconst app = express();\n\napp.use(sample_router);\n```\n\n## Project Structure\n```\nsrc\n├── data\n│   ├── models\n│   └── schema\n├── generators\n│   ├── Actions\n│   ├── CommonTypes\n│   ├── Controllers\n│   │   ├── ControllerMiddleware\n│   ├── Factories\n├── middleware\n│   └── auth\n└── routes\n```\n\n### Data\nFor Models and Schema.\n\n### Generators\nFor API route generation.\n\n### Middleware\nFor non-generator middleware, such as Auth.\n\n### Routes\nFor defining and loading generated routes.\n\n## Bussiness Rules\n\n### API\n\nEndpoint(or Router) Generator\n\n- [ ] Each `Endpoint` should use a `EndpointConfig` specification.\n- [ ] Each `Endpoint` should be test-able with a `TestGenerator`.\n\n### Database\n\nInquire(when a guest is preparing to make a reservation).\n- [ ] Each `Inquire` should have a creation date.\n\nAccommodation\n\n- [ ] Each `Accommodation` must have a unique name.\n- [ ] Each `Accommodation` must have a `Location`.\n\nLocation\n\n- [ ] Each `Location` must have a unique `location_name`.\n\nRoom\n\n- [ ] Each `Room` must have a unique name.\n- [ ] Each `Room` must belong to an `Accommodation`.\n\nCompany\n\n- [ ] Each `Company` must have a name.\n\nUser\n\n- [ ] Each `User` must belong to a `Company`.\n- [ ] Each `User` has a set of `Role`s.\n- [ ] The `User` that signs up a company automatically gains the `Admin` role.\n\nRole\n\n- [ ] Each `Role` gives a set of permissions to a `User`.\n- [ ] A `Role` can be customized by a `User` with the `Admin` role.\n- [ ] The `Admin` role can only be removed by a `User` with `Admin` role.\n- [ ] The `Admin` role can't be removed by a `User` that is currently using it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongark%2Fnanoerp-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmongark%2Fnanoerp-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongark%2Fnanoerp-api/lists"}