How vincanger/coverlettergpt works
Project Type and Purpose
• This is a full-stack web application called CoverLetterGPT.xyz built with Wasp.
• Purpose: let users generate custom cover letters using OpenAI’s GPT models, manage subscriptions (Stripe + Bitcoin Lightning), and notify them before renewal via email.
File Structure Highlights
• Root
• main.wasp: Wasp config describing entities, auth, UI routes, server actions
• schema.prisma + migrations/: database schema and evolution scripts
• env.server.example: environment variables (DB URL, API keys)
• src/client/: React + Chakra UI pages and reusable components
• src/server/: server-side logic
• actions.ts: OpenAI prompts and generation logic
• auth.ts: Google OAuth and session management
• ln.ts: Lightning invoice creation and payment status
• webhooks.ts: receiving Stripe and LN updates
• workers/: scheduled tasks (email reminders via SendGrid)
• Shared utilities under src/shared/
Key Components
• Frontend (browser)
• React app served by Vite (port 3000)
• Chakra UI for styling
• Calls backend via HTTP REST endpoints (Wasp actions & queries)
• Backend (Node/Express under the hood)
• Wasp-generated Express server (port 3001)
• Defines endpoints for auth, cover-letter generation, payments, and webhooks
• Uses Prisma client for DB access
• Database
• PostgreSQL instance (Docker or external)
• Tables for Users, CoverLetters, Payments, Subscriptions, etc.
• External Services
• OpenAI API (GPT-4o or GPT-3.5)
• Stripe API (subscription management, checkout sessions)
• Bitcoin Lightning (Bolt11 invoices, status polling via webhooks)
• SendGrid (email reminders)
• Worker / Scheduler
• Cron job in src/server/workers/updateUserSubscription.ts
• Runs periodically to send renewal notifications
• Wasp Framework
• Glue layer that wires the above pieces together based on main.wasp
Relationships and Data Flow
• User → Browser → React UI
• UI → HTTP → Wasp/Express server
• Server ←→ Prisma ←→ PostgreSQL
• Server → OpenAI / Stripe / Lightning / SendGrid
• External webhooks (Stripe, Lightning) → Server’s webhook endpoints
• Scheduler Worker → Server code → Database & SendGrid
Architectural Patterns & Principles
• Monorepo with clear client/server separation
• Declarative full-stack setup via Wasp config
• API-driven server functions (actions/queries)
• Event-driven webhooks and scheduled workers for asynchronous tasks
• Single source of truth for schema via Prisma
Final Checklist
• A note calling out main.wasp as the declarative glue