{"_id":"@bwcroft/octane","_rev":"3-0b924627d237f3cdd3790fb7e1e56a95","name":"@bwcroft/octane","dist-tags":{"latest":"0.3.0"},"versions":{"0.1.0":{"name":"@bwcroft/octane","version":"0.1.0","author":{"name":"Brenden Croft"},"license":"MIT","_id":"@bwcroft/octane@0.1.0","maintainers":[{"name":"bwcroft","email":"brenden848@gmail.com"}],"homepage":"https://github.com/bwcroft/octane#readme","bugs":{"url":"https://github.com/bwcroft/octane/issues"},"dist":{"shasum":"4ce1f8884252608cac52dee4358fc989704b2a09","tarball":"https://registry.npmjs.org/@bwcroft/octane/-/octane-0.1.0.tgz","fileCount":18,"integrity":"sha512-PF/86PcN5ti6UGPhpCU2RVWSwfaYdTIRSDY+PNzGhxnXO0GGQvWz955A4vj9vnfwyL5s6k1EnzYoxGIA3KCSgQ==","signatures":[{"sig":"MEUCIFPGUJvP2OE2h7zyOdvcGG6HqxpOi80CzjIah7jUTutVAiEAq9SlLVYLRKxg82wQ+NpkMmakirA9LDxgqccWGoS2jWQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":28970},"main":"./dist/index.js","type":"module","_from":"file:bwcroft-octane-0.1.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"_npmUser":{"name":"bwcroft","email":"brenden848@gmail.com"},"_resolved":"/private/var/folders/ss/s0lkrf5x0n1frkq7wpwwp_3m0000gn/T/f4908c53acd3b36bef487a2de7a80a0a/bwcroft-octane-0.1.0.tgz","_integrity":"sha512-PF/86PcN5ti6UGPhpCU2RVWSwfaYdTIRSDY+PNzGhxnXO0GGQvWz955A4vj9vnfwyL5s6k1EnzYoxGIA3KCSgQ==","repository":{"url":"git+https://github.com/bwcroft/octane.git","type":"git"},"_npmVersion":"11.4.2","description":"<div align=\"center\">    <img src=\"https://raw.githubusercontent.com/bwcroft/nodejs-toolkit/refs/heads/main/packages/octane/images/octane-logo-round-250x250.png\"> </div> <br>","directories":{},"_nodeVersion":"24.4.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/octane_0.1.0_1755670592768_0.21630138152136658","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@bwcroft/octane","version":"0.2.0","author":{"name":"Brenden Croft"},"license":"MIT","_id":"@bwcroft/octane@0.2.0","maintainers":[{"name":"bwcroft","email":"brenden848@gmail.com"}],"homepage":"https://github.com/bwcroft/octane#readme","bugs":{"url":"https://github.com/bwcroft/octane/issues"},"dist":{"shasum":"344df9c62078eee825d3359ce7982c72854adcad","tarball":"https://registry.npmjs.org/@bwcroft/octane/-/octane-0.2.0.tgz","fileCount":17,"integrity":"sha512-68IXn8NNzJP8qJENJGqa/zhhzyptM7b+xXJ1kK3NWuYMonp8Un4s7jZWdZXopGfa0FccgFEhZXF9+GqrTedMog==","signatures":[{"sig":"MEUCIC5ayEp4gUHcVphJQ0FNjlCE01DDjpTYKzDBN1+y6/tfAiEArzJRlYgxbMUqewOyBrzwqOeM3ZG4xehjlHYw6SZ9nrQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":28837},"main":"./dist/index.js","type":"module","_from":"file:bwcroft-octane-0.2.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"_npmUser":{"name":"bwcroft","email":"brenden848@gmail.com"},"_resolved":"/private/var/folders/ss/s0lkrf5x0n1frkq7wpwwp_3m0000gn/T/26c0b69b4bda84cd1485a52bcff91833/bwcroft-octane-0.2.0.tgz","_integrity":"sha512-68IXn8NNzJP8qJENJGqa/zhhzyptM7b+xXJ1kK3NWuYMonp8Un4s7jZWdZXopGfa0FccgFEhZXF9+GqrTedMog==","repository":{"url":"git+https://github.com/bwcroft/octane.git","type":"git"},"_npmVersion":"11.4.2","description":"<div align=\"center\">    <img src=\"https://raw.githubusercontent.com/bwcroft/nodejs-toolkit/refs/heads/main/packages/octane/images/octane-logo-round-250x250.png\"> </div> <br>","directories":{},"_nodeVersion":"24.4.1","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/octane_0.2.0_1756190053519_0.2760436066210512","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@bwcroft/octane","description":"A fast, modern Node.js web framework — a lightweight alternative to Express and Fastify.","version":"0.3.0","homepage":"https://github.com/bwcroft/nodejs-toolkit/tree/main/packages/octane#readme","bugs":{"url":"https://github.com/bwcroft/nodejs-toolkit/issues"},"repository":{"type":"git","url":"git+https://github.com/bwcroft/nodejs-toolkit.git"},"keywords":["octane","nodejs","node","framework","web-framework","http","server","api","rest","express","expressjs","fastify","koa","alternative","backend","middleware","router","typescript","performance","lightweight"],"license":"MIT","author":{"name":"Brenden Croft"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"publishConfig":{"access":"public"},"engines":{"node":">=20"},"packageManager":"pnpm@10.13.1","_id":"@bwcroft/octane@0.3.0","gitHead":"2796d13271db90922a05fd90313fdeb2b8abd236","_nodeVersion":"24.4.1","_npmVersion":"11.4.2","dist":{"integrity":"sha512-kVvdUxYlKzGlCO4jdjGJi1ECWf3WzXrlw7+JWGqLURWTVIT3ZpnpoyPuBtY4b7M8c1M6Me3QWXITiAW33mdRmQ==","shasum":"92d349c293a7f6a70c53364b4986461831c7b2c4","tarball":"https://registry.npmjs.org/@bwcroft/octane/-/octane-0.3.0.tgz","fileCount":20,"unpackedSize":30745,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIGl+yG6ZFskQWBjjs7pBfSFN1HnRUue7kNbkYEslzQoJAiBzIbru8fy4EmV3wMy2sAwCg7ptddCW4Znmn5oszQGXCA=="}]},"_npmUser":{"name":"bwcroft","email":"brenden848@gmail.com"},"directories":{},"maintainers":[{"name":"bwcroft","email":"brenden848@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/octane_0.3.0_1768194014329_0.9154325938721288"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-20T06:16:32.627Z","modified":"2026-01-12T05:00:14.667Z","0.1.0":"2025-08-20T06:16:32.962Z","0.2.0":"2025-08-26T06:34:13.727Z","0.3.0":"2026-01-12T05:00:14.477Z"},"bugs":{"url":"https://github.com/bwcroft/nodejs-toolkit/issues"},"author":{"name":"Brenden Croft"},"license":"MIT","homepage":"https://github.com/bwcroft/nodejs-toolkit/tree/main/packages/octane#readme","repository":{"type":"git","url":"git+https://github.com/bwcroft/nodejs-toolkit.git"},"description":"A fast, modern Node.js web framework — a lightweight alternative to Express and Fastify.","maintainers":[{"name":"bwcroft","email":"brenden848@gmail.com"}],"readme":"<div align=\"center\"> \n  <img src=\"https://raw.githubusercontent.com/bwcroft/nodejs-toolkit/refs/heads/main/packages/octane/images/octane-logo-round-250x250.png\">\n</div>\n<br>\n\n**Octane** is a blazing-fast, lightweight, and fully type-safe routing library for modern JavaScript and TypeScript applications. Designed with performance and simplicity in mind, Octane gives you the power of an expressive API without the overhead of large frameworks.  \n\nWhether you’re building a small API or a large-scale backend service, Octane provides all the essentials you need to define and organize your routes while keeping your application lean and maintainable.  \n\n## Features\n\n- **Ultra-fast routing** – optimized for speed, competitive with Fastify and much faster than Express.  \n- **Lightweight & zero dependencies** – no unnecessary bloat, just pure performance.  \n- **Full TypeScript support** – first-class typings out of the box for safety and great DX.  \n- **Route definitions** – easily register GET, POST, PUT, DELETE, and other routes.  \n- **Route parameters** – capture and work with dynamic path parameters seamlessly.  \n- **Middleware support** – attach per-route or global middleware for request handling.  \n- **Route grouping** – organize related routes with clean, hierarchical grouping.  \n- **Group middleware** – apply middleware at the group level for maximum flexibility.  \n\n## Installation\n\n```bash\nnpm install @bwcroft/octane\n# or\npnpm add @bwcroft/octane\n# or\nyarn add @bwcroft/octane\n```\n\n## Example Usage\n  This snippet demonstrates a basic usage of the Router. It creates a new router instance, defines a GET \n  route at the root path (/) that responds with \"Hello World\", and then starts the server on port 3000,\n  logging the server URL once it’s running. The Router supports all standard HTTP methods, \n  including GET, POST, PUT, PATCH, DELETE, HEAD, and OPTIONS. \n\n```ts\nimport { Router } from '@bwcroft/octane'\n\nconst router = new Router()\n\nrouter.get('/', (req, res) => {\n  res.send('Hello World')\n})\n\nconst port = '3000'\n\nrouter.listen(port, () => {\n  console.log(`Server running on http://localhost:${port}`)\n})\n```\n\n### Route Parameters\n\nRoute parameters let you capture dynamic values directly from the URL path. Parameters are defined by prefixing a segment with \na colon (`:`). These values are automatically extracted and made available on `ctx.params`.  \n\n```ts\nrouter.get(\"/users/:id\", (req, res, ctx) => {\n  res.send({ id: ctx.params?.id })\n}) \n\nrouter.get(\"/users/:id/addresses/:addressId\", (req, res, ctx) => {\n  res.send({ \n    id: ctx.params?.id,\n    addressId: ctx.params?.addressId\n  })\n})\n```\n\n### Query Parameters\n\nQuery parameters (the values after `?` in a URL) are available as a standard `URLSearchParams` object on `ctx.searchParams`. \nThis allows you to easily get, check, or iterate over query parameters.\n\nFor example, for the URL `/users?active=true&sort=asc`:\n\n```ts\nrouter.get(\"/users\", (req, res, ctx) => {\n  const active = ctx.searchParams?.get(\"active\") // get the \"active\" query parameter\n  const sort = ctx.searchParams?.get(\"sort\")     // get the \"sort\" query parameter\n\n  res.send({ \n    active,\n    sort\n  })\n})\n```\n\n### Route Middleware\n\nYou can attach middleware to individual routes using the `middleware` option. The middleware runs only for that specific route.\n\n```ts\nconst authMiddleware = (req, res, ctx, next) => {\n  if (!ctx.user) {\n    return res.unauthorized()\n  }\n  next()\n}\n\nrouter.get(\"/\", (req, res, ctx) => {\n  res.send({ message: \"Hello, authorized user!\" })\n}, { middleware: [authMiddleware] })\n```\n\n### Route Groups\n\nRoute groups allow you to organize multiple routes under a common path prefix.\n\n```ts\nrouter.group(\"/users\", (r) => {\n  r.get(\"/\", (req, res, ctx) => {\n    res.send([])\n  })\n\n  r.get(\"/:id\", (req, res, ctx) => {\n    res.send({ id: ctx.params?.id })\n  })\n})\n```\n\nYou can attach middleware to a route group so that it runs for all routes within the group. In this example, \n`authMiddleware` ensures that only authorized users can access the `/users` routes.\n\n```ts\nconst authMiddleware = (req, res, ctx, next) => {\n  if (!ctx.user) {\n    return res.unauthorized()\n  }\n  next()\n}\n\nrouter.group(\"/users\", [authMiddleware], (r) => {\n  r.get(\"/\", (req, res, ctx) => {\n    res.send({ message: \"List all users\" })\n  })\n\n  r.get(\"/:id\", (req, res, ctx) => {\n    res.send({ userId: ctx.params?.id })\n  })\n})\n```\n\n### HttpResponse Decorators\n\nOctane extends Node's `ServerResponse`, offering convenient helpers for sending responses, managing status codes, setting\ncontent types, and handling common HTTP patterns.\n\n```ts\n// Set the response status code\nres.code(201)\n\n// Set the Content-Type header\nres.type('application/json')\n\n// Send a response body; automatically detects type\nres.send({ message: 'ok' })          // Content-Type: application/json\nres.send('Hello world')              // Content-Type: text/plain\nres.send(Buffer.from('binary data')) // Content-Type: application/octet-stream\n```\n\nSend only a status code with an empty body:\n```ts\nres.code(201).send()\n```\n\nPrevent send() from auto-setting Content-Type:\n```ts\nres.type('text/plain').send({})\n```\n\nSet both status code and Content-Type:\n```ts\nres.code(201).type('text/plain').send()\n```\n\nHandling Redirects:\n```ts\nres.redirect('/login')           // Defaults to status code 301\nres.redirect('/new-page', false) // Sets status code to 302 \n```\n\nConvenience helpers for common status codes:\n```ts\nres.unauthorized()      // 401 Unauthorized\nres.methodNotAllowed()  // 405 Method Not Allowed\nres.notFound()          // 404 Not Found\nres.serverError()       // 500 Internal Server Error\n```\n","readmeFilename":"README.md","keywords":["octane","nodejs","node","framework","web-framework","http","server","api","rest","express","expressjs","fastify","koa","alternative","backend","middleware","router","typescript","performance","lightweight"]}