Skip to main content

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 members table (just info)
    • When needed, create a login in users table (linked to that member)
    • Share password manually
  • Only active users with status = active can log in

πŸ—ƒοΈ Database Structure​

users Table​

FieldTypeDescription
idUUIDPrimary key
emailStringLogin email
passwordHashedLogin password (bcrypt)
roleEnumadmin, member
statusEnumpending, active
member_idUUIDFK to members table

members Table​

FieldTypeDescription
idUUIDPrimary key
nameStringFull name
dobDateDate of birth
genderEnummale, female, other
bioTextShort info
image_urlStringProfile picture
parent_idsArray(UUID)For multiple parents
spouse_idsArray(UUID)For linking spouses

relationships Table​

FieldTypeDescription
idUUIDPK
member_idUUIDPerson in focus
related_idUUIDPerson related to
typeEnumparent, child, spouse, etc.

πŸ“š Features & Scope (Final for Release 1)​

FeatureStatus
Admin loginβœ…
Admin dashboardβœ…
Add/edit membersβœ…
Link relationshipsβœ…
View family treeβœ…
Member loginβœ…
View-only accessβœ…
Manual invite (no email)βœ…
Profile image uploadOptional

πŸ“Š API Endpoints (Minimal Scope)​

Auth​

  • POST /auth/login β†’ Login
  • GET /auth/me β†’ Current user

Users (Admin only)​

  • POST /users β†’ Create login
  • PATCH /users/:id/activate
  • PATCH /users/:id/deactivate

Members​

  • GET /members
  • GET /members/:id
  • POST /members
  • PUT /members/:id
  • DELETE /members/:id

Relationships​

  • POST /relationships
  • DELETE /relationships/:id

Tree​

  • GET /tree β†’ Full data for frontend
  • GET /tree/:id β†’ Subtree

🧱 Architecture Notes​

LayerTools
BackendNestJS + Prisma + PostgreSQL
FrontendNext.js + Tailwind + shadcn/ui
AuthJWT / Clerk (finalize)
InfraDocker, GitHub Actions, Railway
GraphDBNeo4j (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.

FieldTypeDescription
idUUIDSame as the members.id in PostgreSQL
genderEnummale, female, other (for traversal)

Example Node:

(:Person { id: "uuid", gender: "male" })

πŸ”— Relationship Types​

TypeFrom β†’ ToExample
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 / relationships triggers 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.”