How vikasingh0897/auditai works
1. This is a split frontend/backend SaaS product.
The repo contains a Vite + React TypeScript client in frontend/ and a Node.js + Express TypeScript API in backend/. The architecture is centered on a user-submitted SaaS audit flow that turns a tool list and spend estimate into an AI-generated summary and then into lead capture.
2. Primary user journey is linear and conversion-focused.
Users enter through LandingPage, submit data in AuditForm, pass CAPTCHA, receive results in AuditSummary / ResultsDashboard, and may be shown LeadModal for follow-up. The front end is organized as a small set of page-level components with shared Header and Footer, not a large routed application.
3. Frontend boundary: presentation and API consumption only.
frontend/src/App.tsx and main.tsx bootstrap the app, while pages under src/pages/ hold the main interaction states. The UI layer does not appear to own business logic; it likely posts form data to the backend and renders whatever summary/metrics the API returns.
4. Backend boundary: request orchestration and security.
backend/src/app.ts wires middleware and routes, while index.ts starts the server. The backend is the system of record for validation, anti-abuse controls, AI summarization, lead handling, and persistence, making it the main integration layer between browser, database, and external services.
5. Core API surface is split by domain.
Routes are organized into audit.route.ts, lead.route.ts, and tools.route.ts, with controllers in controllers/ handling the domain logic. There is also a pricing.controller.ts, suggesting a dedicated path for pricing/reference data used by the audit engine or UI comparisons.
6. Audit processing is the central business subsystem.
audit.controller.ts likely coordinates the audit workflow: ingest user tool/spend data, enrich it with curated pricing/tool data, pass it through summaryEngine.ts, and persist the result using audit.model.ts. The test file auditEngine.test.ts indicates the audit/scoring logic is important enough to be unit-tested separately.
7. External service integration is abstracted into utilities.
summaryEngine.ts wraps the AI generation layer described in the README as Google Generative AI/Gemini. captcha.ts handles hCaptcha verification, and emailService.ts handles transactional email through a provider such as Brevo/Resend. These utilities create clear boundaries around third-party dependencies so controllers can stay thin.
8. Security and abuse prevention sit in middleware.
honeypot.middleware.ts, rateLimiter.ts, and validator.middleware.ts form the defensive perimeter. This means input is screened before reaching controllers, with schema validation and bot/traffic filtering happening at the edge of the API rather than inside business logic.
9. Persistence is MongoDB-backed and modeled explicitly.
db.ts manages the MongoDB connection, while Mongoose models in models/ define stored entities such as audit records and pricing data. The presence of seedTools.ts and pricing.model.ts suggests the app keeps a curated internal dataset for tool/pricing intelligence, not just raw user submissions.
10. Deployment is split and likely serverless-friendly.
Both frontend/vercel.json and backend/vercel.json indicate separate deploy targets, with environment-driven configuration via .env.example. The frontend likely talks to the backend over VITE_API_URL, while the backend relies on MongoDB, CAPTCHA, AI, and email service credentials.
11. Operationally, the app is opinionated around lead capture and metrics.
The repo includes standalone docs like ECONOMICS.md, GTM.md, METRICS.md, PRICING_DATA.md, and USER_INTERVIEWS.md, which suggests this is not just a codebase but a productized funnel with pricing intelligence, conversion tracking, and go-to-market artifacts aligned to the same audit workflow.
Main entry points: app.ts API app · App.tsx App shell · audit.controller.ts Audit controller · lead.controller.ts Lead controller
Components 29
Frontend
Vite + React client for the audit funnel
- App shell · Starts the client and mounts the application
frontend/src/App.tsx - Main entry · Client entrypoint and render setup
frontend/src/main.tsx - Landing page · Top-of-funnel entry and product framing
frontend/src/pages/LandingPage.tsx - Audit form · Collects tools, spend, and captcha-gated submission
frontend/src/pages/AuditForm.tsx - Audit summary · Renders the AI-generated audit outcome
frontend/src/pages/AuditSummary.tsx - Results dashboard · Displays conversion-focused results and metrics
frontend/src/pages/ResultsDashboard.tsx - Lead modal · Captures follow-up details after results
frontend/src/pages/LeadModal.tsx - Header · Common top-level navigation and branding
frontend/src/components/Header.tsx - Footer · Common page footer and secondary links
frontend/src/components/Footer.tsx
Backend
Express API for audit processing and lead capture
- Server entry · Starts the API server
backend/src/index.ts - API app · Configures middleware, routing, and app wiring
backend/src/app.ts - Audit route · Audit submission and retrieval endpoints
backend/src/routes/audit.route.ts - Lead route · Lead capture and follow-up endpoints
backend/src/routes/lead.route.ts - Tools route · Curated tools and reference data endpoints
backend/src/routes/tools.route.ts - Audit controller · Orchestrates audit validation, enrichment, and persistence
backend/src/controllers/audit.controller.ts - Lead controller · Handles lead intake and delivery
backend/src/controllers/lead.controller.ts - Pricing controller · Serves pricing and comparison data
backend/src/controllers/pricing.controller.ts - Guardrails · Honeypot, rate limiting, and request validation
backend/src/middlewares/validator.middleware.ts - Captcha · Verifies hCaptcha challenges
backend/src/utils/captcha.ts - Summary engine · Generates audit summaries using Gemini-style AI
backend/src/utils/summaryEngine.ts - Email service · Sends transactional or lead follow-up email
backend/src/utils/emailService.ts - MongoDB · Shared database connection management
backend/src/db.ts - Audit model · Stores audit records and outcomes
backend/src/models/audit.model.ts - Pricing model · Stores curated pricing and tool reference data
backend/src/models/pricing.model.ts - Seed tools · Populates the curated tool dataset
backend/src/seedingData/seedTools.ts
Ops & Docs
Deployment, CI, and product docs
- CI workflow · Runs repository checks in GitHub Actions
.github/workflows/ci.yml - Frontend deploy · Frontend hosting configuration
frontend/vercel.json - Backend deploy · Backend hosting configuration
backend/vercel.json - Product docs · Architecture, economics, metrics, prompts, and GTM materials
README.md
Connections 32
- Main entry → App shell: boots · Mounts the React application
- App shell → Landing page: shows · Primary landing experience
- Landing page → Audit form: starts · Moves users into the audit flow
- Audit form → Audit summary: submits to · Requests the AI-generated audit result
- Audit summary → Results dashboard: renders · Presents the post-audit outcome
- Results dashboard → Lead modal: prompts · Converts results into lead capture
- App shell → Header: uses · Shared top-level UI chrome
- App shell → Footer: uses · Shared page footer
- App shell → API app: calls API · Client consumes backend endpoints
- Server entry → API app: starts · Server initializes Express app
- API app → Guardrails: applies · Screens requests before controllers
- API app → Audit route: mounts · Registers audit endpoints
- API app → Lead route: mounts · Registers lead endpoints
- API app → Tools route: mounts · Registers tools/reference endpoints
- Audit route → Audit controller: delegates · Hands off audit requests
- Lead route → Lead controller: delegates · Hands off lead requests
- Tools route → Pricing controller: delegates · Serves pricing and tool data
- Audit controller → Captcha: verifies · Checks bot challenges before processing
- Audit controller → Summary engine: generates · Creates the AI summary payload
- Audit controller → Audit model: persists · Stores audit results
- Lead controller → Email service: notifies · Sends follow-up or confirmation email
- Lead controller → MongoDB: stores · Persists lead-related data
- Pricing controller → Pricing model: reads · Loads reference pricing data
- Pricing model → MongoDB: backed by · Mongoose persistence layer
- Audit model → MongoDB: backed by · Mongoose persistence layer
- Seed tools → Pricing model: seeds · Populates curated tool records
- CI workflow → App shell: checks · Builds and validates client code
- CI workflow → API app: checks · Builds and validates server code
- Frontend deploy → Main entry: deploys · Frontend hosting target
- Backend deploy → Server entry: deploys · Backend hosting target
- Product docs → API app: describes · Documents system design and product behavior
- Product docs → App shell: describes · Documents client structure and funnel