Mental Health Support Platform — Northern Bukidnon State College "Safety Through Pseudonymity"
- Frontend: Ionic React + TypeScript + Capacitor
- Backend: Supabase (PostgreSQL + Realtime + RLS)
project-aegis/
├── src/
│ ├── types/index.ts # Shared TypeScript types
│ ├── services/
│ │ ├── supabaseClient.ts # Supabase instance
│ │ ├── authService.ts # Ghost Profile registration + session
│ │ ├── chatService.ts # Realtime messaging
│ │ ├── moodService.ts # Mood logging
│ │ └── sosService.ts # SOS event logging
│ ├── hooks/
│ │ └── useAuth.ts # Auth state hook
│ ├── utils/
│ │ ├── aliasGenerator.ts # Deterministic alias from aegis_id
│ │ └── encryption.ts # SHA-256 hashing + XOR obfuscation
│ ├── pages/
│ │ ├── Login.tsx # Ghost Profile registration
│ │ ├── Home.tsx # Dashboard
│ │ ├── Chat.tsx # Counselor list + conversation list
│ │ ├── ChatRoom.tsx # Realtime chat room
│ │ ├── Toolkit.tsx # CBT exercises + mood history
│ │ ├── Profile.tsx # Anonymous profile + privacy settings
│ │ └── SOSScreen.tsx # Panic Shield emergency screen
│ ├── components/
│ │ ├── ChatBox.tsx # Chat message bubble
│ │ ├── SOSButton.tsx # SOS trigger button
│ │ ├── MoodTracker.tsx # Emoji mood selector
│ │ ├── CounselorList.tsx # Counselor status rows
│ │ └── ExerciseModal.tsx # CBT exercise bottom sheet
│ ├── App.tsx # Router + tab nav
│ ├── global.css # Aegis design tokens
│ └── index.tsx # Entry point
├── supabase/
│ └── schema.sql # Full DB schema + RLS policies
├── .env.example
├── package.json
└── tsconfig.json
npm installcp .env.example .env
# Fill in REACT_APP_SUPABASE_URL and REACT_APP_SUPABASE_ANON_KEYIn your Supabase project → SQL Editor → paste contents of supabase/schema.sql → Run.
Enable Realtime for the messages table:
Supabase Dashboard → Database → Replication → toggle messages.
npm startnpm run build
npx cap add android # or ios
npx cap sync
npx cap open android- Student enters
student_id+ department on Login screen. authServicehashes the ID with SHA-256.- Checks
studentstable for a matching record (pre-seeded by registrar). - If found, generates a deterministic
aegis_id+alias(e.g.Blue-Owl-42). - Creates a
profilesrow — no real name stored. - Session saved to localStorage (obfuscated).
| Concern | Approach |
|---|---|
| Real identity in chat | Never. Only alias used in all chat tables |
| Student ID storage | SHA-256 hashed before any DB write |
| Local session | XOR-obfuscated in localStorage |
| Message privacy | Auto-cleared from localStorage on session end |
| Row-level security | Enabled on all Supabase tables |
For production: replace XOR obfuscation with AES-GCM (Web Crypto API) and move student validation to a Supabase Edge Function to protect the
studentstable with a service key.
- Ghost Profile registration (alias + aegis_id)
- Counselor status (online / in_session / offline)
- Realtime encrypted chat (student ↔ counselor)
- Panic Shield SOS with hotlines + grounding exercise
- Mood tracker (emoji-based, logged to Supabase)
- CBT toolkit (Box Breathing, Grounding, Thought Journal, PMR)
- Anonymous profile with privacy toggles
- Auto-clear local messages on session end
- Mobile-first UI with bottom tab navigation