npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@goobits/forms

v1.3.2

Published

Configurable form components with validation, reCAPTCHA, and file uploads for Svelte 5

Readme

@goobits/forms

Production-ready forms for SvelteKit. Secure. Accessible. Done.

npm version License: MIT


Choose Your Path

🚀 Quick Start - Ship a contact form in 5 minutes 📚 Documentation - Complete guides and API reference


Key Features

  • Form Types - Contact, support, feedback, booking forms with category-based routing
  • Schema Validation - Type-safe validation with Zod v4
  • Bot Protection - reCAPTCHA v3, rate limiting, CSRF tokens
  • File Uploads - Image uploads with preview and client-side validation
  • Internationalization - i18n with Paraglide integration and auto-detection
  • Accessibility - WCAG 2.1 compliant, tested with NVDA/JAWS/VoiceOver

Quick Start

Install

npm install @goobits/forms

Configure

// src/hooks.server.js
import { initContactFormConfig } from '@goobits/forms/config';

initContactFormConfig({
	appName: 'My App',
	categories: {
		general: {
			label: 'General Inquiry',
			fields: ['name', 'email', 'message']
		}
	}
});

Create API

// src/routes/api/contact/+server.js
import { createContactApiHandler } from '@goobits/forms/handlers/contactFormHandler';

export const POST = createContactApiHandler({
	adminEmail: process.env.ADMIN_EMAIL,
	fromEmail: process.env.FROM_EMAIL,
	emailServiceConfig: { provider: 'mock' } // or 'nodemailer', 'aws-ses'
});

Add Form

<!-- src/routes/contact/+page.svelte -->
<script>
	import { ContactForm } from '@goobits/forms/ui';
	import '@goobits/forms/ui/variables.css';
	import '@goobits/forms/ui/ContactForm.css';
</script>

<ContactForm apiEndpoint="/api/contact" />

Done! Start dev server and visit /contact.


🔒 Security

Build secure forms by validating data server-side. This package provides client-side checks for better UX, but security happens in your API handlers.

Included protections:

  • CSRF token validation
  • Rate limiting (IP-based, configurable)
  • reCAPTCHA verification
  • Input sanitization helpers
  • File upload validation

See Getting Started Guide for production deployment.


Documentation

Getting Started

API Reference

  • Components - ContactForm, FeedbackForm, CategoryContactForm, FormField
  • UI Components - Modals, Menus, Tooltips, Inputs
  • Handlers - API route handlers and email services
  • Security - CSRF protection, rate limiting

Guides

Examples


Component Overview

Form Components

import {
	ContactForm,          // Main form with validation
	CategoryContactForm,  // Form with category selection
	ContactFormPage,      // Complete page layout
	FeedbackForm,         // Quick feedback widget
	FormField,            // Reusable field component
	UploadImage           // File upload with preview
} from '@goobits/forms/ui';

UI Components

import {
	Input, Textarea, SelectMenu, ToggleSwitch,  // Form inputs
	FormErrors, ThankYou,                        // Status components
	DemoPlayground                               // Interactive demo
} from '@goobits/forms/ui';

import { Menu, ContextMenu, MenuItem, MenuSeparator } from '@goobits/forms/ui';
import { Modal, Alert, Confirm, AppleModal } from '@goobits/forms/ui/modals';
import { tooltip, TooltipPortal } from '@goobits/forms/ui/tooltip';

See API Reference for complete component documentation with props and usage.


Styling

Import base styles and customize with CSS variables:

import '@goobits/forms/ui/variables.css';
import '@goobits/forms/ui/ContactForm.css';
.forms-scope {
	--color-primary-500: #3b82f6;
	--color-error-500: #ef4444;
	--font-family-base: 'Inter', system-ui, sans-serif;
	--border-radius-medium: 0.5rem;
}

See variables.css for all customization options.


Email Configuration

Development

emailServiceConfig: { provider: 'mock' }

Production (Nodemailer)

emailServiceConfig: {
	provider: 'nodemailer',
	smtp: {
		host: 'smtp.gmail.com',
		port: 587,
		secure: false,
		auth: {
			user: process.env.SMTP_USER,
			pass: process.env.SMTP_APP_PASSWORD
		}
	}
}

Production (AWS SES)

emailServiceConfig: {
	provider: 'aws-ses',
	region: 'us-east-1',
	accessKeyId: process.env.AWS_ACCESS_KEY_ID,
	secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
}

See Getting Started Guide for complete setup instructions.


Internationalization

Quick Override

<script>
	const messages = {
		howCanWeHelp: '¿Cómo podemos ayudarte?',
		sendMessage: 'Enviar mensaje',
		sending: 'Enviando...'
	};
</script>

<ContactForm {messages} />

Auto-Detection

// hooks.server.js
import { handleFormI18n } from '@goobits/forms/i18n';

export async function handle({ event, resolve }) {
	await handleFormI18n(event);
	return await resolve(event);
}

See Getting Started Guide for Paraglide integration.


Requirements

  • Node.js ≥18.0.0
  • pnpm ≥9.0.0 (or npm/yarn)
  • SvelteKit project

Dependencies

All required dependencies install automatically:

npm install @goobits/forms

This includes: @sveltejs/kit, svelte, formsnap, sveltekit-superforms, zod, @lucide/svelte

Optional Email Service Dependencies

Choose one if you need email delivery:

npm install nodemailer          # For SMTP (Gmail, SendGrid, etc.)
npm install @aws-sdk/client-ses # For AWS SES

License

MIT - see LICENSE for details


Links


Built with: SvelteKitZodFormsnapSuperforms