Authentication
FastForms uses Clerk for authentication and user management. Clerk provides secure, production-ready authentication with minimal setup and excellent developer experience.Overview
Every form you create is tied to your user account. This means:- Forms are private to the creator by default
- Only you can view, edit, or delete your forms
- Only you can access responses to your forms
- Form exports are protected by user authentication
Published forms are publicly accessible via their unique slug (
/f/{slug}), but only authenticated form owners can view responses or manage the form.How It Works
Clerk is integrated at the root layout level, wrapping the entire application:app/layout.tsx
Sign Up
Creating a FastForms account is quick and secure:Access Sign Up
Navigate to the FastForms homepage and click the “Sign Up” button. Clerk handles the entire registration flow.
Choose Sign Up Method
Clerk supports multiple sign-up options:
- Email & Password: Traditional email registration
- Google: Sign up with your Google account
- GitHub: Sign up with your GitHub account
- Other OAuth Providers: Additional social login options
Email Verification
If you sign up with email and password, Clerk sends a verification email. Click the verification link to activate your account.
OAuth sign-ups (Google, GitHub) don’t require additional email verification since the provider already verified your email.
Sign In
Returning users can sign in using any method they originally registered with:Enter Credentials
Depending on how you registered:
- Email users: Enter your email and password
- OAuth users: Click your OAuth provider button (Google, GitHub, etc.)
Protected Routes & API Endpoints
FastForms uses Clerk’s server-side authentication to protect sensitive routes and API endpoints.Form Generation
The form generation endpoint requires authentication:app/api/forms/generate/route.ts
Viewing Forms
When you request your forms from the dashboard:app/api/getAllForms/route.ts
Export Protection
Form exports are protected to ensure only the form creator can download responses:app/api/forms/[id]/export/route.ts
User-Specific Features
Authentication enables these personalized features:Personal Dashboard
Your dashboard (/dashboard) shows only forms you’ve created:
app/dashboard/page.tsx
- Form title
- Response count
- Creation date
- Delete button (with confirmation)
Response Management
Only form owners can access response data:Form Ownership
Each form in the database includes auserId field:
prisma/schema.prisma
- Filtering forms by user
- Enforcing ownership in API endpoints
- Tracking who created each form
Public vs Private Access
FastForms distinguishes between authenticated and public access:| Route | Access | Purpose |
|---|---|---|
/dashboard | Authenticated | View your forms |
/generate | Authenticated | Create new forms |
/forms/{formId} | Authenticated (owner) | Preview and manage your form |
/forms/{formId}/responses | Authenticated (owner) | View form responses |
/f/{slug} | Public | Anyone can submit responses |
Session Management
Clerk automatically handles:- Session persistence: Stay logged in across browser sessions
- Session refresh: Automatically refresh expired sessions
- Multi-tab sync: Sign out in one tab, all tabs update
- Secure tokens: JWT-based authentication tokens
Security Best Practices
FastForms follows security best practices:- Server-side authentication: All protected API routes verify authentication server-side using
auth()from Clerk - Ownership verification: Every form operation checks that the authenticated user owns the resource
- No client-side secrets: API keys and secrets never exposed to the browser
- HTTPS only: All authentication flows use secure HTTPS connections
Next Steps
Create Your First Form
Now that you understand authentication, create your first AI-generated form
API Authentication
Learn how to authenticate API requests for programmatic form creation
AI Form Generation
Learn how the AI generates forms from natural language
Form Management
Manage your forms with the dashboard