You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs/01-architecture-overview.md — target backend + mobile structure and boundaries
docs/engineering-ddoc.md — mandatory development doctrine (clean, secure, scalable, performant)
docs/02-initialization-guide.md — how to start new modules and migrate progressively
1. Project Overview
Glunity Mobile is a community-driven mobile application for people with celiac disease and gluten intolerance in Tunisia, with international expansion potential. It serves four user profiles — celiac consumers, family/friends (proches), commercial professionals (restaurants, bakeries, sellers), and healthcare professionals — each with tailored features and content.
Design is locked. The marketing team delivered the complete Figma mockups. The dev team's job is 100% implementation — architecture, backend API, business logic, real-time features, security, and pixel-perfect React Native UI. No design decisions during development.
1.1 Functional modules
Module
Description
Priority
Auth & Profiles
Registration, login, JWT auth, profile type at onboarding
The React Native app communicates with the Node.js backend through two channels:
REST API over HTTPS — all standard CRUD and data fetching
Socket.io WebSocket — real-time community chat and live notifications
Decision: Single monolithic Node.js API. No microservices, no GraphQL, no overengineering. Right for a 2-person team at this stage. Can be split later.
The Socket.io server runs on the same Node.js process as Express. When the app opens the Community screen, it connects via WebSocket, sending the JWT as handshake auth. The server verifies the token before allowing the connection.
Channel room:channel:{channelId} — all members of a community channel
User room:user:{userId} — private notifications per user
Global room:global — system-wide announcements
Rule: All messages sent via Socket.io are persisted to MongoDB by the server before broadcasting. The client never saves directly — server is the single source of truth.
6. Security Architecture
JWT dual-token strategy
Token
Expiry
Storage
Usage
Access Token
15 minutes
React Native memory (Context/state)
Authorization: Bearer <token> on every request
Refresh Token
7 days
Expo SecureStore (encrypted)
Sent only to POST /auth/refresh
⚠️Never store the access token in AsyncStorage. It is not encrypted. Always use Expo SecureStore for the refresh token.
Global search screen — products, locations, recipes, users
FS
3
Both
S5-03
Offline mode — favorite recipes cached in MMKV
FE
2
D2
S5-04
Nginx + PM2 + SSL setup on production VPS
DevOps
2
YD
S5-05
Production .env config, secrets management
BE
1
YD
S5-06
End-to-end testing — all critical user flows
QA
3
Both
S5-07
App Store + Google Play submission prep (icons, screenshots)
Mobile
2
D2
S5-08
PO Review + UAT + bug fixes
QA
3
All
9. Git Workflow & Development Rules
Branch strategy
Branch
Purpose
main
Production — merged from develop after PO approval only. Protected.
develop
Integration — all features merged here first
feature/S1-07-register-screen
One branch per task, named with sprint ID
hotfix/auth-token-bug
Urgent production fixes — merged to main + develop
Commit convention
feat(auth): add register screen with profile type selection
feat(api): add POST /locations with geo validation
fix(map): correct pin rendering on iOS 17
chore(deps): update expo-notifications to 0.28
docs: update API route documentation
Code rules — always followed
One component per file — never multiple exports in one file
All API calls go through src/services/ — no inline fetch or axios in screen files
All user-facing strings use i18next — no hardcoded text in JSX
Always handle loading, error, and empty states on every screen
Never commit .env files — keep .env.example with placeholder values
All async functions wrapped in try/catch — no unhandled promise rejections
Backend routes: validate input first, then query DB — never trust raw request body
PR rule: the other developer reviews before merging to develop — no self-merges
10. Risk Management
ID
Risk
Impact
Probability
Mitigation
R-01
Server downtime
Catastrophic
Probable
PM2 auto-restart, daily backups, Nginx fallback
R-02
Developer delay
Major
Probable
Fixed sprint deadlines, daily standup to surface blockers
R-03
Client feedback delay
Minor
Probable
Max 3-day response window in contract
R-04
Security breach
Catastrophic
Low
Helmet, rate limiting, sanitization, JWT rotation
R-05
Breaking dependency update
Catastrophic
Very probable
Lock versions in package.json, snapshot before update
R-06
Scope creep
Major
Probable
New features go to next sprint — not current one
R-07
Geolocation accuracy (Tunisia)
Moderate
Moderate
Allow manual pin adjustment by users and sellers
R-08
App Store rejection
Major
Low
Follow Apple/Google guidelines from day 1, test on real devices
11. Definition of Done
Backend task is DONE when
Route returns correct data with proper HTTP status codes
Input validated with Joi — invalid inputs return 400 with clear messages
Auth middleware applied to all protected routes
All async logic wrapped in try/catch with next(error)
Tested manually with Postman — all edge cases pass