{"id":13553317,"url":"https://github.com/jesusvilla/natural","last_synced_at":"2026-03-05T18:39:50.466Z","repository":{"id":38199887,"uuid":"277687681","full_name":"jesusvilla/natural","owner":"jesusvilla","description":"Fastest Framework for NodeJS. Written in pure ES6+","archived":false,"fork":false,"pushed_at":"2022-12-25T21:38:24.000Z","size":211,"stargazers_count":48,"open_issues_count":2,"forks_count":4,"subscribers_count":0,"default_branch":"develop","last_synced_at":"2025-09-27T19:44:56.083Z","etag":null,"topics":["cloudflare","cloudflare-workers","fast","framework","http","js","node","rest-api","serviceworker","webserver","workers"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jesusvilla.png","metadata":{"files":{"readme":"README.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":"2020-07-07T01:36:15.000Z","updated_at":"2024-04-16T19:20:12.000Z","dependencies_parsed_at":"2023-01-30T22:46:18.518Z","dependency_job_id":null,"html_url":"https://github.com/jesusvilla/natural","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jesusvilla/natural","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusvilla%2Fnatural","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusvilla%2Fnatural/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusvilla%2Fnatural/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusvilla%2Fnatural/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jesusvilla","download_url":"https://codeload.github.com/jesusvilla/natural/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jesusvilla%2Fnatural/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279000704,"owners_count":26082921,"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-10-09T02:00:07.460Z","response_time":59,"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":["cloudflare","cloudflare-workers","fast","framework","http","js","node","rest-api","serviceworker","webserver","workers"],"created_at":"2024-08-01T12:02:22.018Z","updated_at":"2025-10-09T04:30:34.337Z","avatar_url":"https://github.com/jesusvilla.png","language":"JavaScript","funding_links":["https://www.paypal.com/donate/?hosted_button_id=CW2Z4CLAX2GVC"],"categories":["JavaScript"],"sub_categories":[],"readme":"# Natural\n[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/donate/?hosted_button_id=CW2Z4CLAX2GVC)\n\nFastest Framework for Node.js. Written in pure javascript (ES6+)\n\n  - Created with the least possible code.\n  - Pure native HTTP Server.\n  - Based on Polka, Restana, Fastify, Express (for the creation of the Router).\n  - Based on NestJS (framework concepts and abstraction).\n  - Support Serverless: Workers Cloudflare, AWS Lambda, Google Cloud Functions\n\n## Requirements\nNode.js v14+ (v16+ for Workers)\n\n## Installation (/example)\n\n```\n$ npm i -S natural-framework\n```\n\n## Example\n\u003e View examples folder\n\n### NaturalRouter (Local Server)\n```js\nimport NaturalRouter from 'natural-framework/router'\nimport * as HttpServer from 'natural-framework/server/uws'\n// import * as HttpServer from 'natural-framework/server/node' // for Node.js native application\n\nfunction createRoutes (router) {\n  router\n    .get('/', (_, response) =\u003e {\n      response.end('')\n    })\n    .get('/user/:id', (request, response) =\u003e {\n      response.end(request.params.id)\n    })\n    .post('/user', (request, response) =\u003e {\n      response.end('')\n    })\n    .route({\n      url: '/test/simple/:id',\n      method: 'GET',\n      type: 'json',\n      handler: (request, response) =\u003e {\n        // request.params, request.query, request.body, request.files\n        response.send({ id: request.params.id }, 'json')\n      }\n    })\n\n  /* router.route({\n    url: '/meet/auth',\n    method: 'GET',\n    type: 'json',\n    handler: (request, response) =\u003e {\n      const params = Object.assign({}, request.params, request.query)\n      response.send(params)\n    }\n  }) */\n\n  // or\n  /*\n  router.on('GET', '/station/test/simple/:id', (request, response) =\u003e {\n    // request.params, request.query, request.body, request.files\n    response.send({ id: request.params.id }, 'json')\n  })\n  */\n}\n\nasync function bootstrap () {\n  const router = new NaturalRouter({\n    server: HttpServer\n    /* ssl: {\n      key: path.join(__dirname, './security/cert.key'),\n      cert: path.join(__dirname, './security/cert.pem')\n    } */\n  })\n  try {\n    createRoutes(router)\n    const port = await router.listen(3000)\n    console.log(`Listen http://localhost:${port}`)\n  } catch (error) {\n    console.log('Error:', error)\n  }\n}\n\nbootstrap()\n```\n\n### NaturalRouter (Serverless)\n\u003e Workers Cloudflare, AWS Lambda, Google Cloud Functions (Yeah, Same code for any serverless!!)\n```js\nimport NaturalRouter from 'natural-framework/router'\nimport * as HttpServer from 'natural-framework/server/worker' // for Workers Cloudflare\n// import * as HttpServer from 'natural-framework/server/lambda' // for AWS Lambda\n// import * as HttpServer from 'natural-framework/server/function' // Google Cloud Functions\n\nconst router = new NaturalRouter({\n  server: HttpServer\n}\n\nrouter\n  .get('/', (_, response) =\u003e {\n    response.end('')\n  })\n  .get('/user/:id', (request, response) =\u003e {\n    response.end(request.params.id)\n  })\n  .post('/user', (request, response) =\u003e {\n    response.end('')\n  })\n  .route({\n    url: '/test/simple/:id',\n    method: 'GET',\n    type: 'json',\n    handler: (request, response) =\u003e {\n      // request.params, request.query, request.body\n      return { id: request.params.id }\n      // or: response.send({ id: request.params.id }, 'json')\n    }\n  })\n\n  /* router.route({\n    url: '/test/simple/:id',\n    method: 'POST',\n    type: 'json',\n    handler: (request, response) =\u003e {\n      const params = Object.assign({}, request.params, request.query, request.body)\n      response.send(params)\n    }\n  })\n\n  // or\n\n  router.on('POST', '/test/simple/:id', (request, response) =\u003e {\n    const params = Object.assign({}, request.params, request.query, request.body)\n    response.send(params)\n  })\n\n  */\n\nexport default {\n  fetch: router.run()\n}\n```\n\n### NaturalJS\n```js\nimport NaturalJS from 'natural-framework'\nimport * as HttpServer from 'natural-framework/server/uws'\nimport station from './station'\n\nasync function bootstrap () {\n  const app = new NaturalJS({\n    server: HttpServer,\n    modules: {\n      station\n    }\n  })\n\n  try {\n    const port = await app.listen(3000)\n    console.log(`Listen http://localhost:${port}`)\n  } catch (error) {\n    console.log('Error:', error)\n  }\n}\n\nbootstrap()\n```\n\n## Definitions\n\n### Controller\n\n```js\nimport { Controller, Accepts, Get, TypeJson } from 'natural-framework/common'\n\n// Registered route: /test\n@Controller('test')\nclass Test {\n  // Without path\n  // Registered route: /test/\n  @Get()\n  main () {\n    // Return string, automatic detected by Natural\n    return 'Welcome'\n  }\n\n  // With path\n  // Registered route: /test/simple\n  @Get('simple')\n  getSimple () {\n    // Return string\n    return 'Simple Main'\n  }\n\n  // With path, with params\n  // Registered route: /test/simple/:id\n  @Get('simple/:id')\n  // With arguments: id\n  @Accepts('id')\n  // Return type: json (application/json)\n  @TypeJson()\n  getSimpleId (id) {\n    return { id, type: typeof id }\n  }\n\n  // With path, with params\n  @Get('validator/:id')\n  // With arguments with validator: id (only type number)\n  @Accepts({ name: 'id', type: 'number' })\n  // Return type: json (application/json)\n  @TypeJson()\n  getIdWithValidator (id) {\n    return { id, type: typeof id }\n  }\n}\n\nexport default Test\n```\n\n\n## Use (Contribute)\n\nStart NaturalRouter (/example)\n```\n$ npm run dev:router\n```\n\nStart NaturalJS (/example)\n```\n$ npm run dev\n```\n\n## Benchmarks\n\u003e Coming soon...\n\n## ToDo\n\n - Providers: Services, Models, ...\n\n\n## Donation\n\nIf this project help you reduce time to develop, you can give me a cup of coffee :)\n\n[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/donate/?hosted_button_id=CW2Z4CLAX2GVC)\n\n## Thanks\n\nMade with love for all nodejs developers\nInspired in my family\n\n## License\n\nGPL-3.0 License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesusvilla%2Fnatural","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjesusvilla%2Fnatural","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjesusvilla%2Fnatural/lists"}