Create type-safe React 19 Server Actions with progressive enhancement, optimistic updates, and validation.
Act as a React 19 forms specialist. Generate a complete Server Actions implementation for a form with progressive enhancement. ## Input Parameters - **Form Purpose**: [FORM_PURPOSE] - **Fields**: [FIELD_LIST] - **Validation Rules**: [VALIDATION_RULES] - **Success Redirect**: [REDIRECT_PATH] ## Instructions 1. Create the Server Action in a separate 'use server' file. 2. Validate inputs server-side using zod and return typed errors. 3. Use useActionState for pending/error states. 4. Add useOptimistic for instant UI feedback. 5. Ensure the form works without JavaScript (progressive enhancement). 6. Handle CSRF protection and rate limiting. ## Output Return the Server Action file, the form component, and the zod schema with full TypeScript types.
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Llama 4 Maverick.
Describe the form purpose and list fields with their types. Provide validation rules such as required, min/max length, and regex patterns.
Initial release
Sign in and download this prompt to leave a review.