A comprehensive Customer Relationship Management (CRM) system built with Next.js 15, TypeScript, and MongoDB. This application provides a complete dashboard for managing clients, projects, payments, invoices, team members, and more.
- Analytics Dashboard: Real-time overview of key metrics including total clients, projects, payments, and revenue
- Recent Activity: Quick access to recent projects and clients
- Visual Insights: Interactive cards displaying important business metrics
- Create, view, update, and delete client profiles
- Store comprehensive client information (name, email, phone, location, company details)
- Track client-specific projects and payments
- View client history and activity
- Create and manage projects with detailed information
- Project properties include:
- Name, slug, description, and notes
- Thumbnail and banner images
- Budget tracking and deadline management
- Project status (ONGOING, COMPLETE)
- Custom and free domain links
- Start and end dates
- Associate projects with clients
- Manage project modules and tasks
- Track project progress with visual indicators
- Organize projects into modules
- Create and manage tasks within each module
- Task statuses: TODO, IN PROGRESS, COMPLETED
- Drag-and-drop task organization (using @dnd-kit)
- Assign tasks to team members
- Track task completion and progress
- Record and track all payments
- Payment details include:
- Amount and tax
- Payment method
- Invoice number generation
- Payment date tracking
- Link payments to specific projects and clients
- Generate payment reports
- Built-in email composer
- Send emails directly from the dashboard
- Email templates using React Email
- Email integration for client communication
- Upload and organize files in folders
- File management with UploadThing integration
- Store files associated with projects
- Track file metadata (name, type, size)
- Secure file storage and retrieval
- Add and manage team members
- Assign members to specific projects
- Define member roles and responsibilities
- Track member contributions
- Create and showcase portfolio items
- Display project work publicly
- Portfolio profile customization
- Social media integration (Twitter, LinkedIn, Instagram, GitHub, YouTube)
- Customize company branding
- Update company logo and description
- Manage business profile information
- Manage email subscribers
- Track subscription dates
- Email list management for newsletters
- Share project links with external guests
- Allow guest access without full authentication
- Track guest project views
- Next.js 15: React framework with App Router
- TypeScript: Type-safe development
- Tailwind CSS: Utility-first CSS framework
- Radix UI: Accessible component primitives
- Framer Motion: Animation library
- TanStack Table: Powerful table library for data display
- React Hook Form: Form state management and validation
- MongoDB: NoSQL database via Prisma ORM
- Prisma: Type-safe database ORM
- NextAuth.js: Authentication with GitHub and Google OAuth
- Tiptap: Rich text editor
- Recharts: Data visualization and charts
- UploadThing: File upload handling
- PostHog: Product analytics
- Zod: Schema validation
- date-fns/dayjs: Date manipulation
- React Hot Toast / Sonner: Toast notifications
Before you begin, ensure you have the following installed:
- Node.js (v18 or higher)
- npm, yarn, or pnpm package manager
- MongoDB Atlas account (or local MongoDB instance)
- Git
-
Clone the repository
git clone https://github.com/duster5070/CRM.git cd "CRM Project Main"
-
Install dependencies
npm install # or pnpm install # or yarn install
-
Set up environment variables
Create a
.envfile in the root directory and add the following variables:# Database DATABASE_URL="mongodb+srv://<username>:<password>@<cluster>.mongodb.net/<database>?retryWrites=true&w=majority" # NextAuth NEXTAUTH_SECRET="<generate-a-secure-random-string>" NEXTAUTH_URL="http://localhost:3000" # GitHub OAuth GITHUB_CLIENT_ID="<your-github-client-id>" GITHUB_SECRET="<your-github-secret>" # Google OAuth GOOGLE_CLIENT_ID="<your-google-client-id>" GOOGLE_CLIENT_SECRET="<your-google-client-secret>" # UploadThing UPLOADTHING_SECRET="<your-uploadthing-secret>" UPLOADTHING_APP_ID="<your-uploadthing-app-id>" # PostHog Analytics NEXT_PUBLIC_POSTHOG_HOST="https://app.posthog.com" NEXT_PUBLIC_POSTHOG_KEY="<your-posthog-key>"
-
Set up the database
npx prisma generate npx prisma db push
npm run devOpen http://localhost:3000 in your browser.
npm run build
npm run startnpm run lintCRM Project Main/
βββ app/ # Next.js App Router
β βββ (auth)/ # Authentication pages
β β βββ login/
β β βββ register/
β βββ (dashboard)/ # Dashboard pages
β β βββ dashboard/
β β βββ clients/ # Client management
β β βββ projects/ # Project management
β β βββ payments/ # Payment tracking
β β βββ emails/ # Email composer
β β βββ file-manager/ # File management
β β βββ members/ # Team members
β β βββ portfolio/ # Portfolio items
β β βββ brand-settings/ # Brand customization
β β βββ subscribers/ # Subscriber management
β β βββ guest-projects/ # Guest project links
β β βββ page.tsx # Dashboard home
β βββ (project)/ # Project detail pages
β β βββ project/
β β βββ modules/[id]/ # Module and task management
β βββ api/ # API routes
β β βββ auth/ # NextAuth configuration
β β βββ uploadthing/ # File upload endpoints
β βββ layout.tsx # Root layout
β βββ globals.css # Global styles
βββ components/ # React components
β βββ dashboard/ # Dashboard-specific components
β βββ FormInputs/ # Form input components
β βββ Forms/ # Form components
β βββ ui/ # Shadcn UI components
β βββ DataTableColumns/ # Table column definitions
β βββ DataTableComponents/ # Table components
βββ actions/ # Server actions
β βββ analytics.ts # Analytics calculations
β βββ clients.ts # Client operations
β βββ projects.ts # Project operations
β βββ payments.ts # Payment operations
β βββ emails.ts # Email operations
β βββ filemanager.ts # File operations
β βββ module.ts # Module operations
β βββ tasks.ts # Task operations
β βββ users.ts # User operations
βββ prisma/
β βββ schema.prisma # Database schema
βββ types/
β βββ types.ts # TypeScript type definitions
βββ lib/ # Utility functions
βββ config/ # Configuration files
βββ public/ # Static assets
- Sign up for MongoDB Atlas at https://www.mongodb.com/cloud/atlas
- Create a new cluster
- Click "Connect" β "Connect your application"
- Copy the connection string and replace
<username>,<password>, and<database>
- Generate
NEXTAUTH_SECRETusing generate-secret.vercel.app - Set
NEXTAUTH_URLto your application URL (e.g.,http://localhost:3000)
- Go to GitHub Developer Settings
- Click "New OAuth App"
- Set Authorization callback URL to
{NEXTAUTH_URL}/api/auth/callback/github - Copy the Client ID and Client Secret
- Go to Google Cloud Console
- Create a new project β "APIs & Services" β "Credentials"
- Create "OAuth client ID" (Web application)
- Add authorized redirect URI:
{NEXTAUTH_URL}/api/auth/callback/google - Copy Client ID and Client Secret
- Visit UploadThing and create an account
- Create a new project
- Copy
UPLOADTHING_SECRETandUPLOADTHING_APP_IDfrom project settings
- Sign up at PostHog
- Create a new project
- Copy the API host and project API key from settings
The application uses MongoDB with Prisma ORM. Key models include:
- User: System users with roles (USER, ADMIN, CLIENT, MEMBER)
- Project: Project information and tracking
- Module: Project modules for organization
- Task: Individual tasks within modules
- Payment: Payment records and tracking
- Invoice: Invoice generation and management
- Member: Team members assigned to projects
- ProjectComment: Comments on projects
- Folder: File organization folders
- File: Uploaded files and documents
- PortfolioItem: Portfolio showcase items
- PortfolioProfile: User portfolio profiles
- Subscriber: Email subscribers
- GuestProject: Shared project links
Built with Radix UI and styled with Tailwind CSS:
- Forms with validation
- Data tables with sorting and filtering
- Modal dialogs
- Dropdown menus
- Tooltips and popovers
- Accordions and tabs
- Progress indicators
- Toast notifications
- NextAuth.js authentication
- Role-based access control (USER, ADMIN, CLIENT, MEMBER)
- Secure password hashing with bcrypt
- OAuth integration (GitHub, Google)
- Protected API routes
- Environment variable protection
This project is private and proprietary.
For contribution guidelines, please contact the project maintainers.
For issues and questions, please create an issue in the repository or contact the development team.