{"_id":"@alyvro/nexus","_rev":"3-55043b4b7fd8497c42546a1f04d326e8","name":"@alyvro/nexus","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@alyvro/nexus","version":"1.0.0","keywords":[],"author":"","license":"ISC","_id":"@alyvro/nexus@1.0.0","maintainers":[{"name":"this_nima","email":"nimastrong852@gmail.com"}],"dist":{"shasum":"7236a863504db0fe725629a61e48921a8868c323","tarball":"https://registry.npmjs.org/@alyvro/nexus/-/nexus-1.0.0.tgz","fileCount":23,"integrity":"sha512-LY3ujZD//2WToiGEdYiBdwr6twcSWdB32E8X74wcU7alTss/r5VeF+eatlX5xxM7CGLkINUl0/FobMI0bxuS/g==","signatures":[{"sig":"MEUCIQCat7w01y76VOMaSz4aJOHr5scDdLmxb3NasLaF41vXvgIgEvcIyNIgHt3OJGQIsxrVeW/d8YQ5YF/z4Zf9X3WCXwM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":28863},"type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./client":{"types":"./dist/client/index.d.ts","import":"./dist/client/index.js"},"./server":{"types":"./dist/server/index.d.ts","import":"./dist/server/index.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","prebuild":"pnpm type-check","test:watch":"vitest","type-check":"tsc --noEmit"},"_npmUser":{"name":"this_nima","email":"nimastrong852@gmail.com"},"licenses":[{"url":"https://github.com/Alyvro/nexus","type":"git"}],"_npmVersion":"10.9.2","description":"Type-safe bridge for Next.js Server Actions with Zod validation.","directories":{},"_nodeVersion":"22.17.1","_hasShrinkwrap":false,"packageManager":"pnpm@10.11.1","devDependencies":{"zod":"^3.22.0","tsup":"^8.0.0","jsdom":"^24.0.0","react":"18.3.1","vitest":"^1.0.0","react-dom":"18.3.1","typescript":"^5.0.0","@types/node":"^20.0.0","@types/react":"^18.3.1","@types/react-dom":"^18.3.0","@testing-library/react":"^14.1.2","@testing-library/jest-dom":"^6.0.0"},"peerDependencies":{"zod":"^3.22.0","react":"^18.3.1","react-dom":"^18.3.1"},"_npmOperationalInternal":{"tmp":"tmp/nexus_1.0.0_1770905092157_0.9151646460232181","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@alyvro/nexus","version":"1.0.1","keywords":[],"author":"","license":"ISC","_id":"@alyvro/nexus@1.0.1","maintainers":[{"name":"this_nima","email":"nimastrong852@gmail.com"}],"dist":{"shasum":"9d757e56cbb179b30846919233d585572a62e63e","tarball":"https://registry.npmjs.org/@alyvro/nexus/-/nexus-1.0.1.tgz","fileCount":23,"integrity":"sha512-MJ2E86QX9mkDrgKQ+Ela0efPRJOuXcvzrXrsyn2DeHjSjWf79OVSzrfX/klrvmGWJPejD2rR0ktFr/G6KPEHuQ==","signatures":[{"sig":"MEYCIQDXiYosH4EvRScNtNnpQrQLUGsQCZ1Ke2s07jQZ1OcCLwIhANmzbHEmbkuVDHRsc1Am8++uMDrvBvTZb/Ni3PkGo2Or","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":28898},"type":"module","_from":"file:alyvro-nexus-1.0.1.tgz","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./client":{"types":"./dist/client/index.d.ts","import":"./dist/client/index.js"},"./server":{"types":"./dist/server/index.d.ts","import":"./dist/server/index.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","prebuild":"pnpm type-check","test:watch":"vitest","type-check":"tsc --noEmit"},"_npmUser":{"name":"this_nima","email":"nimastrong852@gmail.com"},"licenses":[{"url":"https://github.com/Alyvro/nexus","type":"git"}],"_resolved":"C:\\Users\\nimas\\AppData\\Local\\Temp\\56ac0062f1446c71e944b570020fbb44\\alyvro-nexus-1.0.1.tgz","_integrity":"sha512-MJ2E86QX9mkDrgKQ+Ela0efPRJOuXcvzrXrsyn2DeHjSjWf79OVSzrfX/klrvmGWJPejD2rR0ktFr/G6KPEHuQ==","_npmVersion":"10.9.2","description":"Type-safe bridge for Next.js Server Actions with Zod validation.","directories":{},"_nodeVersion":"22.17.1","_hasShrinkwrap":false,"devDependencies":{"zod":"^3.22.0","tsup":"^8.0.0","jsdom":"^24.0.0","react":"18.3.1","vitest":"^1.0.0","react-dom":"18.3.1","typescript":"^5.0.0","@types/node":"^20.0.0","@types/react":"^18.3.1","@types/react-dom":"^18.3.0","@testing-library/react":"^14.1.2","@testing-library/jest-dom":"^6.0.0"},"peerDependencies":{"zod":"^3.22.0","react":"^18.3.1","react-dom":"^18.3.1"},"_npmOperationalInternal":{"tmp":"tmp/nexus_1.0.1_1770905599820_0.41733734468465045","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@alyvro/nexus","version":"1.0.2","description":"Type-safe bridge for Next.js Server Actions with Zod validation.","type":"module","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"},"./client":{"import":"./dist/client/index.js","types":"./dist/client/index.d.ts"},"./server":{"import":"./dist/server/index.js","types":"./dist/server/index.d.ts"}},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/alyvro/nexus.git"},"keywords":[],"author":"","peerDependencies":{"react":"^18.3.1","react-dom":"^18.3.1","zod":"^3.22.0"},"devDependencies":{"@testing-library/react":"^14.1.2","@testing-library/jest-dom":"^6.0.0","@types/node":"^20.0.0","@types/react":"^18.3.1","@types/react-dom":"^18.3.0","jsdom":"^24.0.0","react":"18.3.1","react-dom":"18.3.1","tsup":"^8.0.0","typescript":"^5.0.0","vitest":"^1.0.0","zod":"^3.22.0"},"scripts":{"test":"vitest run","test:watch":"vitest","build":"tsup","dev":"tsup --watch","type-check":"tsc --noEmit","prebuild":"pnpm type-check"},"_id":"@alyvro/nexus@1.0.2","bugs":{"url":"https://github.com/alyvro/nexus/issues"},"homepage":"https://github.com/alyvro/nexus#readme","_integrity":"sha512-w6FNDPesXvT2z8qQW8qDExIbfijCWX3nQ0xtsyN0YFsC6LE9ikxInBG2qX9iwXaf3n6y919RJGbmxdhVIoJ/pg==","_resolved":"C:\\Users\\nimas\\AppData\\Local\\Temp\\d441842762bafaf5dafef0e0e24f76ce\\alyvro-nexus-1.0.2.tgz","_from":"file:alyvro-nexus-1.0.2.tgz","_nodeVersion":"22.17.1","_npmVersion":"10.9.2","dist":{"integrity":"sha512-w6FNDPesXvT2z8qQW8qDExIbfijCWX3nQ0xtsyN0YFsC6LE9ikxInBG2qX9iwXaf3n6y919RJGbmxdhVIoJ/pg==","shasum":"815b0721908cc3448107f37be113e9eab48d4c5c","tarball":"https://registry.npmjs.org/@alyvro/nexus/-/nexus-1.0.2.tgz","fileCount":23,"unpackedSize":28884,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDhD97e+dQznaTjw5XY14oiyfbKFtMITRMS2JUgELG+BQIhAKtzcStogHaUkZ+vG9ApZ2b35Lx2NZzja0p2dqYeG91V"}]},"_npmUser":{"name":"this_nima","email":"nimastrong852@gmail.com"},"directories":{},"maintainers":[{"name":"this_nima","email":"nimastrong852@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/nexus_1.0.2_1770974390816_0.2712472029402948"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-12T14:04:52.025Z","modified":"2026-02-13T09:19:51.174Z","1.0.0":"2026-02-12T14:04:52.309Z","1.0.1":"2026-02-12T14:13:19.968Z","1.0.2":"2026-02-13T09:19:51.018Z"},"license":"MIT","keywords":[],"description":"Type-safe bridge for Next.js Server Actions with Zod validation.","maintainers":[{"name":"this_nima","email":"nimastrong852@gmail.com"}],"readme":"# @alyvro/nexus 🚀\r\n\r\nThe ultimate type-safe bridge between **Next.js Server Actions** and **Client Components**.\r\nStandardize your data flow, handle validations with Zod, and manage loading/error states effortlessly.\r\n\r\n## ✨ Features\r\n\r\n- **Zero-Config Type Safety**: Automatic TypeScript inference from Server to Client.\r\n- **Zod Integration**: First-class support for input validation.\r\n- **Smart Transitions**: Uses React's `useTransition` under the hood for a smooth UX.\r\n- **Error Handling**: Distinct handling for validation errors and server exceptions.\r\n- **Lightweight**: Zero bloat, designed specifically for Next.js App Router.\r\n\r\n---\r\n\r\n## 📦 Installation\r\n\r\n```bash\r\npnpm add @alyvro/nexus zod\r\n```\r\n\r\n## 🚀 Quick Start\r\n\r\n### 1. Define a Server Action\r\n\r\nCreate a file (e.g., actions.ts) and use createNexusAction.\r\n\r\n```typescript\r\n// actions.ts\r\n\"use server\";\r\nimport { createNexusAction } from \"@alyvro/nexus/server\";\r\nimport { z } from \"zod\";\r\n\r\nconst Schema = z.object({\r\n  email: z.string().email(\"Invalid email address\"),\r\n});\r\n\r\nexport const subscribeUser = createNexusAction(Schema, async (data) => {\r\n  // Simulate DB delay\r\n  await new Promise((res) => setTimeout(res, 1000));\r\n\r\n  return { id: \"123\", message: `Subscribed: ${data.email}` };\r\n});\r\n```\r\n\r\n### 2. Use in Client Component\r\n\r\nUse the useNexus hook to trigger the action and track its state.\r\n\r\n```typescript\r\n// FormComponent.tsx\r\n\"use client\";\r\nimport { useNexus } from \"@alyvro/nexus/client\";\r\nimport { subscribeUser } from \"./actions\";\r\n\r\nexport default function SubscribeForm() {\r\n  const { execute, data, isLoading, error, validationErrors } = useNexus(subscribeUser);\r\n\r\n  return (\r\n    <div>\r\n      <button onClick={() => execute({ email: \"hello@alyvro.com\" })} disabled={isLoading}>\r\n        {isLoading ? \"Loading...\" : \"Subscribe\"}\r\n      </button>\r\n\r\n      {data && <p className=\"text-green-500\">{data.message}</p>}\r\n      {error && <p className=\"text-red-500\">{error}</p>}\r\n      {validationErrors?.email && <p className=\"text-orange-500\">{validationErrors.email[0]}</p>}\r\n    </div>\r\n  );\r\n}\r\n```\r\n\r\n---\r\n\r\n## 🛠 API Reference\r\n\r\n`createNexusAction(schema, handler)`\r\n\r\n- schema: A Zod schema.\r\n- handler: Your async logic. Receives validated data.\r\n\r\n`useNexus(action, options?)`\r\n\r\nReturns:\r\n\r\n- execute(input): Function to trigger the action.\r\n- data: The result of the action.\r\n- isLoading: Boolean (uses useTransition).\r\n- error: Generic server error message.\r\n- validationErrors: Field-specific errors from Zod.\r\n- reset(): Clear all states.\r\n\r\n---\r\n\r\n## 🛡 License\r\n\r\nMIT © [Alyvro](https://github.com/Alyvro)\r\n","readmeFilename":"README.md","homepage":"https://github.com/alyvro/nexus#readme","repository":{"type":"git","url":"git+https://github.com/alyvro/nexus.git"},"bugs":{"url":"https://github.com/alyvro/nexus/issues"}}