- Node.js v20+ (use nvm to manage versions)
- PostgreSQL (port 5433)
- Git
git clone https://github.com/inspirebyte-tech/society-platform.git cd society-platform
npm install
cd apps/api cp .env.example .env
Open .env and set: DATABASE_URL="postgresql://postgres:YOURPASSWORD@localhost:5433/society_platform_dev" JWT_SECRET="any-random-string-for-local-dev"
psql -U postgres -p 5433 -c "CREATE DATABASE society_platform_dev;"
npx prisma migrate reset
Type 'y' when prompted. This creates all tables and seeds test data.
npx tsx src/index.ts
Server runs on http://localhost:3000
GET http://localhost:3000/api/health Should return: { "status": "ok" }
GET http://localhost:3000/api/test-tokens Should return 3 users with tokens.
Builder: +911111111111 Resident: +912222222222 Gatekeeper: +913333333333
main → stable, never push directly dev → integration branch feature/* → your work goes here
git checkout dev git pull origin dev git checkout -b feature/your-task-name ... do your work ... git push origin feature/your-task-name open PR → target: dev
npm install -D tsx
Add to .env: PRISMA_ENGINES_MIRROR=https://registry.npmmirror.com/-/binary/prisma Then retry.
Your PostgreSQL runs on 5433 not 5432. Make sure DATABASE_URL uses port 5433.
Use tsx instead of ts-node: npx tsx src/index.ts
Use Thunder Client (VS Code) or Postman.
Thunder Client users: Import docs/api-collection.thunder.json
Postman users: Refer to docs/API.md to manually set up endpoints. All request/response formats are documented there.
- Open VS Code
- Click Thunder Client icon in left sidebar
- Click "Collections" tab
- Click the menu icon → Import
- Select docs/api-collection.thunder.json
- All endpoints are now pre-configured
- Replace REPLACE_WITH_TOKEN with actual token
- Replace REPLACE_WITH_OTP with OTP from terminal
- Replace REPLACE_WITH_ORG_ID with org ID from your DB
- Base URL is always http://localhost:3000
Create test database: createdb -U postgres -p 5433 society_platform_test
Run migrations on test DB: npx dotenv -e .env.test -- npx prisma migrate reset --force
cd apps/api npm test
Tests use a separate DB: society_platform_test Configured in apps/api/.env.test DB is reset automatically before each test run
tests/setup.ts → shared helpers tests/globalSetup.ts → DB reset before all suites tests/security.test.ts → security tests tests/auth.test.ts → auth endpoint tests tests/societies.test.ts → society endpoint tests tests/nodes.test.ts → node endpoint tests tests/invitations.test.ts → invitation tests tests/members.test.ts → member management tests