How Buddy Works

A visual guide to our technical architecture and data flow

System Architecture

Client Layer

Mobile App (React Native)
iOS & Android • Chat Interface • Mood Tracking

API Layer

Chat API
Message handling
Safety API
Crisis detection
Analytics API
Progress tracking

Service Layer

Google Gemini AI
Natural language processing
Email Service (Resend)
Guardian alerts

Data Layer

PostgreSQL Database
Users • Conversations • Messages • Crisis Incidents • User Profiles

Conversation Flow

1

User Sends Message

Teen types message in mobile app and sends to Buddy

2

Crisis Detection

AI analyzes message for crisis keywords (self-harm, suicide, etc.)

3

AI Processing

Google Gemini generates empathetic, age-appropriate response

4

Save to Database

Store conversation, update user profile, track patterns

5

Guardian Alert (if needed)

If crisis detected, email guardian with details and resources

6

Response Delivered

User receives Buddy's response in real-time

Security & Privacy

Data Protection

  • • End-to-end encryption for all messages
  • • COPPA & GDPR compliant
  • • Secure PostgreSQL database
  • • Regular security audits

Privacy First

  • • Conversations never shared publicly
  • • Guardian alerts only for crises
  • • User controls their data
  • • Transparent privacy policy

Technology Stack

Frontend

React Native, Expo, TanStack Query

Backend

Node.js, Next.js API Routes

Database

PostgreSQL (Neon)