{"id":13516979,"url":"https://github.com/wrannaman/generators","last_synced_at":"2025-07-30T05:34:12.474Z","repository":{"id":35050410,"uuid":"189799018","full_name":"wrannaman/generators","owner":"wrannaman","description":"API Generator - instantly generate REST and GraphQL APIs (openapi (OAS) 3.0.0)","archived":false,"fork":false,"pushed_at":"2022-12-30T17:52:06.000Z","size":2457,"stargazers_count":236,"open_issues_count":9,"forks_count":28,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-01T19:44:06.412Z","etag":null,"topics":["api-generator","generator","graphql","microservice","microservice-framework","mit-license","nodejs","nodejs-development","nodejs-server","oas","oasv3","openapi","openapi-generator","openapi3","rest","swagger-codegen"],"latest_commit_sha":null,"homepage":"https://noco.io","language":"JavaScript","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/wrannaman.png","metadata":{"files":{"readme":"README.api.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}},"created_at":"2019-06-02T03:05:54.000Z","updated_at":"2024-01-25T00:40:39.000Z","dependencies_parsed_at":"2023-01-15T12:46:42.271Z","dependency_job_id":null,"html_url":"https://github.com/wrannaman/generators","commit_stats":null,"previous_names":["sugarkubes/generators"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wrannaman/generators","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wrannaman%2Fgenerators","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wrannaman%2Fgenerators/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wrannaman%2Fgenerators/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wrannaman%2Fgenerators/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wrannaman","download_url":"https://codeload.github.com/wrannaman/generators/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wrannaman%2Fgenerators/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267815187,"owners_count":24148356,"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","status":"online","status_checked_at":"2025-07-30T02:00:09.044Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-generator","generator","graphql","microservice","microservice-framework","mit-license","nodejs","nodejs-development","nodejs-server","oas","oasv3","openapi","openapi-generator","openapi3","rest","swagger-codegen"],"created_at":"2024-08-01T05:01:28.066Z","updated_at":"2025-07-30T05:34:12.450Z","avatar_url":"https://github.com/wrannaman.png","language":"JavaScript","readme":"# Instantly Generate Rest \u0026 GraphQL APIs 🔥\n\n[![Follow on Twitter](https://img.shields.io/twitter/follow/andrewpierno.svg?label=follow)](https://twitter.com/andrewpierno)\n[![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/sugarkubes/generators.svg)](http://isitmaintained.com/project/sugarkubes/generators \"Average time to resolve an issue\")\n[![Percentage of issues still open](http://isitmaintained.com/badge/open/sugarkubes/generators.svg)](http://isitmaintained.com/project/sugarkubes/generators \"Percentage of issues still open\")\n[![npm package](https://img.shields.io/npm/v/sugar-generate/latest.svg)](https://www.npmjs.com/package/sugar-generate)\n[![NPM Downloads](https://img.shields.io/npm/dt/sugar-generate.svg?style=flat)](https://npmcharts.com/compare/sugar-generate?minimal=true)\n\n\n![Sugar Generator - API Edition](https://github.com/sugarkubes/generators/blob/master/logo.png?raw=true)\n\n\n## Install\n\n```sh\nnpm i -g sugar-generate\n```\n\n## Prereqs\n\n- have mongodb [installed and running](https://treehouse.github.io/installation-guides/mac/mongo-mac.html)!\n- have nodejs installed\n\nif you're running mongodb locally and using the docker container, make sure to start mongo using\n\n```sh\nsudo mongod --bind_ip_all\n```\n\notherwise you wont be able to connect to mongo from docker.\n\n## Getting Started\n\n1. Create your schema. It could be as simple as:\n\n```json\n{\n  \"schema\": {\n    \"name\": {\n      \"type\": \"String\",\n      \"default\": \"\"\n    },\n    \"isDead\": {\n      \"type\": \"Boolean\",\n      \"default\": false\n    },\n    \"age\": {\n      \"type\": \"Number\",\n      \"default\": false\n    }\n  },\n  \"statics\": {}\n}\n```\n\nYou can also provide multiple schemas like the following\n\n```json\n[\n  {\n    \"name\": \"user\",\n    \"schema\": {\n      \"name\": {\n        \"type\": \"String\",\n        \"default\": \"\"\n      },\n      \"email\": {\n        \"type\": \"String\",\n        \"trim\": true,\n        \"required\": true,\n        \"unique\": true,\n        \"immutable\": true\n      },\n      \"intro\": {\n        \"type\": \"Boolean\",\n        \"default\": false\n      },\n      \"sub\": {\n        \"one\": {\n          \"type\": \"String\",\n          \"trim\": true,\n          \"required\": true\n        },\n        \"two\": {\n          \"type\": \"String\",\n          \"required\": true\n        },\n        \"three\": {\n          \"type\": \"Number\"\n        }\n      },\n      \"role\": {\n        \"type\": \"String\",\n        \"enum\": [\"user\", \"maker\"],\n        \"default\": \"user\"\n      }\n    },\n    \"statics\": {\n      \"statuses\": [\"created\", \"under_review\", \"listed\", \"deleted\"],\n      \"status\": {\n        \"active\": \"active\",\n        \"inactive\": \"inactive\",\n        \"deleted\": \"deleted\"\n      }\n    }\n  },\n  {\n    \"name\": \"team\",\n    \"schema\": {\n      \"name\": {\n        \"type\": \"String\",\n        \"default\": \"\"\n      },\n      \"users\": {\n        \"type\": \"ObjectId\",\n        \"ref\": \"Users\"\n      }\n    }\n  }\n]\n```\n\nsave this to **monkey.json**\n\n2. generate your api\n\n```sh\nsugar-generate \\\n--schema ./monkey.json \\\n--destination ./my-monkeys\n```\nor the short version\n\n```sh\nsugar-generate \\\n-s ./monkey.json \\\n-d ./my-monkeys\n```\n\n**Note this is slightly different than previous versions. The schemas require a name now.**\n\n3. Run or build the docker container and visit [http://localhost:3000](http://localhost:3000)\n\n```sh\ncd /my-monkeys\nnpm i\nnpm start\n# Or build the docker container!\ndocker build -t myMonkeys:0.1.0 .\n```\n\n![running](https://github.com/sugarkubes/generators/blob/master/start.png?raw=true)\n![oas docs](https://github.com/sugarkubes/generators/blob/master/monkey.png?raw=true)\n\n## Features 🙉\n- Generates simple Nodejs code\n- Graphql and Rest out of the box\n- Uses Mongodb with Mongoose ORM\n- Easy to build / deploy\n- Dockerfile included\n- supports multiple schemas\n- Generates CRUD APIs\n  - create\n  - get (many, with pagination; supports search, sort, filter, pagination out of the box)\n  - getOne\n  - update\n  - delete\n- Generates GraphQL apis for both query and mutation\n\n## What it's good at 🙊\n\n- Generating an initial API\n- Microservice oriented\n- Ready to deploy (build with docker =\u003e deploy)\n\n## What it's not good at (yet) 🙈\n\n- idempotent changes (i.e. it doesn't know if you wrote code in there or changed things around)\n- working with modified code\n- populating table joins\n- custom actions inside controller functions\n\n\n## TODO\n\n\n### API\n- ~~basic generator rest tests~~\n- graphql tests\n- other databases?\n- **your ideas?**\n- middleware for auth, token validation, etc.\n\n\n## Graphql support\n\n![graphql mutation](https://github.com/sugarkubes/generators/blob/master/graphql-mutation.png?raw=true)\n\n![graphql schema](https://github.com/sugarkubes/generators/blob/master/graphql-schema.png?raw=true)\n\n\ngraphql is supported and gets created by default so you can choose between rest and graphql\n\nGraphql is on [http://localhost:3000/graphql](http://localhost:3000/graphql)\n\n\n\n## Generated project structure\n\n    .\n    ├── configs                 # Config File\n    ├── connection              # DB Connections (mongo, redis)\n    ├── controller              # Controllers\n    │   ├── \u003cmodel name\u003e        # Functions (one file, one function) create, delete, update, get, getOne\n    ├── models                  # DB Models\n    ├── router                  # Endpoint Routes\n    ├── tests                   # Single Test File\n\n## Generated tests\n\n** WARNING ** running the tests will pull the config file from **configs/config.json** and clear the DB\n\n```sh\nnpm run test\n```\n","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwrannaman%2Fgenerators","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwrannaman%2Fgenerators","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwrannaman%2Fgenerators/lists"}