{"id":36507965,"url":"https://github.com/etienne-graveyard/tumau","last_synced_at":"2026-02-21T10:33:14.143Z","repository":{"id":35090383,"uuid":"183808915","full_name":"etienne-graveyard/tumau","owner":"etienne-graveyard","description":"🏺A node HTTP framework written in Typescript","archived":false,"fork":false,"pushed_at":"2023-07-11T10:18:31.000Z","size":3871,"stargazers_count":21,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-01-15T07:53:25.630Z","etag":null,"topics":["http","middleware","nodejs","server","typescript"],"latest_commit_sha":null,"homepage":"https://tumaujs.org/","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/etienne-graveyard.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-27T18:34:45.000Z","updated_at":"2023-08-14T22:52:03.000Z","dependencies_parsed_at":"2024-06-19T11:17:19.925Z","dependency_job_id":"cc536be7-5882-4ae7-aabc-83f7bae16c54","html_url":"https://github.com/etienne-graveyard/tumau","commit_stats":null,"previous_names":["etienne-dldc/tumau"],"tags_count":103,"template":false,"template_full_name":null,"purl":"pkg:github/etienne-graveyard/tumau","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etienne-graveyard%2Ftumau","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etienne-graveyard%2Ftumau/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etienne-graveyard%2Ftumau/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etienne-graveyard%2Ftumau/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/etienne-graveyard","download_url":"https://codeload.github.com/etienne-graveyard/tumau/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/etienne-graveyard%2Ftumau/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29679049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T09:33:50.764Z","status":"ssl_error","status_checked_at":"2026-02-21T09:33:19.949Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["http","middleware","nodejs","server","typescript"],"created_at":"2026-01-12T02:31:54.193Z","updated_at":"2026-02-21T10:33:14.138Z","avatar_url":"https://github.com/etienne-graveyard.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- This file has been generated, to change it edit docs/content/index.dy --\u003e\n\u003cp align=\"center\"\u003e\n\n![tumau logo](https://github.com/etienne-dldc/tumau/blob/master/design/logo.svg)\n\n\u003c/p\u003e\n\n# 🏺 Tumau\n\n\u003e A node HTTP framework written in Typescript\n\nTumau is NodeJS server framework (just like [Express](https://expressjs.com/) or [Koa](https://koajs.com/)) with almost no external dependencies and written in TypeScript.\n\n## Gist\n\n```ts\nimport { createServer, TumauResponse, RequestConsumer } from 'tumau';\n\nconst server = createServer((ctx) =\u003e {\n  const request = ctx.get(RequestConsumer);\n  return TumauResponse.withText(`Hello World ! (from ${request.url})`);\n});\n\nserver.listen(3002, () =\u003e {\n  console.log(`Server is up at http://localhost:3002`);\n});\n```\n\n## Benefits over Express/Koa/Other\n\n- Written in Typescript (strong yet easy-to-use types)\n- Almost no external dependency (easy to audit)\n- Simple to extends (using middleware)\n- Modular, you can take only what you need.\n\n## Install\n\n```bash\n# npm\nnpm install tumau\n\n# yarn\nyarn add tumau\n```\n\n## Dependencies\n\n-[`chemin`](https://github.com/etienne-dldc/chemin) for the router path matching (`chemin` itself has zero dependencies). -[`miid`](https://github.com/etienne-dldc/miid) for the middleware system (`miid` itself has zero dependencies).\n\n## Overview\n\nLike many other server, Tumau is based on middleware. A middleware is like a layer the request has to go though. At some point a response is created by one of the middleware and the response has to travel back to the outside (go through every layer in the opposite order) to be sent.\n\n\u003cp align=\"center\"\u003e\n\n![middleware](https://github.com/etienne-dldc/tumau/blob/master/design/illu-1.png)\n\n\u003c/p\u003e\n\nA middleware can stop the chain and return a response. In that case the next middleware will not be called !\n\n\u003cp align=\"center\"\u003e\n\n![next](https://github.com/etienne-dldc/tumau/blob/master/design/illu-2.png)\n\n\u003c/p\u003e\n\n### For TypeScript users\n\nContexts are typed when you create them:\n\n```ts\nimport { createKey } from 'tumau';\n// here we could omit \u003cnumber\u003e because it would be infered\nconst NumKey = createKey\u003cnumber\u003e(0);\n// you can omit the default value\nconst NameKey = createKey\u003cstring\u003e();\n```\n\n## Middleware\n\nA middleare is a function that:\n\n- receives the context and the `next` function\n- can return a response or null (or a promise of one of them)\n\n```ts\ntype Middleware = (ctx, next) =\u003e null | Response | Promise\u003cnull | Response\u003e;\n```\n\nExample:\n\n```js\nconst myMiddleware = async (ctx, next) =\u003e {\n  // 1. We receive a ctx object\n  console.log(ctx); // { get, getOrFail, has, with }\n  // 2. We call `next` to call the next middleware\n  const response = await next(ctx);\n  // 3. The next middleware return a response\n  console.log(response);\n  // 4. We return that response\n  return response;\n};\n```\n\n### The `next` function\n\nThe `next` function is always async (it return a Promise).\nIt take a context as parameter and return a Promise of a Response or null\n\n```ts\ntype Next = () =\u003e Promise\u003cResponse | null\u003e;\n```\n\n### Some examples\n\n```js\n// Return a response, ignore next middleware\nconst middleware = () =\u003e Response.withText('Hello');\n\n// Return a response if the next middleware did not\nconst middleware = async (ctx, next) =\u003e {\n  const response = await next();\n  if (response === null) {\n    return Response.withText('Not found');\n  }\n  return response;\n};\n\n// Add a item to the context before calling the next middleware\n// return whatever the next middleware return\nconst middleware = (ctx) =\u003e {\n  const nextCtx = ctx.with(ReceivedAtContext.Provide(new Date()));\n  return next(nextCtx);\n};\n```\n\n### Conbining multiple Middlewares\n\nThe `createServer` function take only one middleware as parameter. To use multiple middleware you need to combine them with `compose` :\n\n```js\nimport { createServer, compose } from 'tumau';\n\nconst composed = compose(logger, cors, main);\n\nconst server = createServer(composed);\n```\n\n**Note**: Middlewares are executed in the order they are passed to `compose`. In the example above: `logger`, then `cors`, then `main` (then the reverse order on the way up).\n\n## Performance\n\n\u003e Is it fast ?\n\nI'm no expert in benchmarks but from my attempt to measure it, it's a bit faster than Koa and Express but not as fast as [fastify](https://github.com/fastify/fastify).\n\n## What does \"Tumau\" means\n\n[According to Google Traduction](https://translate.google.com/?source=osdd#view=home\u0026op=translate\u0026sl=en\u0026tl=mi\u0026text=server) it is the translation of \"server\" in Maori but I'm not sure which definition it apply to. Anyway I thought it would make a cool name and it was not used on NPM so...\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fetienne-graveyard%2Ftumau","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fetienne-graveyard%2Ftumau","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fetienne-graveyard%2Ftumau/lists"}