Credenza Docs
Documentation
Complete technical and user guide for certificate generation, email delivery, and bulk recipient workflows.
Overview
Credenza is a Next.js application for generating personalized certificates, previewing name placement, and sending certificates by email in bulk. Certificates are rendered from a template image, converted to PDF during email flow, uploaded to Supabase Storage, and shared using expiring signed links.
- Frontend: interactive template preview, style controls, and recipient management.
- Backend: streaming send API for live status updates while emails are sent.
- Storage: Supabase bucket for generated certificate PDFs.
- Email: Gmail SMTP via Nodemailer.
Quick Start
- Install dependencies with npm install.
- Create a .env file and set SMTP + Supabase values.
- Run npm run dev and open http://localhost:3000.
- Upload your certificate template image.
- Set text position and style in the preview tab.
- Add recipients manually or import CSV/TXT.
- Generate downloads or send certificates by email.
Required Environment Variables
SMTP_HOST=smtp.gmail.com SMTP_PORT=587 SMTP_USER=your-email@gmail.com SMTP_PASS=your-gmail-app-password SMTP_FROM=your-email@gmail.com SMTP_SECURE=false NEXT_PUBLIC_SUPABASE_URL=your-supabase-url NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY=your-publishable-key SUPABASE_SERVICE_ROLE_KEY=your-service-role-key
Project Structure
Core areas of the codebase:
- app/page.tsx: main workflow and UI state orchestration.
- app/api/certificates/send/route.ts: streaming email send endpoint.
- components/: uploader, preview, style controls, recipient manager, generate panel, header, footer.
- lib/canvas.ts: draws participant names on uploaded template image.
- lib/pdf.ts: PDF generation and ZIP packing helpers.
- lib/supabase-storage.ts: upload and signed URL generation for certificate PDFs.
Certificate Generation
The generation flow renders one certificate per recipient using a shared template image and text styling.
- Template upload supports common image formats used for certificate designs.
- Preview tab supports click-to-place positioning plus guide/grid overlays.
- Style controls include x/y position, font size, family, color, weight, and italic toggle.
- Output options: PNG ZIP download and PDF ZIP download.
Rendering is performed per recipient and progress is displayed in the UI to keep long batches observable.
Email Integration
Email sending is handled by the server endpoint and streams live status updates back to the UI.
- Transport: Gmail SMTP through Nodemailer.
- Subject format: generated from project name.
- Body format: standardized congratulatory message with download button and fallback link.
- Links: signed Supabase URLs with expiry timestamp in the message.
- Retries: failed recipients can be resent from the Generate tab.
Batch Processing
Credenza supports high-volume runs with recipient-level progress and partial failure handling.
- Add recipients manually as name + email pairs.
- Import CSV/TXT for faster onboarding of large cohorts.
- Generation and send progress are shown per recipient.
- Completion summary includes sent, failed, and total counts.
API Reference
Primary endpoint used by the app:
POST /api/certificates/send
Returns newline-delimited JSON events (application/x-ndjson).
Stream event types emitted by the endpoint:
- batch-created: confirms total certificates queued.
- recipient-status: pending, sending, sent, or failed for each recipient.
- complete: final batch summary including failed recipients.
- error: unrecoverable batch-level error details.
Security and Storage
- Certificates are uploaded to Supabase Storage, not local server disk.
- Signed URLs are time-bound and automatically expire.
- Service role key should only be used server-side and never exposed client-side.
- Use Gmail app passwords for SMTP authentication.
Troubleshooting
Emails fail to send
Confirm SMTP_USER, SMTP_PASS, SMTP_HOST, SMTP_PORT, and SMTP_FROM values in .env.
Supabase upload errors
Check NEXT_PUBLIC_SUPABASE_URL and SUPABASE_SERVICE_ROLE_KEY values and bucket permissions.
No preview text visible
Ensure template is loaded and recipient list is not empty. The preview falls back to sample text.
Slow batch sends
Large PDF generation and SMTP delivery depend on network and provider limits. Retry failed recipients.
Deployment Notes
- Set all SMTP and Supabase environment variables in your deployment platform.
- Do not commit real secrets to version control.
- Use production-safe sender email and verify provider limits for your expected batch size.
Need more help? Contact the developer from the footer support links or open the repository linked above.