LeadBridge is an internal, role-based CRM designed for single-organization lead capture, provider routing, connector execution, parser-driven imports, sales tracking, and comprehensive reporting.
The application is structured as a Next.js App Router application backed by PostgreSQL, Prisma 7, Better Auth, and a modular connector/parser runtime engine.
- Framework: Next.js 16 (App Router, Server Components & Route Handlers)
- Language: TypeScript 5
- Package Manager: pnpm
- Styling & UI: Tailwind CSS v4, Lucide React, Custom Design System
- Database & ORM: PostgreSQL with Prisma 7 (
@prisma/adapter-pgdriver adapter) - Authentication: Better Auth 1.6 (Credentials-only, session cookies)
- Validation: Zod
- HTTP Client: Axios & Fetch API
- Logging: Pino structured logger
- Animation & Transitions: GSAP
pnpm install
pnpm db:generate
pnpm db:migrate
pnpm prisma db seed
pnpm devOpen http://localhost:3000 to access the application.
| Variable | Description |
|---|---|
DATABASE_URL |
PostgreSQL connection string |
BETTER_AUTH_SECRET |
Secret key for Better Auth sessions |
BETTER_AUTH_URL |
Canonical server URL for authentication callbacks |
NEXT_PUBLIC_APP_URL |
Client-side base URL for the auth client |
ADMIN_NAME |
Initial administrator name for seed script |
ADMIN_EMAIL |
Initial administrator email for seed script |
ADMIN_PASSWORD |
Initial administrator password for seed script |
LOG_LEVEL |
Pino logging level (info, debug, warn, error) |
GMAIL_<KEY>_CLIENT_ID |
OAuth2 Client ID for a discovered Gmail account key |
GMAIL_<KEY>_CLIENT_SECRET |
OAuth2 Client Secret for a discovered Gmail account key |
GMAIL_<KEY>_REFRESH_TOKEN |
OAuth2 Refresh Token for a discovered Gmail account key |
pnpm lint # Run ESLint
pnpm typecheck # Run TypeScript compiler checks
pnpm build # Build Next.js production bundleCanonical documentation lives in docs/:
- Architecture -- System design, request flow, layer responsibilities
- Database -- Prisma schema, models, relationships, indexes
- Backend -- Service layer, business logic, shared libraries
- Frontend -- Pages, components, design system, navigation
- API Reference -- All API routes with methods and authorization
- Authentication -- Better Auth setup, roles, permissions
- Integrations -- Connectors, parsers, runtime engine
- Performance -- Current architecture, bottlenecks, optimization priorities
- Development Guide -- Setup, conventions, commands
Experimental/reference documents (not canonical):
- experiments/ -- Performance assessment, free-tier capacity analysis, hosting comparison