This file provides guidance for AI assistants working on the Compass codebase.
Compass (compassmeet.com) is a transparent dating platform for forming deep, authentic 1-on-1 connections. Built with Next.js, React, Supabase, Firebase, and Google Cloud.
/web # Next.js frontend (React, Tailwind CSS)
/backend/api # Express.js REST API
/backend/shared # Shared backend utilities
/backend/email # Email functions
/common # Shared types and utilities between frontend/backend
/supabase # Database schema and migrations
/android # Android mobile app
- Use
createSupabaseDirectClient()for backend SQL queries (pg-promise) - Use Supabase JS client (
db.from('table')) for frontend queries - Never use string concatenation for SQL - use parameterized queries
- Add endpoint schema to
common/src/api/schema.ts - Create handler in
backend/api/src/ - Register in
backend/api/src/app.ts
- Export main component at top of file
- Name component same as file (e.g.,
profile-card.tsx→ProfileCard) - Use smaller, composable components over large ones
- Translation files in
common/messages/(en.json, fr.json, de.json) - Use
useT()hook:t('key', 'fallback')
- Unit tests:
*.unit.test.tsin packagetests/unit/ - Mock external dependencies (DB, APIs, time)
- Use
jest.mock()at top of test files
- Profile fields stored in
profilestable - Options (interests, causes, work) stored in separate tables with many-to-many relationship
- Always fetch profile options in parallel using Promise.all
- Create user + profile + options in single transaction
- Never use sleep() hacks - rely on transactional integrity
- Return full profile data from creation API
const result = await api('endpoint-name', {props})const {data} = useAPIGetter('endpoint-name', {props})const t = useT()
return <div>{t('key', 'Default text')}</div>- Add column to
profilestable via migration - Add to schema in
common/src/api/schema.ts - Update frontend forms/components
- Add key to
common/messages/en.json - Add translations to
fr.json,de.json, etc.
- Don't use string concatenation for SQL queries
- Don't add sleep() delays for "eventual consistency" - fix at DB level
- Don't create separate API calls when data can be batched in one transaction
- Don't use console.log - use
debug()fromcommon/logger
- Node.js 20+
- React 19
- Next.js 16
- Supabase (PostgreSQL)
- Firebase (Auth, Storage)
- Tailwind CSS
- Jest (testing)
- Playwright (E2E testing)