Skip to content
Projekte

Über uns

Open-source certificate automation tool to generate, download, and email personalized certificates using CSV or Google Sheets.

Produktivität und Automatisierung

So werden diese Zahlen gemessen

Gemessener Sternzuwachs

in 24h
0
in 7 days
+1
in 15 days
+1
in 1 month
Verlauf wird gesammelt

Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.

README.md

Original

Next.js 16 React 19 Flask API TypeScript 5 Tailwind CSS 4

📜 MailMyCertificate

Generate and send professional certificates in minutes — mostly in your browser.

Open-source, privacy-first certificate automation for hackathons, educators, and event organizers.
Upload a template → Add participants (CSV or Google Sheets) → Place fields → Generate PDFs → Download ZIP or send via Gmail.

Live site • Features • Architecture • Getting Started • Deployment • Roadmap


🌟 Overview

MailMyCertificate is a full certificate workflow: design on a visual canvas, batch-generate PDFs client-side, then optionally send them through your own Gmail account via Google OAuth.

Layer What runs where
PDF generation 100% in the browser (Web Worker + pdf-lib)
Participant data Stored in IndexedDB (Dexie) on your device
Gmail send + OAuth Flask API on Vercel (/api/*) — only when you choose to email

Production: mailmycertificate.tech


Built by Akshat Thakur

Created by Akshat Thakur, a software developer building web applications and tools that solve real problems.

If you like MailMyCertificate, you might also find these useful:

Connect on GitHub • LinkedIn • Twitter/X


✨ Features

Certificate wizard (/tool)

Feature Description
Template upload JPG/PNG templates with dimension detection
CSV import Up to 400 rows, header detection, preview table
Google Sheets import Paste a public sheet URL and sync participant data
Visual field editor Drag-and-drop fields, zoom, properties panel (size, alignment, color)
Undo / redo Field placement history via zundo (Ctrl+Z / Ctrl+Y)
Single-certificate preview Preview modal before batch generation
Batch PDF generation Web Worker + chunked processing; resume after refresh
ZIP download All completed PDFs in one archive
Opt-in verification Publish minimal certificate metadata and add QR links to a public verification page
Session recovery Restore in-progress batches from IndexedDB

Email delivery (/email)

Feature Description
Gmail OAuth Connect your Google account (Gmail API gmail.send)
Personalized compose Subject/body with {{column}} variables from CSV
Attachments Sends generated PDF per recipient
Send tracker Live progress, failures list, retry-friendly queue
Refresh guard Warns before leaving during an active send

Site & privacy

Page Purpose
/ Landing + marketing
/guide How-to, FAQs, OAuth walkthrough
/about Project story
/contact Contact
/settings Local data management (view / delete sessions)
/privacy-policy, /terms-of-service Legal pages

Also: SEO metadata, JSON-LD, sitemap, PWA manifest, service worker (static assets), Vercel Analytics.


🏗 Architecture

┌──────────────────────────────────────────────────────────────────────────┐
│                         Browser (Next.js 16)                              │
│  /tool  → Wizard (Zustand + Dexie IDB) → Web Worker → pdf-lib → ZIP      │
│  /email → Gmail composer → fetch('/api/...', credentials: 'include')       │
└───────────────────────────────┬──────────────────────────────────────────┘
                                │  /api/*  (Vercel Services)
                                ▼
┌──────────────────────────────────────────────────────────────────────────┐
│                    Flask backend (api/index.py)                           │
│  GET  /api/auth/login      → Google OAuth URL                             │
│  GET  /api/auth/callback   → Exchange code, session + CSRF                  │
│  GET  /api/auth/status     → Connected Gmail + csrf_token sync              │
│  POST /api/send-email      → Gmail API send (PDF attachment)                │
│  POST /api/sheets/import   → Google Sheets CSV fetch                        │
└──────────────────────────────────────────────────────────────────────────┘

Vercel routing (vercel.json): Next.js at /, Flask at /api via experimentalServices.

Local dev: next.config.ts rewrites /api/* → http://localhost:8000 when NODE_ENV=development.


🛠 Tech Stack

Category Technology Purpose
Frontend Next.js 16, React 19, TypeScript 5 App Router, UI
Styling Tailwind CSS 4 Design system
State Zustand + zundo + persist Wizard state, undo/redo
Storage Dexie (IndexedDB) Sessions, templates, PDFs, email queue
PDF pdf-lib + Web Worker Client-side generation
ZIP JSZip Batch download
CSV PapaParse File parsing
Backend Flask, google-auth-oauthlib, Gmail API OAuth + send + Sheets proxy
Deploy Vercel (Next + Python services) Production hosting
Analytics @vercel/analytics Usage metrics

📁 Project Structure

MailMyCertificate/
├── api/
│   ├── index.py              # Flask app (OAuth, send-email, sheets)
│   └── site_config.py        # APP_URL, CORS, redirect URI helpers
├── public/
│   ├── logo.png              # Brand asset
│   ├── icon-192.png, icon-512.png, favicon-48.png
│   ├── manifest.json         # PWA
│   └── sw.js                 # Service worker (static cache; skips /api)
├── src/
│   ├── app/                  # Routes (/, /tool, /email, /guide, …)
│   ├── views/                # Page-level views
│   ├── components/           # UI, wizard, email, session, seo, guide
│   ├── core/
│   │   ├── db/schema.ts      # Dexie tables
│   │   ├── session/          # Session manager + recovery
│   │   ├── queue/            # Email queue
│   │   └── worker/           # PDF generation worker
│   ├── services/             # template, csv, email, sheets, zip, pdf
│   ├── store/useAppStore.ts  # Zustand + temporal + persist
│   ├── config/site.ts        # Public URL helpers (frontend)
│   └── lib/                  # metadata, SEO, structured data
├── vercel.json               # Next + Flask services
├── requirements.txt          # Python dependencies
├── next.config.ts
└── .env.example

🚀 Getting Started

Prerequisites

  • Node.js ≥ 18
  • Python ≥ 3.10 (for local Gmail API)
  • Google Cloud OAuth client (Web) with Gmail API enabled

1. Clone & install

git clone https://github.com/akshatthakur22/MailMyCertficate.git
cd MailMyCertficate
npm install
pip install -r requirements.txt

2. Environment variables

Copy .env.example → .env.local and fill in:

NEXT_PUBLIC_APP_URL=http://localhost:3000
APP_URL=http://localhost:3000
NEXT_PUBLIC_VERIFICATION_URL=http://localhost:3000
FLASK_SECRET_KEY=<random-hex>
GOOGLE_CREDENTIALS_JSON={"web":{...,"redirect_uris":["http://localhost:3000/api/auth/callback"]}}

In Google Cloud Console → OAuth client → add:

  • Authorized JavaScript origins: http://localhost:3000
  • Authorized redirect URIs: http://localhost:3000/api/auth/callback

For production, also add https://mailmycertificate.tech and
https://mailmycertificate.tech/api/auth/callback.

Public verification domain

Verification is opt-in in the certificate editor. When enabled, generated QR codes point to https://verify.mailmycertificate.tech/certificate/<id>. Add verify.mailmycertificate.tech as a domain on the Vercel project, configure its DNS record as Vercel requests, and set NEXT_PUBLIC_VERIFICATION_URL to that domain. Verification records require the production DATABASE_URL; local development falls back to the existing SQLite database.

3. Run locally (two terminals)

Terminal A — Flask API (port 8000):

python api/index.py

Terminal B — Next.js:

npm run dev

Open http://localhost:3000. Gmail connect and send only work when both are running.

Alternatively, with the Vercel CLI: vercel dev -L runs frontend + backend together.

Scripts

Command Description
npm run dev Next.js dev server
npm run build Production build
npm run start Start production Next server
npm run lint ESLint
python api/index.py Flask API on :8000 (local)

🚢 Deployment (Vercel)

  1. Import the GitHub repo on Vercel.
  2. Set Production environment variables:
Variable Example
APP_URL https://mailmycertificate.tech
NEXT_PUBLIC_APP_URL https://mailmycertificate.tech
FLASK_SECRET_KEY long random string
GOOGLE_CREDENTIALS_JSON full OAuth client JSON (single line)
  1. Ensure vercel.json uses experimentalServices (already in repo).
  2. Redeploy after env changes.

Checklist after deploy

  • GET /api/auth/login returns JSON with authorization_url (not HTML 500).
  • redirect_uri in that URL matches Google Console exactly.
  • Connect Gmail on /email, then send a test message.

📧 How email works

  1. User clicks Connect Gmail → /api/auth/login → Google OAuth.
  2. Callback → /api/auth/callback stores OAuth credentials in an encrypted field inside Flask's signed session cookie. The cookie is held by the browser; it is not a server-side session store.
  3. Frontend syncs CSRF token from redirect URL + /api/auth/status.
  4. Each send: POST /api/send-email with credentials: 'include', X-CSRF-Token, and PDF attachment (multipart).

The API decrypts credentials when it needs to refresh a token or call Gmail. CSV-based generation and PDF rendering stay in the browser. Public Google Sheets data is fetched through the Flask API, and when you send email, each recipient, message, and PDF attachment is sent to the Flask API and then to Gmail.


🗺 Roadmap

Done recently

  • Gmail OAuth + send via Flask on Vercel
  • IndexedDB sessions + recovery
  • Google Sheets import
  • Undo/redo, preview modal, email send UI
  • SEO, PWA, settings / legal pages

Next

  • Custom font embedding in PDFs (beyond Helvetica)
  • Personalized ZIP filenames from CSV columns
  • Stronger CSV validation (duplicates, email column hints)
  • Dark mode
  • Automated tests (unit + E2E)
  • Rate-limit UX for large Gmail batches

🤝 Contributing

  1. Fork the repo
  2. Create a branch (git checkout -b feature/your-feature)
  3. Commit and push
  4. Open a Pull Request

Issues and PRs are welcome.


📄 License

MIT License — see LICENSE if present in the repo root.


🙏 Acknowledgements

Built with dedication by Akshat Thakur using:

Thanks to the open-source community for tools that make this possible.


Built with ❤ by Akshat Thakur


👨‍💻 For Developers

If you're looking to fork, customize, or contribute to MailMyCertificate:

  • Check out the /for-developers page (coming soon) for architecture deep-dive and customization guide
  • Read CONTRIBUTING.md for development workflow, code style, and PR process
  • Review GitHub Issues for bugs and feature requests
  • Join the discussion on Discussions or email via GitHub profile

Why fork MailMyCertificate?

  • You don't need to build certificate generation + Gmail integration from scratch
  • The entire workflow is open and transparent — no black box
  • Deploy to your own infrastructure (Vercel, self-hosted, Docker)
  • Customize fields, styling, or logic to fit your specific workflow

Ähnliche Projekte entdecken

Wird geladen…