{"id":16675754,"url":"https://github.com/andrehrferreira/cmmv-server","last_synced_at":"2025-03-23T14:31:33.605Z","repository":{"id":257807628,"uuid":"859193728","full_name":"cmmvio/cmmv-server","owner":"cmmvio","description":"HTTP/HTTP 2 Server similar to Express","archived":false,"fork":false,"pushed_at":"2025-03-13T04:55:48.000Z","size":1805,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T04:56:36.695Z","etag":null,"topics":["expressjs","fastify","http-server","http2-server","koa","nodejs","typescript"],"latest_commit_sha":null,"homepage":"https://cmmv.io","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/cmmvio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2024-09-18T08:47:39.000Z","updated_at":"2025-03-13T04:55:52.000Z","dependencies_parsed_at":null,"dependency_job_id":"78de092b-9c88-4927-8bd4-20b07d5c5de2","html_url":"https://github.com/cmmvio/cmmv-server","commit_stats":null,"previous_names":["andrehrferreira/cmmv-server","cmmvio/cmmv-server"],"tags_count":35,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmmvio%2Fcmmv-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmmvio%2Fcmmv-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmmvio%2Fcmmv-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cmmvio%2Fcmmv-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cmmvio","download_url":"https://codeload.github.com/cmmvio/cmmv-server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245115889,"owners_count":20563252,"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":["expressjs","fastify","http-server","http2-server","koa","nodejs","typescript"],"created_at":"2024-10-12T13:07:09.951Z","updated_at":"2025-03-23T14:31:33.597Z","avatar_url":"https://github.com/cmmvio.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://cmmv.io/\" target=\"blank\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/cmmvio/docs.cmmv.io/main/public/assets/logo_CMMV2_icon.png\" width=\"300\" alt=\"CMMV Logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003eContract-Model-Model-View (CMMV) \u003cbr/\u003e Building scalable and modular applications using contracts.\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://www.npmjs.com/package/@cmmv/core\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/@cmmv/core.svg\" alt=\"NPM Version\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/cmmvio/cmmv-server/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/npm/l/@cmmv/core.svg\" alt=\"Package License\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://dl.circleci.com/status-badge/redirect/circleci/QyJWAYrZ9JTfN1eubSDo5u/JEtDUbr1cNkGRxfKFJo7oR/tree/main\" target=\"_blank\"\u003e\u003cimg src=\"https://dl.circleci.com/status-badge/img/circleci/QyJWAYrZ9JTfN1eubSDo5u/JEtDUbr1cNkGRxfKFJo7oR/tree/main.svg?style=svg\" alt=\"CircleCI\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://cmmv.io\"\u003eDocumentation\u003c/a\u003e \u0026bull;\n  \u003ca href=\"https://github.com/cmmvio/cmmv-server/issues\"\u003eReport Issue\u003c/a\u003e\n\u003c/p\u003e\n\n## Description\n\n``@cmmv/server`` is inspired by the popular [Express.js](https://expressjs.com/pt-br/) framework but has been entirely rewritten in TypeScript with performance improvements in mind. The project integrates common plugins like ``body-parser``, ``compression``, ``cookie-parser``, ``cors``, ``etag``, ``helmet`` and ``serve-static`` out of the box. Additionally, it plans to support any Express.js-compatible plugin in the near future.\n\n## Installation\n\nInstall the ``@cmmv/server`` package via npm:\n\n```bash\n$ pnpm add @cmmv/server\n```\n\n## Quick Start\n\nBelow is a simple example of how to create a new CMMV application:\n\n```typescript\nimport cmmv, { json, urlencoded, serverStatic } from '@cmmv/server';\nimport etag from '@cmmv/etag';\nimport cors from '@cmmv/cors';\nimport cookieParser from '@cmmv/cookie-parser';\nimport compression from '@cmmv/compression';\nimport helmet from '@cmmv/helmet';\n\nconst app = cmmv();\nconst host = '0.0.0.0';\nconst port = 3000;\n\napp.use(serverStatic('public'));\napp.use(cors());\napp.use(etag({ algorithm: 'murmurhash' }));\napp.use(cookieParser());\napp.use(json({ limit: '50mb' }));\napp.use(urlencoded({ limit: '50mb', extended: true }));\napp.use(compression({ level: 6 }));\napp.use(\n    helmet({\n        contentSecurityPolicy: {\n            useDefaults: false,\n            directives: {\n                defaultSrc: [\"'self'\"],\n                scriptSrc: [\"'self'\", 'example.com'],\n                objectSrc: [\"'none'\"],\n                upgradeInsecureRequests: [],\n            },\n        },\n    }),\n);\n\napp.set('view engine', 'pug');\n\napp.get('/view', async (req, res) =\u003e {\n    res.render('index', { title: 'Hey', message: 'Hello there!' });\n});\n\napp.get('/', async (req, res) =\u003e {\n    res.send('Hello World');\n});\n\napp.get('/json', async (req, res) =\u003e {    \n    res.json({ hello: 'world' });\n});\n\napp.get('/user/:id', async (req, res) =\u003e {\n    res.send('User ' + req.params.id);\n});\n\napp.get('/users', async (req, res) =\u003e {\n    res.json(req.query);\n});\n\napp.post('/test', async (req, res) =\u003e {\n    console.log(req.body);\n    res.send('ok');\n});\n\napp.listen({ host, port })\n.then(server =\u003e {\n    console.log(\n        `Listen on http://${server.address().address}:${server.address().port}`,\n    );\n})\n.catch(err =\u003e {\n    throw Error(err.message);\n});\n```\n\n## Features\n\n* **Performance Optimized:** Faster and more efficient with improvements over Express.js.\n* **Built-in Plugins:** Includes commonly used middleware like ``compression``, ``body-parser``, ``cookie-parser``, and more.\n* **TypeScript First:** Fully written in TypeScript for better type safety and developer experience.\n* **Express.js Compatibility:** Plans to support Express.js-compatible plugins.\n* **HTTP/2 Support:** Native support for HTTP/2, improving speed and connection performance.\n\n## Benchmarks\n\n* [https://github.com/fastify/benchmarks](https://github.com/fastify/benchmarks)\n* Machine: linux x64 | 32 vCPUs | 128.0GB Mem\n* Node: v20.17.0\n* Run: Sun Mar 16 2025 14:51:12 GMT+0000 (Coordinated Universal Time)\n* Method: ``autocannon -c 100 -d 40 -p 10 localhost:3000``\n\n|                          | Version  | Router | Requests/s | Latency (ms) | Throughput/Mb |\n|--------------------------|----------|--------|------------|--------------|---------------|\n| bare                     | v20.17.0 | ✗      | 51166.4    | 19.19        | 9.13          |\n| cmmv                     | 0.9.4    | ✓      | 46879.2    | 21.03        | 8.40          |\n| fastify                  | 5.2.1    | ✓      | 46488.0    | 21.19        | 8.33          |\n| h3                       | 1.15.1   | ✗      | 34626.2    | 28.37        | 6.18          |\n| restify                  | 11.1.0   | ✓      | 34020.6    | 28.88        | 6.07          |\n| koa                      | 2.16.0   | ✗      | 31031.0    | 31.72        | 5.53          |\n| express                  | 5.0.1    | ✓      | 12913.6    | 76.87        | 2.30          |\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrehrferreira%2Fcmmv-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrehrferreira%2Fcmmv-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrehrferreira%2Fcmmv-server/lists"}