A modern, secure, and intuitive family tree management platform built with Next.js 14
MeruVansh (मेरु वंश — "Meru" is Garhwali for "My", "Vansh" means "Lineage") is a full-stack web application that enables users to create, manage, and visualize their family genealogy. Built with modern web technologies, it emphasizes security, performance, and user experience.
Family trees are complex graph data structures that present unique challenges:
- Recursive relationships: Parent-child hierarchies with unlimited depth
- Data integrity: Preventing circular references and orphaned nodes
- Visualization: Rendering large trees with thousands of nodes performantly
- Access control: Managing who can view and edit family information
This project demonstrates proficiency in:
- ✅ Full-stack TypeScript development
- ✅ Complex database schema design (recursive relationships)
- ✅ Authentication & authorization
- ✅ Graph visualization algorithms
- ✅ Performance optimization
- ✅ Production deployment
- 🔐 Secure Authentication - Dual login: Admin (email) & Family Viewer (access code)
- 👥 Role-Based Access Control - Admin and Viewer roles with granular permissions
- 🔑 Family Access Codes - Share your tree with read-only access for family members
- 👤 User Profiles - Customizable user accounts with profile pictures
- 🌲 Family Tree Creation - Add, edit, and organize family members (Admin only)
- 📊 Interactive Visualization - Dynamic tree rendering with React Flow
- 🖼️ Profile Pictures - Image upload with Cloudinary integration
- 🔍 Search & Filter - Find family members quickly
- 📱 Responsive Design - Works on desktop, tablet, and mobile with hamburger navigation
- ⚡ Server-Side Rendering (SSR) - Fast initial page loads
- 🎨 Modern UI Components - Shadcn/ui + Radix UI with custom loading states
- 🔒 Type-Safe API - End-to-end TypeScript with Zod validation
- 📐 Database Migrations - Version-controlled schema changes with Prisma
- 🛡️ Security - JWT authentication, bcrypt password hashing, RBAC
- 🎯 UX Improvements - Loading buttons, empty states, toast notifications
- 🚀 CI/CD Pipeline - Automated deployment with GitHub Actions
- 🌐 SEO Optimized - Meta tags, OpenGraph, sitemap
- Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- UI Components: Shadcn/ui + Radix UI
- Visualization: React Flow
- State Management: React Hooks + Context API
- Forms: React Hook Form + Zod
- Runtime: Node.js 20 LTS
- API: Next.js API Routes
- Authentication: NextAuth.js
- ORM: Prisma
- Validation: Zod
- Database: PostgreSQL 16 (Neon.tech)
- Image Storage: Cloudinary
- Deployment: Vercel
- CI/CD: GitHub Actions
- Version Control: Git + GitHub
- Package Manager: npm
- Linting: ESLint + Prettier
- Git Hooks: Husky + lint-staged
- Commit Convention: Conventional Commits
- Node.js 20.x or higher
- PostgreSQL 16.x (or Neon.tech account)
- Cloudinary account (free tier)
-
Clone the repository
git clone https://github.com/vkotiyal/meruvansh.git cd meruvansh -
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env.local
Fill in the required values:
DATABASE_URL: Your PostgreSQL connection stringNEXTAUTH_SECRET: Generate withopenssl rand -base64 32NEXT_PUBLIC_CLOUDINARY_CLOUD_NAME: From Cloudinary dashboard- Other Cloudinary credentials
-
Initialize the database
npx prisma generate npx prisma db push
-
Run the development server
npm run dev
-
Open in browser Navigate to http://localhost:3000
- Sign up at neon.tech
- Create a new project
- Copy the connection string
- Add to
.env.localasDATABASE_URL
- Sign up at cloudinary.com
- Go to Dashboard → Settings → Upload
- Create upload preset named "meruvansh" (unsigned)
- Copy Cloud Name, API Key, and API Secret
- Add to
.env.local
meruvansh/
├── app/ # Next.js App Router (pages, layouts, API routes)
├── components/ # React components (UI, features, providers)
├── lib/ # Utilities (auth, database, env config)
├── hooks/ # Custom React hooks
├── prisma/ # Database schema
├── types/ # TypeScript type definitions
├── public/ # Static assets
├── docs/ # Additional documentation
└── .github/ # CI/CD workflows, issue templates
For detailed file structure, see the docs/ folder.
erDiagram
User ||--o| Tree : owns
Tree ||--o{ Node : contains
Tree ||--o{ ViewerAccess : "shared with"
Node ||--o{ Node : parent-child
User {
string id PK
string email UK
string password
string name
datetime createdAt
}
Tree {
string id PK
string name
string userId FK
datetime createdAt
}
Node {
string id PK
string treeId FK
string parentId FK
string name
string email
date birthDate
string gender
string profilePicture
text bio
}
ViewerAccess {
string id PK
string treeId FK
string familyCode UK
string password
boolean enabled
datetime createdAt
}
Admin User → Login (email + password) → NextAuth → User table → JWT (role: admin) → Full Access
Family Member → Login (familyCode + password) → NextAuth → ViewerAccess table → JWT (role: viewer) → Read-Only Access
The application implements Role-Based Access Control (RBAC) with two roles:
-
Admin (Tree Owner)
- Full CRUD operations on tree and members
- Create and manage family access codes
- View all settings and analytics
- Cannot be deleted if they own the tree
-
Viewer (Family Member)
- Read-only access to tree visualization
- View all family members
- Cannot add, edit, or delete anything
- Login using shared family code + password
Access codes can be:
- Created by admins with unique family codes (e.g., "sharma2026")
- Enabled/disabled dynamically
- Password-protected (bcrypt hashed)
- Shared with multiple family members
The tree layout uses a hierarchical positioning algorithm:
- Identify root nodes (nodes without parents)
- Calculate levels recursively (depth-first traversal)
- Position nodes using a width-balanced approach
- Render with React Flow for zoom, pan, and interactions
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Generate coverage report
npm run test:coverage- Push code to GitHub
- Import project in Vercel
- Add environment variables
- Deploy!
# Build for production
npm run build
# Start production server
npm startContributions are welcome! We appreciate all contributions, from bug reports to new features.
Please read our Contributing Guidelines before getting started.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit changes using Conventional Commits
- Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request using our PR template
- Contributing Guide - Detailed contribution instructions
- Code of Conduct
- Development Setup
- Security Policy
This project is licensed under the MIT License - see the LICENSE file for details.
Vaibhav Kotiyal
- GitHub: @vkotiyal
- LinkedIn: Vaibhav Kotiyal
- Portfolio: vaibhavkotiyal.com
- Next.js team for the amazing framework
- Vercel for free hosting
- Shadcn for beautiful UI components
- Prisma for the excellent ORM
- Neon for serverless PostgreSQL
⭐ Star this repo if you find it helpful!
Made with ❤️ and ☕ by Vaibhav Kotiyal