Discover your life purpose through AI-guided self-discovery
Features • Tech Stack • Getting Started • Environment Variables • Deployment • Contributing
Ikigai Finder AI is a modern web application that helps users discover their Ikigai (生き甲斐) — the Japanese concept of "a reason for being." Through an interactive, AI-powered questionnaire, users receive personalized Ikigai statements with compatibility scores and can generate beautiful, shareable cards.
- 🎯 AI-Guided Discovery — Interactive stepper form powered by GPT-4o generates unique Ikigai statements based on your responses
- 🎨 Visual Ikigai Cards — Create shareable images with custom AI-generated backgrounds via Stable Diffusion XL
- 📊 Compatibility Scores — See how your Ikigai aligns with Passion, Profession, Vocation, and Mission
- 🔐 Secure Authentication — Firebase Auth with Google Sign-In, Email/Password, and Magic Links
- 📱 Mobile-First Design — Responsive UI optimized for all devices
- 🌐 Social Sharing — Share your Ikigai on Facebook, Twitter, LinkedIn, and Email
- 💾 Progress Saving — All your journey data is saved to your profile
- 🛡️ Privacy-First — Your data stays in your Firebase account
| Package | Version | Purpose |
|---|---|---|
| Next.js | 16.x | React framework with App Router & Server Components |
| React | 19.x | UI library |
| TypeScript | 5.7+ | Type safety |
| Package | Version | Purpose |
|---|---|---|
| Firebase | 12.x | Auth, Firestore database, Cloud Storage |
| Firebase Admin | 13.x | Server-side Firebase operations |
| Package | Version | Purpose |
|---|---|---|
| Vercel AI SDK | 6.x | Streaming AI responses |
| @ai-sdk/openai | 3.x | OpenAI integration |
| @ai-sdk/rsc | 2.x | React Server Components streaming |
| Package | Version | Purpose |
|---|---|---|
| Zustand | 5.x | Lightweight global state management |
| react-firebase-hooks | 5.x | Firebase React hooks |
| Package | Version | Purpose |
|---|---|---|
| Tailwind CSS | 4.x | Utility-first CSS framework |
| Lucide React | 0.563+ | Beautiful icon library |
| React Hook Form | 7.x | Performant form handling |
| React Hot Toast | 2.x | Toast notifications |
| React Select | 5.x | Advanced select inputs |
| React Slick | 0.31+ | Carousel/slider component |
| React Spinners | 0.17+ | Loading indicators |
| React Tooltip | 5.x | Tooltips |
| React Share | 5.x | Social sharing buttons |
| React Cookie Consent | 10.x | GDPR cookie consent banner |
| Package | Version | Purpose |
|---|---|---|
| AnyChart React | 1.4+ | Venn diagram visualization |
| Package | Version | Purpose |
|---|---|---|
| Zod | 4.x | Schema validation |
| dotenv | 17.x | Environment variable loading |
| html2canvas | 1.4+ | Screenshot capture for sharing |
| react-textarea-autosize | 8.x | Auto-resizing textareas |
- Node.js 18.17 or later
- npm, yarn, pnpm, or bun
- Firebase Project with Firestore, Storage, and Authentication enabled
- OpenAI API Key for GPT-4o access
- Fireworks AI API Key for image generation
-
Clone the repository:
git clone https://github.com/yourusername/ikigaifinder.git cd ikigaifinder -
Install dependencies:
npm install # or yarn install # or pnpm install
-
Set up environment variables:
cp env.sample .env.local
Then edit
.env.localwith your actual credentials (see Environment Variables). -
Set up Firebase:
- Deploy Firestore rules:
firebase deploy --only firestore:rules - Deploy Storage rules:
firebase deploy --only storage:rules
- Deploy Firestore rules:
-
Run the development server:
npm run dev
-
Open your browser: Navigate to http://localhost:3000
Create a .env.local file in the root directory with the following variables:
# Service Account credentials (from Firebase Console > Project Settings > Service Accounts)
FIREBASE_TYPE=service_account
FIREBASE_PROJECT_ID=your_project_id
FIREBASE_PRIVATE_KEY_ID=your_private_key_id
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----\n"
FIREBASE_CLIENT_EMAIL=firebase-adminsdk-xxxxx@your_project_id.iam.gserviceaccount.com
FIREBASE_CLIENT_ID=your_client_id
FIREBASE_AUTH_URI=https://accounts.google.com/o/oauth2/auth
FIREBASE_TOKEN_URI=https://oauth2.googleapis.com/token
FIREBASE_AUTH_PROVIDER_X509_CERT_URL=https://www.googleapis.com/oauth2/v1/certs
FIREBASE_CLIENT_CERTS_URL=https://www.googleapis.com/robot/v1/metadata/x509/...
FIREBASE_UNIVERSE_DOMAIN=googleapis.com# From Firebase Console > Project Settings > General > Your apps
NEXT_PUBLIC_FIREBASE_APIKEY=AIzaSy...
NEXT_PUBLIC_FIREBASE_AUTHDOMAIN=your_project_id.firebaseapp.com
NEXT_PUBLIC_FIREBASE_PROJECTID=your_project_id
NEXT_PUBLIC_FIREBASE_STORAGEBUCKET=your_project_id.firebasestorage.app
NEXT_PUBLIC_FIREBASE_MESSAGINGSENDERID=123456789
NEXT_PUBLIC_FIREBASE_APPID=1:123456789:web:abc123
NEXT_PUBLIC_FIREBASE_MEASUREMENTID=G-XXXXXXX# OpenAI (https://platform.openai.com/api-keys)
OPENAI_API_KEY=sk-...
OPENAI_ORG_ID=org-... # Optional
# Fireworks AI (https://fireworks.ai/)
FIREWORKS_API_KEY=fw_...# Cookie name for auth token storage (used by client-side helpers if needed)
NEXT_PUBLIC_COOKIE_NAME=ikigaiAuthToken
# Server session cookie settings (used by src/proxy.ts + server auth helpers)
FIREBASE_SESSION_COOKIE_NAME=__session
FIREBASE_SESSION_EXPIRES_DAYS=5
# Base URL for metadata (optional, defaults to https://ikigaifinder.ai)
NEXT_PUBLIC_BASE_URL=https://your-domain.comikigaifinder/
├── public/ # Static assets
│ ├── assets/ # Images, icons, SVGs
│ └── .well-known/ # App association files
├── src/
│ ├── app/ # Next.js App Router
│ │ ├── api/ # API routes
│ │ ├── dashboard/ # User dashboard
│ │ ├── generate-ikigai/ # Ikigai generation flow
│ │ ├── ikigai/[id]/ # Shareable ikigai pages
│ │ ├── ikigai-finder/ # Main questionnaire
│ │ ├── profile/ # User profile
│ │ └── ... # Other pages
│ ├── components/ # React components
│ │ ├── auth/ # Authentication (Modal, Forms)
│ │ ├── ui/ # Reusable UI components
│ │ └── ... # Feature components
│ ├── constants/ # App constants & questions
│ ├── firebase/ # Firebase client & admin setup
│ ├── hooks/ # Custom React hooks
│ │ ├── use-auth-actions.ts
│ │ ├── use-auth-token.ts
│ │ └── use-ikigai-generator.ts
│ ├── lib/ # Core libraries
│ │ ├── generateIkigai.ts # AI text generation
│ │ ├── generateImage.ts # AI image generation
│ │ ├── rateLimit.ts # Rate limiting
│ │ ├── validation.ts # Zod schemas
│ │ └── errors.ts # Custom error classes
│ ├── services/ # Data layer
│ │ ├── ikigaiService.ts
│ │ ├── profileService.ts
│ │ └── userService.ts
│ ├── types/ # TypeScript definitions
│ ├── utils/ # Helper functions
│ └── zustand/ # State management
│ ├── useAuthStore.ts
│ ├── useIkigaiStore.ts
│ ├── useProfileStore.ts
│ └── useUIStore.ts
├── firestore.rules # Firestore security rules
├── storage.rules # Storage security rules
├── src/proxy.ts # Next.js 16 proxy (route protection)
└── ...
- Go to Firebase Console
- Create a new project or select an existing one
- Enable the following services:
- Authentication → Enable Google and Email/Password providers
- Firestore Database → Create in production mode
- Storage → Create default bucket
- Go to Project Settings → General → Your apps
- Add a Web app if you haven't already
- Copy the Firebase config object
- Go to Project Settings → Service Accounts
- Click "Generate new private key"
- Save the JSON file securely
- Use the values in your
.env.local
The project includes security rules for both Firestore and Storage:
# Install Firebase CLI
npm install -g firebase-tools
# Login to Firebase
firebase login
# Initialize (select Firestore and Storage)
firebase init
# Deploy rules
firebase deploy --only firestore:rules,storage:rules- Push your code to GitHub
- Import the project in Vercel
- Add all environment variables in Project Settings
- Deploy
The app can be deployed to any platform that supports Next.js 16:
- Netlify — Use the Next.js runtime
- AWS Amplify — SSR support for Next.js
- Self-hosted —
npm run build && npm start
npm run dev # Start development server
npm run build # Create production build
npm run start # Start production server
npm run lint # Run ESLint- 🔒 Route Protection via Next.js 16 proxy middleware
- 🔐 Firebase Security Rules for Firestore and Storage
- 🛡️ Content Security Policy headers
- ⚡ Rate Limiting on AI endpoints (20 text, 5 image per minute)
- 🧹 Input Sanitization for all user inputs
- 🚫 Content Moderation for image prompts
Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes and commit:
git commit -m "Add amazing feature" - Push to your fork:
git push origin feature/amazing-feature
- Open a Pull Request
- Follow the existing code style (Prettier/ESLint)
- Use TypeScript for all new code
- Add proper JSDoc comments for functions
- Use atomic Zustand selectors for performance
- Prefer Server Components where possible
This project is open source and available under the GNU Affero General Public License v3.0 (AGPL-3.0).
See LICENSE.md.
Built with ❤️ using Next.js, Firebase, and AI