AI-powered personal diary application with analytics and insights.
- 📝 Smart Diary Entries - Write or voice-record your thoughts
- 🧠 AI Analysis - Get daily and weekly summaries powered by AI
- 📊 Analytics Dashboard - Track your writing patterns and insights
- 🌍 Multi-language Support - Available in multiple languages
- 🔒 Privacy First - Your data is encrypted and secure
- 📱 Responsive Design - Works on desktop and mobile
- Frontend: Next.js 15, React, TypeScript
- Styling: Tailwind CSS, shadcn/ui
- Charts: Recharts
- Backend: Supabase (PostgreSQL, Auth)
- AI: OpenAI API
- Monitoring: Sentry
- Testing: Jest
- Code Quality: Biome (linting & formatting)
- Cache: Redis (production)
- Node.js 18+
- pnpm
- Supabase account
- OpenAI API key
- Redis (for production)
- Clone the repository:
git clone <repository-url>
cd Reflecto- Install dependencies:
pnpm install- Set up environment variables:
cp .env.example .env.local- Configure your environment variables:
# Supabase
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
# Note: SUPABASE_SERVICE_ROLE_KEY is only used in Edge Functions (server-side)
# OpenAI
OPENAI_API_KEY=your_openai_api_key
# Sentry
NEXT_PUBLIC_SENTRY_DSN=your_sentry_dsn
# Redis (production only)
REDIS_URL=your_redis_url- Run the development server:
pnpm devOpen http://localhost:3000 to view the application.
This project uses Supabase Edge Functions for secure server-side operations, particularly for handling Stripe webhook events and subscription management.
create-subscription- Creates a new subscription in the databaseget-subscription-by-customer- Retrieves subscription by Stripe customer IDdelete-subscription- Deletes a subscription from the database
- Install Supabase CLI:
# macOS
brew install supabase/tap/supabase
# or via npm (not recommended for global install)
npm install -g supabase- Login to Supabase:
supabase login- Link to your project:
supabase link --project-ref YOUR_PROJECT_REF- Create a new function:
supabase functions new function-name- Deploy functions:
supabase functions deploy function-name- No service role key on client -
SUPABASE_SERVICE_ROLE_KEYis only used in Edge Functions - Isolated execution - Functions run in secure Deno environment
- Server-side operations - Database operations happen on Supabase servers
- CORS protection - Proper CORS headers for secure cross-origin requests
For local function development, you need Docker Desktop installed:
# Start local Supabase (requires Docker)
supabase start
# Serve functions locally
supabase functions serve function-name --debug- Formatters Documentation - Guide for using the
useFormattershook - Rate Limiting - API rate limiting implementation
For testing payment flows in development and Sentry:
- Payment succeeds:
4242 4242 4242 4242 - Payment requires authentication:
4000 0025 0000 3155 - Payment is declined:
4000 0000 0000 9995
For local testing of Sentry webhooks:
-
Install Sentry CLI:
# macOS brew install getsentry/tools/sentry-cli # or via npm npm install -g @sentry/cli
-
Configure Sentry CLI:
sentry-cli login
-
Start local webhook server:
sentry-cli webhook serve --url-prefix /api/sentry/webhook
-
Configure webhook URL in Sentry Dashboard to
http://localhost:3000/api/sentry/webhook
src/
├── app/ # Next.js app router pages
├── entities/ # Domain entities (notes, users, etc.)
├── features/ # Feature modules (analytics, auth, etc.)
├── shared/ # Shared components, hooks, utilities
└── widgets/ # Reusable UI widgets
This project uses Biome for linting and formatting:
# Check code quality
pnpm lint
# Fix linting issues
pnpm lint:fix
# Format code
pnpm format
# Check formatting
pnpm format:check
# Type checking
pnpm type-check
# Full check (lint + type-check)
pnpm checkpnpm dev- Start development serverpnpm build- Build for productionpnpm start- Start production serverpnpm test- Run testspnpm test:watch- Run tests in watch modepnpm test:coverage- Run tests with coveragepnpm test:integration- Run integration tests
- Fork the repository
- Create a feature branch
- Make your changes
- Run
pnpm checkto ensure code quality - Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.