{"id":38899758,"url":"https://github.com/francisconeves97/remix-form-class-validator","last_synced_at":"2026-01-17T15:01:54.181Z","repository":{"id":57688904,"uuid":"473356376","full_name":"francisconeves97/remix-form-class-validator","owner":"francisconeves97","description":"Simple helper to parse Remix FormData and validate it using class-validator.","archived":false,"fork":false,"pushed_at":"2022-04-03T21:21:59.000Z","size":190,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-14T17:14:44.728Z","etag":null,"topics":["class-validator","form","form-validation","remix","validation"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/francisconeves97.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-23T20:58:17.000Z","updated_at":"2022-04-08T11:41:38.000Z","dependencies_parsed_at":"2022-09-10T12:23:03.613Z","dependency_job_id":null,"html_url":"https://github.com/francisconeves97/remix-form-class-validator","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/francisconeves97/remix-form-class-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francisconeves97%2Fremix-form-class-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francisconeves97%2Fremix-form-class-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francisconeves97%2Fremix-form-class-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francisconeves97%2Fremix-form-class-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/francisconeves97","download_url":"https://codeload.github.com/francisconeves97/remix-form-class-validator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/francisconeves97%2Fremix-form-class-validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28510928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: 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":["class-validator","form","form-validation","remix","validation"],"created_at":"2026-01-17T15:01:53.525Z","updated_at":"2026-01-17T15:01:54.165Z","avatar_url":"https://github.com/francisconeves97.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Remix form class-validator\n\nSimple helper to parse [Remix](https://github.com/remix-run/remix/) `FormData` and validate them using `class-validator`.\n\n## Features\n\n- Server-side `FormData` **parsing and validation** using `class-validator`\n- Provides **typesafe** access to parsed parameters and validation errors\n- Support for arrays and nested attributes\n\n## Usage\n\nStart by defining the DTO class that will hold your parameters, and the respective validations using `class-validator`:\n\n```tsx\nclass PersonDto {\n  @IsNotEmpty()\n  @MinLength(2)\n  name: string;\n  @Min(0)\n  @Max(150)\n  age: number;\n}\n```\n\nDeclare the route action and use `parseRequestParams` to parse and validate your parameters into your declared DTO:\n\n```tsx\nconst action: ActionFunction = async ({ request }) =\u003e {\n  const params = await parseRequestParams(request, PersonDto);\n\n  if (params.errors) {\n    console.log(\"Form data is invalid\", { errors: params.errors });\n  } else {\n    console.log(\"Form data is valid\", { data: params.data });\n  }\n\n  return json(params);\n};\n```\n\nFinally you just need to declare your form and use `useActionData` to access any errors resulting from validating your DTO.\n\n```tsx\ntype ActionData = ParseRequestParamsReturn\u003cPersonDto\u003e;\n\nconst SimpleForm = () =\u003e {\n  const actionData = useActionData\u003cActionData\u003e();\n\n  return (\n    \u003cForm style={{ maxWidth: 400 }} method=\"post\"\u003e\n      \u003cInput name=\"name\" label=\"Name:\" defaultValue={actionData?.data.name} /\u003e\n      \u003cInputError errors={actionData?.errors?.name} /\u003e\n      \u003cInput name=\"age\" label=\"Age:\" defaultValue={actionData?.data.age} /\u003e\n      \u003cInputError errors={actionData?.errors?.age} /\u003e\n      \u003cbutton type=\"submit\" style={{ marginTop: \"1rem\" }}\u003e\n        Submit\n      \u003c/button\u003e\n    \u003c/Form\u003e\n  );\n};\n```\n\n## Installation\n\nTo install simply run the following command:\n\n```bash\n$ npm install --save remix-form-class-validator\n```\n\nBecause this library uses `class-transformer` [you will need to import](https://github.com/typestack/class-transformer#installation) the `reflect-metadata` shim.\nOn your `entry.server.tsx` file add the following import statement to import `reflect-metadata`:\n\n```typescript\n// entry.server.tsx\nimport \"reflect-metadata\";\n```\n\n### Configure Typescript\n\nBecause `class-validator` relies on annotations to perform validations, you should add the following to your `tsconfig.json`:\n\n```js\n{\n  // ...\n  \"compilerOptions\": {\n    // ...\n    \"strictPropertyInitialization\": false,\n    \"experimentalDecorators\": true\n    // ...\n  }\n  // ...\n}\n```\n\n## Examples\n\nYou can check some example apps on the [examples](./examples) folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrancisconeves97%2Fremix-form-class-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrancisconeves97%2Fremix-form-class-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrancisconeves97%2Fremix-form-class-validator/lists"}