{"_id":"@a_jackie_z/fastify-types","_rev":"3-3ff7bc78a5c9dbb149e7bf5fbd91b63c","name":"@a_jackie_z/fastify-types","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@a_jackie_z/fastify-types","version":"1.0.0","keywords":["fastify","types","schemas","frontend","api","typescript"],"author":{"name":"Sang Lu","email":"connect.with.sang@gmail.com"},"license":"MIT","_id":"@a_jackie_z/fastify-types@1.0.0","maintainers":[{"name":"sanglu","email":"connect.with.sang@gmail.com"}],"homepage":"https://github.com/a-jackie-z/fastify-types#readme","bugs":{"url":"https://github.com/a-jackie-z/fastify-types/issues"},"dist":{"shasum":"d97139b3f5fa81066bcd372e9e2bf3c1c0569966","tarball":"https://registry.npmjs.org/@a_jackie_z/fastify-types/-/fastify-types-1.0.0.tgz","fileCount":6,"integrity":"sha512-K2AeisOAp6cMCBsWtG0ljxvdYh+vjOBYc0RN4DxF2i3Q5Ph/WG2qYZJfEQHoBzqIQbOyna2Erlxj6DZNMem+gA==","signatures":[{"sig":"MEUCIQD1BNv+o/GyBsJw7GRrHm/jfWeEkEgVO0cPzsaJf9ifFwIgEagAPFK0c6sYRgnAPvz553uPuBcm53AmeyYQD4YNp7U=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17539},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsup"},"_npmUser":{"name":"sanglu","email":"connect.with.sang@gmail.com"},"repository":{"url":"git+https://github.com/a-jackie-z/fastify-types.git"},"_npmVersion":"11.6.2","description":"Type definitions and schemas for Fastify API contracts - frontend compatible","directories":{},"_nodeVersion":"24.13.0","dependencies":{"zod":"^4.3.6"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","typescript":"^5.9.3","@types/node":"^25.2.1"},"_npmOperationalInternal":{"tmp":"tmp/fastify-types_1.0.0_1770391744126_0.6850883939060604","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@a_jackie_z/fastify-types","version":"1.0.1","keywords":["fastify","types","schemas","frontend","api","typescript"],"author":{"name":"Sang Lu","email":"connect.with.sang@gmail.com"},"license":"MIT","_id":"@a_jackie_z/fastify-types@1.0.1","maintainers":[{"name":"sanglu","email":"connect.with.sang@gmail.com"}],"homepage":"https://github.com/a-jackie-z/fastify-types#readme","bugs":{"url":"https://github.com/a-jackie-z/fastify-types/issues"},"dist":{"shasum":"667ab0f10c3acb674e39b9e04253f124efdc84a7","tarball":"https://registry.npmjs.org/@a_jackie_z/fastify-types/-/fastify-types-1.0.1.tgz","fileCount":6,"integrity":"sha512-L1x3oJIByGkhQHhuqc+Yy9Z2lRDvY/Jl8ztAiKwDmkodDVEUbvygCsw43i7/ui52rBySvK2MgMTqhWX3h20QNQ==","signatures":[{"sig":"MEUCICkkF88Fn391Om/jyMIni6t0oFdmCds+dZ7psIn6pQ5eAiEAwiYhPR4LvSthfXR2oeoV6/bZo+xOla6WH9uzMx10eyw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17539},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"8e8bcfca9fa284dce7fc71f5175bca23850d2483","scripts":{"build":"tsup"},"_npmUser":{"name":"sanglu","email":"connect.with.sang@gmail.com"},"repository":{"url":"git+https://github.com/a-jackie-z/fastify-types.git"},"_npmVersion":"11.6.2","description":"Type definitions and schemas for Fastify API contracts - frontend compatible","directories":{},"_nodeVersion":"24.13.0","dependencies":{"zod":"^4.3.6"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.5.1","typescript":"^5.9.3","@types/node":"^25.2.1"},"_npmOperationalInternal":{"tmp":"tmp/fastify-types_1.0.1_1770632596283_0.35256677540429915","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@a_jackie_z/fastify-types","version":"1.0.2","description":"Type definitions and schemas for Fastify API contracts - frontend compatible","license":"MIT","author":{"name":"Sang Lu","email":"connect.with.sang@gmail.com"},"repository":{"url":"git+https://github.com/a-jackie-z/fastify-types.git"},"type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsup"},"dependencies":{"zod":"^4.3.6"},"devDependencies":{"@types/node":"^25.5.0","tsup":"^8.5.1","typescript":"^6.0.2"},"keywords":["fastify","types","schemas","frontend","api","typescript"],"gitHead":"127d2786bfd16f2cb0fa80ce7235758f257aa1ad","_id":"@a_jackie_z/fastify-types@1.0.2","bugs":{"url":"https://github.com/a-jackie-z/fastify-types/issues"},"homepage":"https://github.com/a-jackie-z/fastify-types#readme","_nodeVersion":"24.13.1","_npmVersion":"11.8.0","dist":{"integrity":"sha512-+lpchuAHRZMftbvvgPPB7PyNaV2YEtOQGQkJ8P4pZSxEVXUfmXV2avusjLfRy3g+as0mdOQZYclyT7rQD+Qv+g==","shasum":"2b9072bab09f0b12c506be21a232cb984fec3b6f","tarball":"https://registry.npmjs.org/@a_jackie_z/fastify-types/-/fastify-types-1.0.2.tgz","fileCount":6,"unpackedSize":17539,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCiSU/VUdB8d8zNbjt6qqZB0dTZEpKoa5T5cj/ifB+QCwIgfMLZq9/uz6yLfMBZ4fSxTubgiaUFl1H3XU5japQZEbE="}]},"_npmUser":{"name":"sanglu","email":"connect.with.sang@gmail.com"},"directories":{},"maintainers":[{"name":"sanglu","email":"connect.with.sang@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/fastify-types_1.0.2_1774347351829_0.8699138194675569"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-06T15:29:04.062Z","modified":"2026-03-24T10:15:52.097Z","1.0.0":"2026-02-06T15:29:04.290Z","1.0.1":"2026-02-09T10:23:16.450Z","1.0.2":"2026-03-24T10:15:51.970Z"},"bugs":{"url":"https://github.com/a-jackie-z/fastify-types/issues"},"author":{"name":"Sang Lu","email":"connect.with.sang@gmail.com"},"license":"MIT","homepage":"https://github.com/a-jackie-z/fastify-types#readme","keywords":["fastify","types","schemas","frontend","api","typescript"],"repository":{"url":"git+https://github.com/a-jackie-z/fastify-types.git"},"description":"Type definitions and schemas for Fastify API contracts - frontend compatible","maintainers":[{"name":"sanglu","email":"connect.with.sang@gmail.com"}],"readme":"# @a_jackie_z/fastify-types\n\nFrontend-compatible type definitions and schemas for Fastify API contracts. This package provides essential types, response schemas, and utilities that can be safely imported in React applications and other frontend environments.\n\n## Installation\n\n```bash\nnpm install @a_jackie_z/fastify-types\n```\n\n## Features\n\n- ✅ **Frontend Compatible**: No Node.js dependencies - works in browsers and React apps\n- ✅ **TypeScript Support**: Full TypeScript definitions included\n- ✅ **Zod Integration**: Response schemas compatible with Zod validation\n- ✅ **Tree Shakeable**: Import only what you need\n\n## Exports\n\n### Response Types\n\n```typescript\nimport { \n  SuccessResponse, \n  ErrorResponse, \n  ValidationDetail,\n  formatSuccess,\n  formatError,\n  successResponseSchema,\n  errorResponseSchema\n} from '@a_jackie_z/fastify-types'\n\n// Type-safe response handling\nconst response: SuccessResponse<{ message: string }> = formatSuccess(200, { \n  message: 'Hello World' \n})\n\n// Zod schema validation\nconst UserResponseSchema = successResponseSchema(z.object({\n  id: z.string(),\n  username: z.string()\n}))\n```\n\n### JWT Types\n\n```typescript\nimport { \n  TokenTypeConfig, \n  JwtAlgorithm,\n  SignTokenOptions,\n  VerifyTokenOptions,\n  parseJwtSecrets\n} from '@a_jackie_z/fastify-types'\n\n// JWT configuration\nconst tokenConfig: TokenTypeConfig = {\n  headerName: 'authorization',\n  expiresIn: '15m',\n  algorithm: 'HS256',\n  iss: 'my-service'\n}\n\n// Parse secrets from environment\nconst secrets = parseJwtSecrets('key1=secret1|key2=secret2')\n```\n\n### Error Handling\n\n```typescript\nimport { \n  createError, \n  HTTP_STATUS_CODES,\n  HttpStatusCode \n} from '@a_jackie_z/fastify-types'\n\n// Create client-side errors with status codes\nconst error = createError({\n  statusCode: HTTP_STATUS_CODES.NOT_FOUND,\n  message: 'User not found'\n})\n```\n\n## Differences from @a_jackie_z/fastify\n\nThis package is a frontend-compatible subset of the main `@a_jackie_z/fastify` package:\n\n**✅ Included:**\n- Response types and formatters\n- JWT configuration types\n- Error types and utilities\n- Zod schemas for API contracts\n\n**❌ Excluded:**\n- Fastify server instances and plugins\n- JWT signing/verification functions\n- Node.js crypto utilities\n- Server-specific middleware\n\n## Usage with React\n\n```typescript\n// api/types.ts\nimport type { SuccessResponse, ErrorResponse } from '@a_jackie_z/fastify-types'\n\nexport type UserApiResponse = SuccessResponse<{\n  id: string\n  username: string\n  email: string\n}>\n\n// hooks/useApi.ts\nimport { successResponseSchema, errorResponseSchema } from '@a_jackie_z/fastify-types'\n\nconst UserSchema = successResponseSchema(z.object({\n  id: z.string(),\n  username: z.string(),\n  email: z.string().email()\n}))\n\n// Type-safe API response validation\nconst response = UserSchema.parse(await fetch('/api/users').then(r => r.json()))\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}