The modernmen-yolo project is a multi-tenant barbershop management system built with Next.js 14, Payload CMS, and MongoDB. It includes features like a customer portal, admin dashboard, booking chatbot, hair simulator, loyalty program, events, responsive image optimization, and advanced barber profiles with mini social media features.
- Location:
/portal/barbers/[barberId] - Features:
- Displays barber’s name, bio, photo, specialties, and services.
- Portfolio gallery with responsive images (WebP,
srcset) viaImagePlugin. - Client testimonials with comments and likes (stored in
Testimonialscollection). - Social sharing buttons for Facebook, Twitter, Instagram.
- “Book Now” button integrated with
BookingChatbot. - Follow functionality with email notifications.
- Configuration:
- Managed via
Settingscollection (/admin/payload/collections/settings). - Enable/disable profiles, comments, likes, and sharing via
barberProfilesgroup.
- Managed via
- API Routes:
GET /api/barber-profiles/[barberId]: Fetch profile data.POST /api/testimonials: Create a testimonial.PATCH /api/testimonials/[id]: Like or moderate testimonials.
- Gotchas Addressed:
- Multi-tenant isolation with
X-Tenant-IDheader validation. - Performance optimized with caching and lazy loading.
- Accessibility with ARIA labels and keyboard navigation.
- Error handling for missing settings or invalid barber IDs.
- Multi-tenant isolation with
# Clone and start with Docker (includes PostgreSQL, Redis, pgAdmin)
git clone <repo-url>
cd modernmen-yolo
cp .env.example .env
docker-compose up- Clone the repository:
git clone <repo-url> - Install dependencies:
npm install - Configure environment variables in
.env(see.env.example). - Start PostgreSQL and Redis services
- Run database migrations:
npm run db:push - Seed initial data:
npm run db:seed - Run the development server:
npm run dev - Access the admin panel:
http://localhost:3000/admin/payload - Access the customer portal:
http://localhost:3000/portal
This project includes advanced AI-powered development tools and automation:
- Automated Code Review: AI analyzes pull requests for quality, security, and performance
- Documentation Generation: Automatically generates comprehensive API and component documentation
- Security Auditing: AI-powered security analysis and vulnerability detection
- Performance Analysis: Bundle size optimization and performance recommendations
- Changelog Generation: Automated changelog creation from commits
- GitHub Actions: Fully integrated with CI/CD pipeline
- OpenAI GPT-4: Uses OpenAI for advanced AI analysis
- Automated PR Comments: AI provides feedback directly on pull requests
- Security Monitoring: Continuous security scanning and alerts
- Configure OpenAI API key in GitHub secrets
- Push changes to trigger automated code review
- Use manual workflows for documentation and security audits
- Review AI-generated insights in workflow logs and PR comments
- pgAdmin: http://localhost:8080 (PostgreSQL admin interface)
- Redis Commander: http://localhost:8081 (Redis admin interface)
- Storybook:
npm run storybook(Component development) - Bundle Analyzer:
npm run bundle:analyze(Performance analysis)
This project implements a comprehensive testing strategy:
- Unit Tests: Individual functions and components (
npm run test:unit) - Integration Tests: API endpoints and database interactions (
npm run test:integration) - E2E Tests: Full user workflows with Playwright (
npm run test:e2e)
# All tests
npm test
# With coverage
npm run test:coverage
# Watch mode
npm run test:watch
# Specific test types
npm run test:unit
npm run test:integration
npm run test:e2e- Target: 70% coverage across statements, branches, functions, and lines
- Reports generated automatically in CI/CD
- View coverage:
npm run test:coveragethen opencoverage/lcov-report/index.html
For detailed testing information, see TESTING.md.
# .env.example
DATABASE_URI=mongodb://localhost:27017/modernmen
PAYLOAD_SECRET=your-secret
OPENAI_API_KEY=sk-...
BUNNY_API_KEY=...
BUNNY_STORAGE_ZONE=modernmen
STRIPE_SECRET_KEY=sk_...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_...
GOOGLE_CLIENT_ID=...
GOOGLE_CLIENT_SECRET=...
GOOGLE_REDIRECT_URI=https://yourdomain.com/api/oauth/callback
SMTP_HOST=smtp.example.com
SMTP_USER=user
SMTP_PASS=pass
- Deploy to Vercel:
vercel --prod - Ensure MongoDB is configured with indexes for
Users,Testimonials, andAppointments. - Set up Bunny CDN for media storage.
- Configure Stripe webhooks and Google Calendar OAuth.
- Important: For production, ensure
NEXTAUTH_URLin your.envis set to anhttpsURL (e.g.,https://yourdomain.com). This is crucial for security, as it enables thesecureflag for authentication cookies.
- Run unit tests:
npm run test - Test multi-tenant scenarios with different
tenantIdvalues. - Verify responsive images and accessibility with Lighthouse.
- Add new features via Payload CMS collections or Next.js components.
- Ensure tenant isolation and settings integration in all changes.
- Submit pull requests with test coverage.