{"_id":"@adhikariprivate/nasgi","_rev":"3-7be8f69d8d7fe27fcb18420344fe1e55","name":"@adhikariprivate/nasgi","dist-tags":{"latest":"2.0.2"},"versions":{"2.0.0":{"name":"@adhikariprivate/nasgi","version":"2.0.0","license":"MIT","_id":"@adhikariprivate/nasgi@2.0.0","maintainers":[{"name":"ersauravadhikari","email":"ErSauravAdhikari@gmail.com"}],"homepage":"https://github.com/adhikariprivate/nasgi#readme","bugs":{"url":"https://github.com/adhikariprivate/nasgi/issues"},"dist":{"shasum":"456ba1bcd3b57c346deb218d9851668f1b8438c3","tarball":"https://registry.npmjs.org/@adhikariprivate/nasgi/-/nasgi-2.0.0.tgz","fileCount":8,"integrity":"sha512-uE5jzAM4TXb7v26wB+OZxbuYCYsDNK9K8sOFq9TwsZJ36tujzrKiiP+ouz1VsuN9xUzi3mkbK7RrOVGV/PVtPQ==","signatures":[{"sig":"MEQCIBhpqoyLui0kucG5l2NlNhjJfvHzj07lEptJaiWFBVXyAiBHbUmi7QD/xJo8gkeDZIlQg98XAELK6ScWSbVHS/JyjQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":91963},"main":"index.js","napi":{"targets":["x86_64-unknown-linux-gnu"],"binaryName":"python-node"},"types":"index.d.ts","engines":{"node":">= 20"},"scripts":{"lint":"oxlint","test":"node --test test/**.test.mjs","build":"npm run build:debug -- --release","version":"napi version","artifacts":"napi artifacts","universal":"napi universal","build:wasm":"rustup target add wasm32-wasip1 && cargo build --package fix-python-soname --target wasm32-wasip1 --release && cp target/wasm32-wasip1/release/fix-python-soname.wasm .","build:debug":"napi build --platform --features napi-support","prepublishOnly":"npm run build:wasm && napi prepublish -t npm"},"_npmUser":{"name":"ersauravadhikari","email":"ErSauravAdhikari@gmail.com"},"repository":{"url":"git+https://github.com/adhikariprivate/nasgi.git","type":"git"},"_npmVersion":"11.13.0","description":"Run ASGI-compatible Python applications in Node.js","directories":{},"_nodeVersion":"24.16.0","publishConfig":{"scope":"@adhikariprivate","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"oxlint":"^0.18.0","@napi-rs/cli":"^3.0.4","@oxc-node/core":"^0.1.0"},"optionalDependencies":{"@adhikariprivate/nasgi-linux-x64-gnu":"2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nasgi_2.0.0_1785168286738_0.7185798649767401","host":"s3://npm-registry-packages-npm-production"}},"2.0.1":{"name":"@adhikariprivate/nasgi","version":"2.0.1","license":"MIT","_id":"@adhikariprivate/nasgi@2.0.1","maintainers":[{"name":"ersauravadhikari","email":"ErSauravAdhikari@gmail.com"}],"homepage":"https://github.com/adhikariprivate/nasgi#readme","bugs":{"url":"https://github.com/adhikariprivate/nasgi/issues"},"dist":{"shasum":"4b350ed29998f86d38da68ab7614b240f86ff3e3","tarball":"https://registry.npmjs.org/@adhikariprivate/nasgi/-/nasgi-2.0.1.tgz","fileCount":8,"integrity":"sha512-PW+Hk0u+ay3R2+Y10nKty+wMx/RFAkhgI1Nr65xW8yW/j0Ti5WsXp+jkkwTMXHVywDubtHYjglAjPybOlIxbww==","signatures":[{"sig":"MEUCIDF/So96rONys1ljeo2lSOfg5b+NKUYjFV7NF25GFv+5AiEA7cKeNYB1yHM4lYKCKVJx2fRlvT/dxY4yHO8+aHVroG0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":91987},"main":"index.js","napi":{"targets":["x86_64-unknown-linux-gnu"],"binaryName":"python-node"},"types":"index.d.ts","engines":{"node":">= 20"},"scripts":{"lint":"oxlint","test":"node --test test/**.test.mjs","build":"npm run build:debug -- --release","version":"napi version","artifacts":"napi artifacts","universal":"napi universal","build:wasm":"rustup target add wasm32-wasip1 && cargo build --package fix-python-soname --target wasm32-wasip1 --release && cp target/wasm32-wasip1/release/fix-python-soname.wasm .","build:debug":"napi build --platform --features napi-support","prepublishOnly":"npm run build:wasm && napi prepublish -t npm"},"_npmUser":{"name":"ersauravadhikari","email":"ErSauravAdhikari@gmail.com"},"repository":{"url":"git+https://github.com/adhikariprivate/nasgi.git","type":"git"},"_npmVersion":"11.13.0","description":"Run ASGI-compatible Python applications in Node.js","directories":{},"_nodeVersion":"24.16.0","publishConfig":{"scope":"@adhikariprivate","access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"oxlint":"^0.18.0","@napi-rs/cli":"^3.0.4","@oxc-node/core":"^0.1.0"},"optionalDependencies":{"@adhikariprivate/nasgi-linux-x64-gnu":"2.0.1"},"_npmOperationalInternal":{"tmp":"tmp/nasgi_2.0.1_1785168929837_0.9711935036494892","host":"s3://npm-registry-packages-npm-production"}},"2.0.2":{"name":"@adhikariprivate/nasgi","description":"Run ASGI-compatible Python applications in Node.js","version":"2.0.2","main":"index.js","types":"index.d.ts","repository":{"type":"git","url":"git+https://github.com/adhikariprivate/nasgi.git"},"napi":{"binaryName":"python-node","targets":["x86_64-unknown-linux-gnu"]},"publishConfig":{"registry":"https://registry.npmjs.org/","scope":"@adhikariprivate","access":"public"},"license":"MIT","devDependencies":{"@napi-rs/cli":"^3.0.4","@oxc-node/core":"^0.1.0","oxlint":"^0.18.0"},"engines":{"node":">= 20"},"scripts":{"artifacts":"napi artifacts","build":"npm run build:debug -- --release","build:debug":"napi build --platform --features napi-support","build:wasm":"rustup target add wasm32-wasip1 && cargo build --package fix-python-soname --target wasm32-wasip1 --release && cp target/wasm32-wasip1/release/fix-python-soname.wasm .","prepublishOnly":"npm run build:wasm && napi prepublish -t npm","lint":"oxlint","test":"node --test test/**.test.mjs","universal":"napi universal","version":"napi version"},"optionalDependencies":{"@adhikariprivate/nasgi-linux-x64-gnu":"2.0.2"},"_id":"@adhikariprivate/nasgi@2.0.2","bugs":{"url":"https://github.com/adhikariprivate/nasgi/issues"},"homepage":"https://github.com/adhikariprivate/nasgi#readme","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-0Xxf6sq+gh+5sNbgswE72pq9XWtXoIk35BtMdU6ScVfXwUMEJbW9sFPSXcenOExBp0tD6KI2Aa60j+8gCMURHg==","shasum":"e9f32969b4669332647d1d00ecab74e26ba98cb9","tarball":"https://registry.npmjs.org/@adhikariprivate/nasgi/-/nasgi-2.0.2.tgz","fileCount":8,"unpackedSize":91987,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCOQqPOHZ17l/QYGBMbQWKxm4lNEqOiRn68+PD8Dmo9IAIgNTPIY4c5Tu+uaVWX3CDwHoyXwWU+Jgt3JSX5n4rNJcA="}]},"_npmUser":{"name":"ersauravadhikari","email":"ErSauravAdhikari@gmail.com"},"directories":{},"maintainers":[{"name":"ersauravadhikari","email":"ErSauravAdhikari@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nasgi_2.0.2_1785175034810_0.178309362733013"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-27T16:04:46.611Z","modified":"2026-07-27T17:57:15.213Z","2.0.0":"2026-07-27T16:04:46.865Z","2.0.1":"2026-07-27T16:15:29.971Z","2.0.2":"2026-07-27T17:57:14.966Z"},"bugs":{"url":"https://github.com/adhikariprivate/nasgi/issues"},"license":"MIT","homepage":"https://github.com/adhikariprivate/nasgi#readme","repository":{"type":"git","url":"git+https://github.com/adhikariprivate/nasgi.git"},"description":"Run ASGI-compatible Python applications in Node.js","maintainers":[{"name":"ersauravadhikari","email":"ErSauravAdhikari@gmail.com"}],"readme":"# NASGI\n\nNASGI is a Node.js native addon for running Python ASGI applications inside a Node.js process. It connects JavaScript, Rust, and Python without an HTTP hop and supports HTTP, streaming responses, and WebSockets.\n\n## Features\n\n- ASGI 3 applications, including FastAPI, Starlette, and other ASGI frameworks\n- Async and synchronous HTTP request handling\n- Streaming request and response bodies\n- WebSocket connections with text and binary messages\n- Python virtual-environment support\n- Native Rust implementation with prebuilt platform packages\n\n## Requirements\n\n- Node.js 20 or newer\n- Python 3.8 or newer\n- A supported native target: Linux x64 (glibc) or macOS ARM64\n\nThe Python application dependencies must be installed in a virtual environment. Set `VIRTUAL_ENV` to that environment before starting Node.js.\n\n## Installation\n\n```bash\nnpm install @adhikariprivate/nasgi\n```\n\nWhen installing from source instead of npm:\n\n```bash\ngit clone https://github.com/adhikariprivate/nasgi.git\ncd nasgi\npnpm install --no-frozen-lockfile\npnpm run build\n```\n\nInstall dependencies for the Python application separately, for example:\n\n```bash\npython3 -m venv .venv\n.venv/bin/pip install fastapi\nexport VIRTUAL_ENV=\"$PWD/.venv\"\n```\n\nDo not install with `--ignore-scripts`; the native platform package may need its post-install setup for the host Python runtime.\n\n## HTTP example\n\nCreate an ASGI application such as `app.py`:\n\n```python\nasync def app(scope, receive, send):\n    await receive()\n\n    await send({\n        \"type\": \"http.response.start\",\n        \"status\": 200,\n        \"headers\": [[b\"content-type\", b\"text/plain\"]],\n    })\n    await send({\n        \"type\": \"http.response.body\",\n        \"body\": b\"Hello from Python!\",\n        \"more_body\": False,\n    })\n```\n\nCall it from Node.js:\n\n```js\nimport { Python, Request } from '@adhikariprivate/nasgi'\n\nconst python = new Python({\n  docroot: process.cwd(),\n  appTarget: 'app:app'\n})\n\nconst response = await python.handleRequest(new Request({\n  method: 'GET',\n  url: '/hello'\n}))\n\nconsole.log(response.status) // 200\nconsole.log(response.body.toString()) // Hello from Python!\n```\n\nUse `handleRequestSync()` when a synchronous API is required. For streaming responses and WebSockets, use `handleStream()`; set `websocket: true` on the request and exchange data with `request.write()`, `response.next()`, and `request.end()`.\n\n## Documentation\n\nSee [REFERENCE.md](./REFERENCE.md) for the complete JavaScript API and examples.\n\n## Production notes\n\nInstall the package on the target machine or in the production image, use a pinned package version, and verify the host OS, architecture, libc, Node.js, and Python versions. Keep the Python virtual environment and its dependencies versioned with the application.\n\n## Disclaimer\n\nNASGI is intended primarily for private and internal use. It is provided as-is, without warranties or guarantees. Use it at your own risk, test it thoroughly in your environment, and review the source and dependencies before relying on it in production.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}