Specification
Version: Release 1
Status: In Progress
Target: Fully functional web app for internal family launch
Author: Muhammad Arslan
Last Updated: [Add Date]
π― Objectiveβ
This release aims to deliver the first live version of TiwanaConnect β a private web app to manage and visualize the Tiwana family's digital structure.
This version will be handed over to family elders/admins for real use and adoption.
π§βπ€βπ§ User Roles & Accessβ
1. Admin (Family Lead)β
- Full control: add/edit/delete members
- Add relationships
- Create login credentials for members
- Activate/deactivate user accounts
2. Member (Family Person)β
- View family tree
- See their own profile
- No editing or access to others
π Only admins can create accounts.
No public signup in this release.
π Auth Flow (Controlled Access)β
- Admin will:
- Add member to
memberstable (just info) - When needed, create a login in
userstable (linked to that member) - Share password manually
- Add member to
- Only active users with
status = activecan log in
ποΈ Database Structureβ
users Tableβ
| Field | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| String | Login email | |
| password | Hashed | Login password (bcrypt) |
| role | Enum | admin, member |
| status | Enum | pending, active |
| member_id | UUID | FK to members table |
members Tableβ
| Field | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| name | String | Full name |
| dob | Date | Date of birth |
| gender | Enum | male, female, other |
| bio | Text | Short info |
| image_url | String | Profile picture |
| parent_ids | Array(UUID) | For multiple parents |
| spouse_ids | Array(UUID) | For linking spouses |
relationships Tableβ
| Field | Type | Description |
|---|---|---|
| id | UUID | PK |
| member_id | UUID | Person in focus |
| related_id | UUID | Person related to |
| type | Enum | parent, child, spouse, etc. |
π Features & Scope (Final for Release 1)β
| Feature | Status |
|---|---|
| Admin login | β |
| Admin dashboard | β |
| Add/edit members | β |
| Link relationships | β |
| View family tree | β |
| Member login | β |
| View-only access | β |
| Manual invite (no email) | β |
| Profile image upload | Optional |
π API Endpoints (Minimal Scope)β
Authβ
POST /auth/loginβ LoginGET /auth/meβ Current user
Users (Admin only)β
POST /usersβ Create loginPATCH /users/:id/activatePATCH /users/:id/deactivate
Membersβ
GET /membersGET /members/:idPOST /membersPUT /members/:idDELETE /members/:id
Relationshipsβ
POST /relationshipsDELETE /relationships/:id
Treeβ
GET /treeβ Full data for frontendGET /tree/:idβ Subtree
π§± Architecture Notesβ
| Layer | Tools |
|---|---|
| Backend | NestJS + Prisma + PostgreSQL |
| Frontend | Next.js + Tailwind + shadcn/ui |
| Auth | JWT / Clerk (finalize) |
| Infra | Docker, GitHub Actions, Railway |
| GraphDB | Neo4j (used from Day One) β |
π§ Neo4j GraphDB (Used from Day One)β
TiwanaConnect will use Neo4j alongside PostgreSQL from the very beginning to power graph-based relationships and enable efficient family tree traversal.
β Purposeβ
- Simplified tree traversal (e.g., grandparents, siblings, cousins)
- Natural relationship queries
- Backbone for future visualization tools
π¦ Node Designβ
Each member in PostgreSQL will have a corresponding node in Neo4j.
| Field | Type | Description |
|---|---|---|
id | UUID | Same as the members.id in PostgreSQL |
gender | Enum | male, female, other (for traversal) |
Example Node:
(:Person { id: "uuid", gender: "male" })
π Relationship Typesβ
| Type | From β To | Example |
|---|---|---|
PARENT_OF | (parent)-[:PARENT_OF]->(child) | One or both directions |
SPOUSE_OF | (A)-[:SPOUSE_OF]->(B) | Undirected or both sides |
These relationships will be automatically created alongside member additions in the backend service.
π§ͺ Sample Cypher Queriesβ
// Find children of a member
MATCH (p:Person {id: $id})<-[:PARENT_OF]-(child)
RETURN child
// Find all ancestors (any depth)
MATCH path = (p:Person {id: $id})<-[:PARENT_OF*]-(ancestor)
RETURN path
π Sync Strategyβ
- Primary source of truth = PostgreSQL
- Every update in
members/relationshipstriggers a parallel write to Neo4j - Failures are logged and retried by the backend service
β οΈ Notesβ
- Neo4j is used for traversal only, not for auth or core logic
- NestJS service layer handles bi-directional sync
- Future releases may include:
- Neo4j-powered UIs
- GraphQL over graph data
- Advanced traversal features (e.g., relation suggestions)
π Delivery Checklistβ
- β Complete backend API with proper validation & guards
- β Responsive frontend (mobile-friendly)
- β Family tree UI: zoom, click β view profile
- β Admin panel to manage members & users
- β Deployment on Railway or Fly.io
- β GitHub repo with clean commits
- β Documentation & handover notes
β Final Outputβ
A clean, fully working, deployed app ready to be used by your family.
- Admin can manage all data
- Members can log in and view their family
- Hosted online
- Code and infrastructure prepared for future growth
π Built With Purposeβ
Created by Muhammad Arslan
For the Tiwana Family
βOne day, our children will browse this tree and smile.β