Transform your PDF documents into interactive, mobile-friendly digital forms with AI-powered field extraction.
- PDF Upload & AI Extraction: Upload any PDF form and let AI automatically extract form fields
- Smart Form Generation: Generate responsive web forms from extracted JSON schema
- Mobile-Friendly: Forms work perfectly on any device
- PDF Filling: Automatically fill original PDFs with submitted data using pdf-lib
- Submission Management: Track all form submissions with a comprehensive dashboard
- Email Notifications: Automatic email notifications for form submissions
- Security & Compliance: HIPAA/FERPA ready with encrypted storage and audit trails
- Frontend: Next.js 14, TailwindCSS, ShadCN UI, React Hook Form
- AI/OCR: OpenAI GPT-4o for field extraction
- PDF Processing: pdf-lib for filling PDFs
- Database: Supabase (PostgreSQL)
- Storage: Supabase Storage for PDF files
- Authentication: Clerk
- Email: Resend
- Deployment: Vercel (recommended)
Before you begin, ensure you have:
- Node.js 18+ installed
- A Supabase account and project
- A Clerk account and application
- An OpenAI API key
- A Resend account (for email notifications)
-
Install dependencies
npm install
-
Set up environment variables Copy the example environment file and fill in your credentials:
cp .env.local .env.local
Required environment variables:
# Supabase NEXT_PUBLIC_SUPABASE_URL=your_supabase_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key # Clerk NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key CLERK_SECRET_KEY=your_clerk_secret_key # OpenAI OPENAI_API_KEY=your_openai_api_key # Resend RESEND_API_KEY=your_resend_api_key # Security (optional) ENCRYPTION_KEY=your_encryption_key
-
Set up the database
In your Supabase project, run the SQL from
supabase/schema.sqlto create the necessary tables and policies. -
Configure Clerk
In your Clerk dashboard:
- Set up your application
- Configure sign-in/sign-up options
- Add your domain to allowed origins
-
Configure Supabase Storage
In your Supabase project:
- Create a storage bucket named "pdfs"
- Set up the storage policies as defined in the schema
Start the development server:
npm run devOpen http://localhost:3000 to view the application.
src/
├── app/ # Next.js app router
│ ├── api/ # API routes
│ ├── dashboard/ # Protected dashboard pages
│ ├── form/ # Public form pages
│ └── page.tsx # Landing page
├── components/ # React components
│ ├── ui/ # ShadCN UI components
│ └── DynamicForm.tsx # Main form component
├── lib/ # Utility functions
│ ├── ai-extraction.ts # AI field extraction
│ ├── pdf-fill.ts # PDF filling logic
│ ├── email.ts # Email notifications
│ ├── security.ts # Security utilities
│ └── supabase.ts # Supabase client
├── types/ # TypeScript type definitions
└── middleware.ts # Clerk middleware
- Authentication: Clerk-based authentication with role-based access
- Rate Limiting: Built-in rate limiting for API endpoints
- Data Encryption: Sensitive data encryption capabilities
- Audit Logging: Comprehensive audit trail for all actions
- Input Validation: Sanitization and validation of all user inputs
- File Validation: Strict file type and size validation for uploads
The application automatically sends email notifications:
- Submitter Confirmation: Sent to form submitters upon successful submission
- Admin Notification: Sent to form owners when new submissions are received
Email templates are HTML-based and mobile-responsive.
The AI extraction system:
- Processes uploaded PDF files
- Uses GPT-4o to identify form fields
- Extracts field labels, types, and validation rules
- Generates structured JSON schema for form rendering
Supported field types:
- Text input
- Phone
- Date
- Checkbox
- Radio buttons
- Select dropdowns
- Textarea
- Signature
Generated forms include:
- Responsive design for all devices
- Real-time validation
- Required field indicators
- Signature capture
- Automatic form submission
- PDF generation with filled data
- Connect your repository to Vercel
- Set environment variables in Vercel dashboard
- Deploy - Vercel will automatically build and deploy
-
Build the application
npm run build
-
Start the production server
npm start
- Upload PDF: Users upload their PDF forms through the dashboard
- AI Extraction: GPT-4o analyzes the PDF and extracts form fields
- Form Generation: Dynamic forms are created from the extracted schema
- Public Sharing: Forms are shared via unique URLs
- Data Collection: Submissions are stored and can be exported as filled PDFs
- Notifications: Email notifications keep everyone informed
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Built with ❤️ for small clinics, schools, nonprofits, and local offices