A modern SaaS application that analyzes facial attractiveness using AI, built with Next.js, TypeScript, and Tailwind CSS.
- AI-Powered Face Analysis: Uses face-api.js for client-side face detection and analysis
- Consistent Results: Same photo always returns the same rating (SHA-256 hashing)
- Credit System: Free tier with 1 anonymous rating, 5 credits for registered users
- Referral Program: Earn 10 credits per successful referral
- Authentication: Email/password and Google OAuth via NextAuth.js
- Modern UI: Responsive design with Framer Motion animations
- SEO Optimized: Comprehensive metadata, sitemap, and Open Graph tags
- GDPR Compliant: Privacy-first approach, photos never stored
- French Language: All UI and content in French
Before you begin, ensure you have:
- Node.js 18+ installed
- PostgreSQL database (or Supabase account)
- Google OAuth credentials (optional, for Google login)
- Clone the repository
git clone <your-repo-url>
cd combiensur10- Install dependencies
npm install- Set up environment variables
Create a .env.local file in the root directory:
# Database
DATABASE_URL="postgresql://user:password@localhost:5432/combiensur10?schema=public"
# Supabase (if using Supabase)
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
# NextAuth
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your_nextauth_secret_here_generate_with_openssl_rand_base64_32
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
# Application
NEXT_PUBLIC_APP_URL=http://localhost:3000
REFERRAL_CREDITS_AMOUNT=10
INITIAL_SIGNUP_CREDITS=5- Generate NextAuth secret
openssl rand -base64 32- Set up the database
npx prisma migrate dev --name init
npx prisma generate- Download face-api.js models
Create a public/models directory and download the required models from the face-api.js repository:
tiny_face_detector_model-weights_manifest.jsontiny_face_detector_model-shard1face_landmark_68_model-weights_manifest.jsonface_landmark_68_model-shard1face_recognition_model-weights_manifest.jsonface_recognition_model-shard1
Or use this command:
mkdir -p public/models
cd public/models
wget https://raw.githubusercontent.com/justadudewhohacks/face-api.js/master/weights/tiny_face_detector_model-weights_manifest.json
wget https://raw.githubusercontent.com/justadudewhohacks/face-api.js/master/weights/tiny_face_detector_model-shard1
wget https://raw.githubusercontent.com/justadudewhohacks/face-api.js/master/weights/face_landmark_68_model-weights_manifest.json
wget https://raw.githubusercontent.com/justadudewhohacks/face-api.js/master/weights/face_landmark_68_model-shard1
wget https://raw.githubusercontent.com/justadudewhohacks/face-api.js/master/weights/face_recognition_model-weights_manifest.json
wget https://raw.githubusercontent.com/justadudewhohacks/face-api.js/master/weights/face_recognition_model-shard1
cd ../..- Run the development server
npm run devOpen http://localhost:3000 with your browser to see the result.
combiensur10/
├── app/ # Next.js app directory
│ ├── api/ # API routes
│ │ ├── auth/[...nextauth]/ # NextAuth configuration
│ │ ├── upload/ # Image upload endpoint
│ │ ├── analyze/ # Face analysis endpoint
│ │ ├── credits/ # Credit management
│ │ ├── referral/ # Referral tracking
│ │ └── signup/ # User registration
│ ├── auth/ # Authentication pages
│ ├── dashboard/ # User dashboard
│ ├── result/[id]/ # Result display page
│ ├── about/ # About page
│ ├── privacy/ # Privacy policy
│ ├── terms/ # Terms of service
│ ├── layout.tsx # Root layout
│ ├── page.tsx # Homepage
│ ├── sitemap.ts # Dynamic sitemap
│ └── robots.ts # Robots.txt
├── components/ # React components
│ ├── Navbar.tsx
│ ├── Footer.tsx
│ ├── GenderSelector.tsx
│ ├── ImageUploader.tsx
│ ├── RatingDisplay.tsx
│ ├── CreditBadge.tsx
│ ├── ShareButtons.tsx
│ ├── ReferralSection.tsx
│ └── SessionProvider.tsx
├── lib/ # Utility functions
│ ├── prisma.ts # Prisma client
│ ├── supabase.ts # Supabase client
│ ├── auth.ts # Auth helpers
│ ├── credits.ts # Credit management
│ ├── referrals.ts # Referral system
│ ├── image-hash.ts # Image hashing
│ ├── anonymous-tracking.ts # Anonymous user tracking
│ └── face-rating.ts # Face analysis algorithm
├── prisma/
│ └── schema.prisma # Database schema
├── public/
│ └── models/ # Face-api.js models
├── types/
│ └── next-auth.d.ts # NextAuth type extensions
└── middleware.ts # Route protection
The face rating algorithm uses face-api.js to:
- Detect faces in uploaded images
- Extract 68 facial landmarks
- Calculate symmetry score (left vs right comparison)
- Evaluate proportions based on golden ratio
- Assess feature quality and spacing
- Generate a deterministic score (1-10)
- Anonymous users: 1 free rating
- New accounts: 5 credits
- Referrals: 10 credits per successful referral
- Credits are tracked per user with full transaction history
- Images are hashed using SHA-256
- Results are cached in database by hash
- Same image always returns same score (from cache)
- Photos are never stored on servers
- Analysis happens client-side in browser
- Only analysis results are saved (not images)
- Passwords are hashed with bcrypt
- GDPR compliant
- CSRF protection via NextAuth
All pages are fully responsive with:
- Mobile-first approach
- Tailwind CSS breakpoints
- Touch-friendly interactions
- Optimized for all screen sizes
Smooth animations using Framer Motion:
- Page transitions
- Component entrance animations
- Hover effects
- Score reveal animations
- Push your code to GitHub
- Import project in Vercel
- Add environment variables
- Deploy
Before first deployment:
npx prisma migrate deployMake sure to set all environment variables in your production environment:
DATABASE_URL: Your production database connection stringNEXTAUTH_URL: Your production domain (e.g., https://combiensur10.fr)NEXTAUTH_SECRET: Generate a new secret for productionGOOGLE_CLIENT_ID&GOOGLE_CLIENT_SECRET: OAuth credentialsNEXT_PUBLIC_APP_URL: Your production URL
To test the application:
- Anonymous user flow: Upload image without account
- Sign up flow: Create account with referral code
- Credit system: Verify credits awarded/deducted
- Referral system: Test referral link and credit rewards
- Consistency: Upload same image twice, verify same score
Consider adding:
- Google Analytics
- PostHog
- Plausible Analytics
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
This project is proprietary and confidential.
For support, email contact@combiensur10.fr
- face-api.js for face detection
- Next.js team for the amazing framework
- Vercel for hosting platform
- All contributors and users
Built with ❤️ using Next.js, TypeScript, and Tailwind CSS