How reyan36/certcat works
1. Overall shape
CertCat is a Next.js App Router application that combines a public marketing site, a certificate verification experience, an admin console, and a set of server-side API routes for certificate lifecycle operations. The app is split between browser-rendered pages under app/ and backend handlers under app/api/.
2. User-facing surfaces
The main browser entry points are:
- app/page.js for the landing page
- app/pricing/page.js for pricing
- app/status/page.js and app/verify/[id]/page.js for public status/verification flows
- app/dashboard/page.js and app/dashboard/templates/page.js for the certificate management UI
- app/admin/page.js for admin operations
These pages form the human-facing layer that drives certificate creation, viewing, and verification.
3. Backend API layer
The functional backend is exposed through Next.js route handlers in app/api/*. The key endpoints are:
- api/generate for creating certificates
- api/test-email and api/test-certificate for validation and operational checks
- api/status, api/health, and api/email-capacity for service checks and operational reporting
- api/imagekit-auth for media/service authentication
- api/admin/* for admin-only management and analytics
This is the main boundary between the UI and the server-side system.
4. Certificate generation pipeline
The generation path appears to be the core product workflow. The generate API likely assembles certificate data, renders the certificate using the shared components/CertificateTemplate.js, and incorporates visual positioning helpers from lib/position-utils.js. The README also indicates support for QR codes and PDF output, so this subsystem probably turns template + recipient data into a downloadable/verifiable certificate artifact.
5. Verification and public access
Public verification is centered around app/verify/[id]/page.js and the status pages. The design suggests each certificate gets a stable identifier and a public verification URL. The verification subsystem is separate from admin access and is intended to let anyone validate a certificate without needing privileged credentials.
6. Admin and authentication boundary
Admin functionality is isolated in app/admin and app/api/admin/*, with dedicated support code in:
- lib/admin-auth.js
- lib/admin-middleware.js
- lib/admin-config.js
This creates a clear trust boundary: ordinary public users can verify or receive certificates, while admins can read analytics, logs, users, certificates, and authenticate through protected routes.
7. Data and persistence
Firebase is the primary backend data platform:
- lib/firebase.js for client-side Firebase access
- lib/firebase-admin.js for privileged server-side access
The README explicitly names Firestore as the database. The architecture therefore separates public Firebase usage from server-authorized Firebase Admin operations, which is important for diagramming trusted vs. untrusted flows.
8. Email delivery subsystem
lib/email-service.js and the api/test-email route indicate a dedicated email delivery layer, likely powered by Nodemailer as stated in the README. This subsystem is responsible for sending generated certificates or delivery notifications and is distinct from generation itself. Operational checks like email-capacity suggest the app tracks or estimates sending limits.
9. Storage and media services
The repository includes lib/storage-service.js, lib/cloudinary.js, and an api/imagekit-auth route. That implies generated assets or template media are stored or distributed through external media services rather than being kept only in the app server. For an architecture diagram, treat storage/CDN as an external asset layer supporting certificate hosting and template/image management.
10. Operational and support endpoints
The presence of health, status, logs, analytics, and test routes indicates the system is designed with observability and admin support in mind. These endpoints provide runtime checks, service diagnostics, and operational insight, which are separate from the certificate issuance flow but important for maintaining the platform.
11. Shared UI and styling layer
The app uses a shared component and styling stack:
- components/CertificateTemplate.js for reusable certificate rendering
- app/globals.css, tailwind.config.js, and postcss.config.js for styling
This is a cross-cutting presentation layer used by the dashboard, public pages, and likely the generated certificate preview/rendering pipeline.
12. External technology boundaries
The repo is a modern full-stack JavaScript app built on Next.js/React with Tailwind CSS. On the server side it integrates Firebase Admin, Firestore, Nodemailer, and media/CDN tooling such as Cloudinary or ImageKit. These external systems are not just dependencies; they define the core boundaries between UI, application logic, persistence, email delivery, and asset hosting.
Main entry points: route.js Generate · page.js Dashboard · firebase-admin.js Firebase Admin · firebase.js Firebase
Components 19
App Router
Browser pages and server routes in the Next.js app.
- Landing · Public marketing entry point.
app/page.js - Pricing · Public pricing page.
app/pricing/page.js - Status · Public certificate status page.
app/status/page.js - Verify · Public verification page by certificate id.
app/verify/[id]/page.js - Dashboard · Certificate management UI.
app/dashboard/page.js - Templates · Dashboard template management.
app/dashboard/templates/page.js - Admin · Privileged administration UI.
app/admin/page.js - Generate · Certificate creation endpoint.
app/api/generate/route.js - Ops APIs · Health, status, capacity, and test endpoints.
- Admin APIs · Protected admin management endpoints.
- Media Auth · ImageKit authentication endpoint.
app/api/imagekit-auth/route.js
Core Logic
Shared rendering, workflow, and trust-boundary modules.
- Cert Template · Reusable certificate rendering template.
components/CertificateTemplate.js - Position Utils · Layout and placement helpers.
lib/position-utils.js - Admin Auth · Admin authentication and middleware.
lib/admin-auth.js
Infra Services
Persistence, email, and media integrations.
- Firebase · Client-side Firebase access.
lib/firebase.js - Firebase Admin · Privileged Firestore access.
lib/firebase-admin.js - Email Service · Certificate and notification email delivery.
lib/email-service.js - Storage · Asset and certificate storage integration.
lib/storage-service.js - Cloudinary · External media hosting service.
lib/cloudinary.js
Connections 22
- Landing → Dashboard: enter app · Landing page routes users into the product.
- Landing → Pricing: view plans · Public marketing navigation.
- Dashboard → Templates: manage templates · Dashboard opens template management.
- Dashboard → Generate: create certs · Dashboard submits certificate generation requests.
- Dashboard → Firebase: read/write · UI uses client Firebase for app data.
- Status → Firebase: lookup status · Status page fetches certificate state.
- Verify → Firebase: verify cert · Public verification resolves certificate identity.
- Generate → Cert Template: render · Generation uses shared certificate rendering.
- Generate → Position Utils: place elements · Generation computes layout positions.
- Generate → Firebase Admin: persist cert · Server-side certificate data is stored with admin privileges.
- Generate → Email Service: send email · Generated certificates can be delivered by email.
- Generate → Storage: store asset · Generated artifacts or media are persisted externally.
- Ops APIs → Firebase Admin: read ops data · Operational endpoints inspect trusted backend state.
- Ops APIs → Email Service: check capacity · Email capacity and test endpoints exercise delivery.
- Admin → Admin APIs: admin actions · Admin UI calls protected management routes.
- Admin APIs → Admin Auth: protect routes · Admin routes enforce auth and middleware.
- Admin APIs → Firebase Admin: manage data · Admin routes manage users, certificates, logs, and analytics.
- Admin APIs → Email Service: inspect mail · Admin operations may surface delivery state.
- Media Auth → Cloudinary: asset auth · Media authentication supports external asset hosting.
- Storage → Cloudinary: persist media · Storage integration uses Cloudinary as an external service.
- Cert Template → Dashboard: preview · Shared certificate rendering is reused in the UI.
- Admin Auth → Firebase Admin: verify admin · Trusted admin access depends on privileged backend data.