The High-Performance CRM for Modern Sales Pipelines
Documentation • Report Bug • Request Feature
LeadFlow is a production-grade CRM designed to eliminate the chaos of lead management. Built with a focus on speed, type-safety, and an elite user experience, it transforms the way you track customer journeys from discovery to conversion 10/10.
Most CRMs are either too simple (spreadsheets) or too bloated (Enterprise software). LeadFlow hits the sweet spot:
- Centralized Intelligence: Stop hunting for emails across threads. Every note and activity is linked to a single contact.
- Visual Momentum: The Kanban pipeline makes it immediately obvious where leads are stalling and where the wins are.
- Zero-Latency UX: By leveraging Next.js Server Components and TanStack Query, the app feels instantaneous.
| Feature | Engineering Implementation | Business Value |
|---|---|---|
| Sales Pipeline | Four-stage Kanban board with drag-and-drop using @dnd-kit/core
|
Visualize the sales funnel at a glance. |
| Contact CRM | Full CRUD with Zod-validated API route handlers | Maintain a clean, high-integrity lead database. |
| Interaction Log | One-to-many relationship: Contacts |
Never forget a detail from a client call. |
| Secure Auth | GitHub OAuth |
Enterprise-grade security with zero-friction login. |
| Adaptive UI | Tailwind 4 + shadcn/ui + Motion | Professional look that works on mobile and desktop. |
The dashboard displays key metrics and recent activity:
- Activity/Contact Statistics: PostgreSQL raw SQL aggregates count records by stage and type.
- Pipeline Counts: Derived in JavaScript from the contact stage aggregates, applying business logic for display.
- Recent Records: Fetched with Prisma
findManyqueries, ordered by updated timestamps.
LeadFlow utilizes a layered architecture to ensure scalability and maintainability:
graph TD
A[Client Browser] -->|Request| B[Next.js App Router]
B -->|SSR/RSC| C[Server Components]
B -->|API Call| D[Next.js API Routes]
C -->|Query| E[Prisma ORM]
D -->|Query| E
E -->|SQL| F[(PostgreSQL)]
B -->|Identity| G[NextAuth.js / GitHub OAuth]
- Server Components (RSC): Used for the majority of the app to reduce the JavaScript bundle sent to the client, resulting in the 96 Performance score.
- Prisma Projection: Instead of
findMany(), I implementselectblocks to fetch only necessary columns, reducing database I/O. - Zod Validation: Every entry point (API/Form) is guarded by Zod schemas to prevent data corruption.
- Optimistic Updates: Leverages TanStack Query to make the UI feel instant even before the database confirms the change.
src/
├── app/
│ ├── (auth)/login/ # OAuth sign-in page and buttons
│ ├── (dashboard)/ # Authenticated application shell and pages
│ │ ├── dashboard/ # Stats, recent contacts, pipeline overview
│ │ ├── contacts/ # List, create, detail, edit, notes, delete
│ │ ├── pipeline/ # Drag-and-drop stage board
│ │ ├── activities/ # List, create, edit, complete, delete
│ │ └── settings/ # Profile name, theme, CSV export
│ ├── api/ # Route handlers (JSON and CSV)
│ ├── actions/
│ │ └── auth.ts # Only server action: sign out
│ ├── privacy/ # Public privacy policy
│ ├── terms/ # Public terms of service
│ ├── page.tsx # Public landing page
│ ├── layout.tsx # Fonts, providers, analytics
│ └── globals.css # Tailwind 4 import + Deal Ledger tokens
├── components/
│ ├── dashboard/ # StatCard, RecentContacts, PipelineOverview
│ ├── layout/ # Sidebar, Header, BottomNav, CommandPalette
│ ├── legal/ # LegalPageLayout
│ ├── ui/ # Button, Card primitives
│ ├── delete-button.tsx # Shared confirmation dialog
│ ├── providers.tsx # Theme + React Query providers
│ ├── reveal.tsx # Motion reveal wrapper
│ └── theme-toggle.tsx # Light/dark toggle
├── lib/
│ ├── prisma.ts # Prisma client + pg adapter + SSL
│ ├── validations/ # Zod schemas for contacts and activities
│ ├── csv.ts # CSV escaping and formula neutralization
│ ├── pagination.ts # Page clamping helper
│ └── avatar.ts # Deterministic gradient selection
├── proxy.ts # Next.js 16 proxy: CSP nonce and headers
└── auth.ts # OAuth configuration
-
Clone & Install
git clone https://github.com/Mllkmoha/LeadFlow.git cd LeadFlow/app npm install -
Configure
.envDATABASE_URL="postgresql://USER:PASSWORD@HOST:5432/DB" AUTH_SECRET="generate with: npx auth secret" AUTH_GITHUB_ID="" AUTH_GITHUB_SECRET="" AUTH_GOOGLE_ID="" AUTH_GOOGLE_SECRET=""
-
Sync Database
- Development: Run
npx prisma migrate devto create and apply migrations during local development. - Production: Run
npx prisma migrate deployto apply committed migrations to a production database. - The repository contains
prisma/migrations/0001_baseline. - Warning: Do not blindly run production migrations on a non-empty database until you have verified its migration history and baseline status.
- Development: Run
-
Launch
npm run dev
- Automated Follow-ups: System-generated reminders for overdue activities.
- Advanced Reporting: Conversion rate analytics and lead-velocity tracking.
- CSV Import: Bulk import for enterprise data migration.
- CSV Export: Contacts and activities export from Settings (notes excluded).
Mohamed Rafik Mellouk Junior Full-Stack Web Developer
I specialize in building high-performance, type-safe web applications. LeadFlow is a testament to my commitment to performance engineering, accessibility, and clean architecture.

