This guide will help you set up and test the M1 (Auth + Couples) implementation.
- Node.js 18+ (you have v22.18.0 ✅)
- npm (you have v10.9.3 ✅)
cd /Users/sofiavas/sync
npm installcp infra/env.example .envOpen .env and update these values:
# Database (for full version - not needed for simple test)
DATABASE_URL=postgresql://username:password@localhost:5432/sync_db
# JWT Secret (required)
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
# Encryption Key (required - must be exactly 32 characters)
ENCRYPTION_KEY=your-32-character-encryption-key-here
# OpenAI API Key (for AI features)
OPENAI_API_KEY=sk-your-openai-api-key-herecd services/api
npx tsx src/simple-server.tsYou should see:
🚀 Sync API server running on http://0.0.0.0:3001
📚 API documentation available at http://0.0.0.0:3001/docs
🧪 Ready for testing! Use the test client: node test-api-client.js
cd /Users/sofiavas/sync
node test-simple.jsThe test script demonstrates the complete M1 flow:
- Alice requests verification code → gets code via server logs
- Alice verifies code → gets JWT token
- Alice creates couple → becomes userA
- Alice creates invite → gets invite code and link
- Bob requests verification code → gets code
- Bob verifies code → gets JWT token
- Bob accepts invite → becomes userB in Alice's couple
- Both users can now access couple data
- Verification codes are logged to the server console (check the terminal running the server)
- Use the same code (123456) for both Alice and Bob in the test
- JWT tokens are valid for 7 days
- Invite codes expire in 24 hours
- Data is stored in memory (will be lost when server restarts)
- Check if port 3001 is already in use
- Make sure you're in the
services/apidirectory - Verify Node.js version:
node --version
- Make sure the server is running
- Check the server logs for verification codes
- Verify the
.envfile has the required values
- Check the server console for error messages
- Verify JWT_SECRET is set in
.env - Make sure you're using the correct verification codes
GET /health- Health checkPOST /auth/request-code- Request verification codePOST /auth/verify-code- Verify code and get tokenGET /auth/me- Get current user infoPOST /couples- Create couplePOST /invites- Create invitePOST /invites/:code/accept- Accept inviteGET /couples/me- Get couple info
Once M1 is working, you can:
- Test the full database version (requires PostgreSQL)
- Move to M2 (Sessions & Messages)
- Add the AI orchestrator
- Build the web interface
- Keep the server running in one terminal
- Run tests in another terminal
- Check server logs for verification codes
- The simple version is perfect for testing the flow