How ru-mais/datie works
Purpose and Runtime
Datie is a security-focused dating platform built with Next.js 15 App Router and React. Firebase supplies authentication and Firestore persistence; Google Cloud Vision moderates profile images. The application’s primary shell is src/app/layout.tsx, with the landing route at src/app/page.tsx.
Identity and Session Boundary
Authentication state is centralized in src/context/AuthContext.tsx, backed by Firebase initialization in src/lib/firebase.ts. The login and signup flows at src/app/login/page.tsx and src/app/signup/page.tsx implement the phone-first identity gate, linking verified phone identity to account credentials. SMS OTP dispatch is server-mediated by src/app/api/send-otp/route.ts.
Profile Lifecycle
Authenticated users manage their own dating profile through src/app/profile/page.tsx; public or matched-user inspection is routed through src/app/profile/[uid]/page.tsx. Profile completeness is an important eligibility boundary because discovery excludes incomplete profiles. Uploaded profile media passes through server-side image safety evaluation before it can become usable profile content.
AI Content-Moderation Service
src/app/api/vision/route.ts is the backend boundary for Google Cloud Vision Safe Search analysis. It receives image-review requests from the client, calls the external Vision API using server-side credentials, and determines whether content such as explicit material, violence, or spoofing should be blocked. This keeps the Vision API key outside browser code.
Discovery, Likes, and Match Formation
src/app/discover/page.tsx is the candidate-feed entry point. Its Firestore-driven selection is intended to omit blocked, previously liked, and incomplete profiles. Match-oriented views are separated into src/app/matches/page.tsx and individual chat routes under src/app/chat/[matchId]/page.tsx, where reciprocal interest becomes a durable match/chat relationship.
Messaging and Safety Controls
Match-specific conversations are hosted at src/app/chat/[matchId]/page.tsx. The chat layer applies real-time client interaction controls for profanity and suspicious external links, while Firestore is the durable conversation store. User-level blocking and message editing/deletion are part of the control model and must align with Firestore authorization rules in firestore.rules.
Administration and Data Operations
Administrative operations are isolated from user-facing routes: src/app/admin/page.tsx provides the admin entry point and src/app/api/admin/cleanup-user/route.ts provides a privileged cleanup endpoint. This boundary is material because account cleanup may span Firebase Auth and Firestore records and therefore requires stronger authorization than ordinary client operations.
Navigation and Enforcement
src/components/Navbar.tsx provides shared navigation across the App Router’s principal surfaces. Client behavior is constrained by Firebase/Firestore security policy in firestore.rules; API routes handle operations requiring secrets or elevated service integration, while browser code uses public Firebase configuration from src/lib/firebase.ts.
Main entry points: Navbar.tsx Shared navigation · route.ts User cleanup endpoint · AuthContext.tsx Auth state · layout.tsx App shell
Components 19
App Router UI
- App shell · Shared application shell.
src/app/layout.tsx - Shared navigation
src/components/Navbar.tsx - Landing route
src/app/page.tsx - Profile management · Authenticated user profile lifecycle.
src/app/profile/page.tsx - Profile inspection · Views public or matched-user profiles.
src/app/profile/[uid]/page.tsx - Discovery feed · Excludes blocked, liked, and incomplete profiles.
src/app/discover/page.tsx - Matches · Reciprocal likes become durable matches.
src/app/matches/page.tsx - Match chat · Realtime messaging with client safety controls.
src/app/chat/[matchId]/page.tsx
Identity
- Auth state · Central client session boundary.
src/context/AuthContext.tsx - Firebase client · Public browser Firebase configuration.
src/lib/firebase.ts - Login
src/app/login/page.tsx - Signup · Phone-first account enrollment.
src/app/signup/page.tsx
Server Services
- SMS OTP endpoint · Server-mediated OTP dispatch.
src/app/api/send-otp/route.ts - Image moderation · Server-side Safe Search decision boundary.
src/app/api/vision/route.ts - Google Cloud Vision · Safe Search image analysis.
- Admin console
src/app/admin/page.tsx - User cleanup endpoint · Coordinates account cleanup across Auth and Firestore.
src/app/api/admin/cleanup-user/route.ts
Data & Policy
- Firestore · Profiles, likes, matches, blocks, and conversations.
- Firestore policy · Authorizes client data operations.
firestore.rules
Connections 19
- App shell → Shared navigation: renders
- App shell → Landing route: hosts
- Shared navigation → Login: navigates
- Shared navigation → Discovery feed: navigates
- Auth state → Firebase client: uses
- Login → Auth state: establishes session
- Signup → SMS OTP endpoint: requests OTP
- Signup → Auth state: creates session
- Profile management → Image moderation: reviews uploads
- Image moderation → Google Cloud Vision: Safe Search request
- Profile management → Firestore: stores profile
- Profile inspection → Firestore: reads profile
- Discovery feed → Firestore: queries eligible candidates
- Matches → Firestore: reads matches
- Match chat → Firestore: realtime messages
- Firestore → Firestore policy: client access enforced by
- Admin console → User cleanup endpoint: invokes
- User cleanup endpoint → Firestore: cleans records
- User cleanup endpoint → Firebase client: cleanup spans Firebase identity