A comprehensive dashboard application for managing CFO services, built with Next.js, Drizzle ORM, and Neon PostgreSQL.
- Admin Dashboard: Complete overview of consultations, users, and analytics
- Authentication System: Secure JWT-based authentication with role-based access
- Consultation Management: View and manage client consultation requests
- User Management: Manage CFO service providers and administrators
- Real-time Statistics: Live dashboard metrics and analytics
- Responsive Design: Mobile-friendly interface with Tailwind CSS
- Frontend: Next.js 15, React 19, TypeScript, Tailwind CSS
- Backend: Next.js API Routes, Node.js
- Database: Neon PostgreSQL with Drizzle ORM
- Authentication: JWT tokens with HTTP-only cookies
- Deployment: Vercel-ready
- Node.js 18+ and npm
- A Neon PostgreSQL database account
- Git
git clone <your-repo-url>
cd private-cfo
npm installCreate a .env.local file in the root directory:
# Database - Replace with your Neon database URL
DATABASE_URL='postgresql://username:[email protected]/dbname?sslmode=require'
# JWT Secret - Change this in production
JWT_SECRET=your-super-secret-jwt-key-change-in-production-2024
# Application Settings
PORT=3000
NEXT_PUBLIC_APP_URL=http://localhost:3000
NODE_ENV=development
NEXT_TELEMETRY_DISABLED=1# Initialize the database with default users
npm run db:init
# Create sample consultation data (optional)
npm run db:sample
# View database in Drizzle Studio (optional)
npm run db:studionpm run devOpen http://localhost:3000 in your browser.
After running npm run db:init, you can use these credentials:
# Development
npm run dev # Start development server on port 3000
npm run dev:3001 # Start on port 3001
npm run dev:4000 # Start on port 4000
# Production
npm run build # Build for production
npm run start # Start production server
# Database
npm run db:init # Initialize database with default users
npm run db:sample # Create sample consultation data
npm run db:generate # Generate database migrations
npm run db:migrate # Run database migrations
npm run db:push # Push schema changes to database
npm run db:studio # Open Drizzle Studio
# Utilities
npm run lint # Run ESLint
npm run check-port # Check if port 3000 is availableβββ app/ # Next.js 13+ app directory
β βββ (auth)/ # Authentication pages
β βββ admin/ # Admin-only pages
β βββ api/ # API routes
β βββ dashboard/ # Dashboard pages
β βββ layout.tsx # Root layout
βββ components/ # Reusable React components
βββ lib/ # Utility libraries
β βββ auth.ts # Authentication utilities
β βββ auth-context.tsx # Auth React context
β βββ db.ts # Database connection
β βββ schema.ts # Database schema
βββ scripts/ # Database initialization scripts
βββ drizzle/ # Database migrations
βββ public/ # Static assets
- Role-based access: admin, financial_advisor, tax_consultant, investment_advisor, business_consultant
- User profiles: Name, email, phone, specialization, experience
- Authentication: Secure password hashing with bcrypt
- Client information: Name, contact details, demographics
- Consultation details: Type of guidance needed, industry, income level
- Status tracking: pending, assigned, completed, cancelled
- Assignment system: Link consultations to specific CFO providers
-
Push to GitHub:
git add . git commit -m "Initial commit" git push origin main
-
Deploy on Vercel:
- Connect your GitHub repository to Vercel
- Add environment variables in Vercel dashboard
- Deploy automatically
-
Post-deployment:
# Initialize production database npm run db:init
Make sure to set these in your deployment platform:
DATABASE_URL=your-production-neon-url
JWT_SECRET=your-production-jwt-secret
NEXTAUTH_URL=https://your-domain.com
NODE_ENV=production- JWT Authentication: Secure token-based authentication
- HTTP-only Cookies: Prevents XSS attacks
- Password Hashing: bcrypt with salt rounds
- Role-based Access: Granular permission system
- Input Validation: Server-side validation for all inputs
- SQL Injection Protection: Parameterized queries with Drizzle ORM
POST /api/auth- Login userDELETE /api/auth- Logout userGET /api/auth/verify- Verify token
GET /api/dashboard/stats- Get dashboard statisticsGET /api/consultations- Get all consultations (admin only)GET /api/admin/users- Get all users (admin only)
POST /api/consultation- Submit new consultationGET /api/consultation- Get consultations (public endpoint)
-
Database Connection Error:
- Verify your DATABASE_URL in
.env.local - Ensure your Neon database is accessible
- Check if the database exists
- Verify your DATABASE_URL in
-
Authentication Issues:
- Verify JWT_SECRET is set
- Clear browser cookies and try again
- Check if users exist in database
-
Port Already in Use:
npm run check-port # Check port availability npm run dev:3001 # Use alternative port
- Use
npm run db:studioto inspect your database - Check browser console for frontend errors
- Monitor terminal for backend logs
- Use network tab to debug API calls
- Fork the repository
- Create a feature branch:
git checkout -b feature-name - Commit changes:
git commit -m 'Add feature' - Push to branch:
git push origin feature-name - Submit a pull request
This project is private and proprietary. All rights reserved.
For support, email your development team or create an issue in the repository.
π Your Private CFO Dashboard is ready!
Access the admin panel at http://localhost:3000/sign-in using the default credentials above.