Payday Chat
A real-time, members-only network for online business founders.
The Problem
Founders needed a private, high-signal place to network, build teams, and scale revenue — not another noisy public feed. Payday Chat is invite-only and built around real-time collaboration.
My Role
Built solo with AI-assisted development — Flutter client, NestJS API, data model, real-time layer, and deployment.
Highlights
- Real-time messaging with presence and live events over WebSockets
- One NestJS API powering both a Flutter mobile app and a web client
- PostgreSQL domain model with Redis for caching and pub/sub fan-out
- NGINX gateway, Stripe payments, and OAuth authentication
Stack
Constraints
- Invite-only product — auth and access control had to be correct from day one.
- One backend, two clients (Flutter + web) — schema and contracts had to be shared, not duplicated.
- Realtime is a feature, not a nice-to-have — presence and live events must survive reconnects.
System Architecture
Key Trade-offs
The decisions worth defending — what I chose, what I turned down, and why.
Realtime transport
Chose
WebSockets with Redis pub/sub fan-out
Rejected
Long-polling or third-party realtime SaaS
Predictable latency, no per-message vendor cost, and Redis already in the stack for caching — one fewer moving part.
Mobile client framework
Chose
Flutter (single codebase for iOS + Android)
Rejected
Native Swift + Kotlin clients
Solo build — two native clients would have doubled the surface area and slowed iteration on the API.
API style
Chose
REST + dedicated WebSocket gateway
Rejected
GraphQL subscriptions
Simpler operational story, easier to cache at the NGINX layer, and the realtime channel stays an explicit, observable component.
What I'd Do Differently
An honest retrospective — the stuff I'd change with more time, more users, or a second pass.
- 1Introduce contract tests between the NestJS API and the Flutter client earlier — a few breakages were caught only at runtime.
- 2Move long-lived sockets to a dedicated process so API deploys don't drop client connections.
- 3Add structured event versioning from day one instead of retrofitting it once the schema started moving.
Technical Deep-Dive
Architecture, specifications, and implementation details.
Naming Conventions
Consistent naming makes the codebase predictable and Copilot suggestions accurate. Follow these rules everywhere without exception.
#Files & Directories
| Type | Convention | Example |
|---|---|---|
| All files | kebab-case.type.ts | member-profile.entity.ts |
| Module folder | kebab-case/ | src/members/ |
| Entity | feature-name.entity.ts | member-profile.entity.ts |
| Service | feature-name.service.ts | members.service.ts |
| Controller | feature-name.controller.ts | members.controller.ts |
| Module | feature-name.module.ts | members.module.ts |
| DTO | action-feature.dto.ts | create-post.dto.ts |
| Guard | guard-name.guard.ts | jwt-auth.guard.ts |
| Strategy | strategy-name.strategy.ts | jwt.strategy.ts |
| Decorator | decorator-name.decorator.ts | current-user.decorator.ts |
| Filter | filter-name.filter.ts | http-exception.filter.ts |
| Interceptor | name.interceptor.ts | transform.interceptor.ts |
| Processor | queue-name.processor.ts | email.processor.ts |
| Interface | interface-name.interface.ts | jwt-payload.interface.ts |
| Test | same as source + .spec.ts | members.service.spec.ts |
#TypeScript Classes
| Type | Convention | Example |
|---|---|---|
| Class (all types) | PascalCase | MembersService |
| Interface | PascalCase (no I prefix) | JwtPayload |
| Enum | PascalCase | MembershipTier |
| Type alias | PascalCase | AuthProvider |
| Decorator | PascalCase | @CurrentUser() |
#Variables & Methods
| Type | Convention | Example |
|---|---|---|
| Variables | camelCase | const userId = ... |
| Methods | camelCase | async findOneOrFail() |
| Constants (module-level) | SCREAMING_SNAKE | export const REDIS_CLIENT = 'REDIS_CLIENT' |
| Private class properties | camelCase (no _ prefix) | private readonly repo |
#Database
| Type | Convention | Example |
|---|---|---|
| Table names | snake_case (plural) | member_profiles, conversation_participants |
| Column names | snake_case | display_name, created_at |
| Primary key | id | always UUID, always id |
| Foreign keys | {table_singular}_id | user_id, conversation_id |
| Boolean columns | is_{adjective} | is_verified, is_admin, is_featured |
| Timestamp columns | {verb}_{preposition}_at | created_at, updated_at, deleted_at, last_login_at |
| Enum columns | {noun} (no _type unless ambiguous) | status, tier — but post_type, event_type where needed |
| Junction tables | {table1}_{table2} alphabetically | conversation_participants, event_attendees |
| Indexes | idx_{table}_{columns} | idx_posts_author, idx_profiles_skills |
#Redis Keys
Pattern: {resource}:{identifier}:{field?}
| Key | Example | TTL |
|---|---|---|
| User profile cache | profile:{userId} | 5 min |
| Match suggestions | matches:{userId} | 24 hours |
| Presence status | presence:{userId} | 5 min (300s) with heartbeat |
| Rate limit counter | throttle:{userId}:{route} | Per window |
| Leaderboard | leaderboard:week, leaderboard:month, leaderboard:all | 1 hour |
| Conversation cache | conversation:{convId}:messages | 2 min |
| Feed cache | feed:{userId}:home | 30 sec |
#Socket.io Room Names
Pattern: {resource}:{identifier}
| Room | Members | Purpose |
|---|---|---|
user:{userId} | Single user | Personal notifications |
conversation:{convId} | Conversation participants | Messaging |
feed:{channelId} | Channel subscribers | Live feed updates |
feed:home | All connected members | Global feed updates |
event:{eventId} | RSVPed attendees | Live event + chat |
#BullMQ Queue & Job Names
| Queue | Jobs |
|---|---|
email | welcome, verify-email, password-reset, notification, event-confirmation, event-reminder |
notifications | dispatch |
embeddings | generate, refresh-all |
media | process-image, process-video, combine-hls |
cleanup | expire-opportunities, archive-events, purge-deleted-messages |
#API Routes
Pattern: /{resource} (plural, kebab-case for multi-word)
| Resource | Route Prefix |
|---|---|
| Auth | /auth |
| Members | /members |
| Feed | /feed |
| Conversations | /conversations |
| Opportunities | /opportunities |
| Events | /events |
| Resources | /resources |
| Notifications | /notifications |
| Payments | /payments |
| Admin | /admin |
| Health | /health |
Sub-resources follow REST conventions:
GET /opportunities/:id/applications List applications
POST /opportunities/:id/applications Apply
PATCH /opportunities/:id/applications/:appId Update status
#TypeORM Column Mapping
Always explicitly map TypeScript camelCase to database snake_case:
// ✅ Always explicit
@Column({ name: 'display_name', length: 100 })
displayName: string;
@CreateDateColumn({ name: 'created_at' })
createdAt: Date;
// ❌ Never rely on automatic naming (it breaks cross-platform)
@Column()
displayName: string;
#Environment Variables
All environment variables: SCREAMING_SNAKE_CASE
Grouped by prefix:
DB_*— databaseREDIS_*— RedisJWT_*— JWT tokensMAIL_*— emailSTRIPE_*— paymentsAWS_*— S3 storageGOOGLE_*— Google OAuthAPPLE_*— Apple Sign-InTHROTTLE_*— rate limitingBULL_*— job queueSWAGGER_*— API docs