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
- Google OAuth credentials (optional, for Google login)
- Clone the repository
git clone <your-repo-url>
cd face10ai- 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/face10ai?schema=public"
# 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
# AttractiveNet API (optional - for AI beauty scoring)
NEXT_PUBLIC_PYTHON_API_URL=http://localhost:8000
NEXT_PUBLIC_USE_ATTRACTIVENET=true- 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 ../..- Install Python dependencies (for AttractiveNet API)
If you want to use the AttractiveNet model for AI-powered beauty scoring:
If you have Python 3.12+ (like Python 3.14): π See training/WINDOWS_SETUP.md for detailed setup instructions.
Quick start (if you have Python 3.11):
Windows:
cd training
py -3.11 -m venv venv
.\venv\Scripts\Activate.ps1
pip install -r requirements-windows.txtmacOS/Linux:
cd training
python3.11 -m venv venv
source venv/bin/activate
pip install -r requirements.txtSee training/INSTALL_WINDOWS.md for detailed Windows installation instructions.
For macOS/Linux:
cd training
pip install -r requirements.txtNote: If you encounter TensorFlow installation errors, you're likely using Python 3.12+. Install Python 3.11 and use it specifically.
- Run the development server
In one terminal, start the Next.js app:
npm run devOpen http://localhost:3000 with your browser to see the result.
Note: Face scoring now runs entirely in the browser using TensorFlow.js models (public/models/beauty_model_male and public/models/beauty_model_female). There is no geometric fallback and no separate AttractiveNet API process; if the AI models are missing or fail to load, scoring will be unavailable until this is fixed.
face10ai/
βββ 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://face10ai.com)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@face10ai.com
- 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