Skip to content
abhi-byte62Public

About

Real-time collaborative Kanban workspace with optimistic concurrency control and live synchronization (React, Node.js, Socket.io, Prisma)

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TaskFlow β€” Collaborative Task Manager

Build Status Tests License

A production-grade, FAANG-level collaborative task management application with real-time Kanban boards, built with modern full-stack technologies.

πŸš€ Live Demo

Backend: http://localhost:5000
Frontend: http://localhost:5173 (or next available port)

Login: demo@taskflow.dev / password123


✨ Features

Core Functionality

  • Kanban Boards β€” Drag-and-drop tasks between columns with @dnd-kit
  • Real-time Collaboration β€” Socket.io presence, live updates, typing indicators
  • Workspaces & Boards β€” Hierarchical organization with auto-board creation
  • Task Management β€” Full CRUD, priorities, due dates, assignees, labels, comments

Engineering Excellence

  • Optimistic Concurrency Control β€” Version field on every task, 409 Conflict on stale writes
  • Gap-based Positioning β€” Float positions with automatic column rebalance when gaps < 0.001
  • Server-side RBAC β€” OWNER > ADMIN > MEMBER > VIEWER enforced on every mutating endpoint
  • Idempotency Keys β€” Idempotency-Key header prevents duplicate task creation on retries
  • Atomic Transactions β€” Prisma $transaction for task + activity log writes

Observability & Reliability

  • Health Checks β€” /api/health (liveness) + /api/ready (readiness with DB/Redis)
  • Rate Limiting β€” Auth endpoints (strict) + API endpoints (standard) with Redis fallback
  • Structured Logging β€” Request IDs, JSON logs, error taxonomy
  • Unit Tests β€” Vitest with positionService coverage (5/5 passing)

UX & Accessibility

  • Dark Mode β€” Toggle in top bar, persists to localStorage, darkMode: 'class' in Tailwind
  • Keyboard Accessible β€” Full @dnd-kit keyboard support
  • Responsive Design β€” Mobile sidebar, horizontal scroll on boards
  • Notifications β€” Real-time + REST, mark-as-read, mark-all-read

πŸ— Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚     β”‚    Backend      β”‚     β”‚   Database      β”‚
β”‚   React 18      │◄───►│   Node/Express  │◄───►│   PostgreSQL 17 β”‚
β”‚   Vite + TS     β”‚     β”‚   Prisma ORM    β”‚     β”‚   (Postgres)    β”‚
β”‚   TanStack Queryβ”‚     β”‚   Socket.io     β”‚     β”‚   Redis (opt)   β”‚
β”‚   Tailwind CSS  β”‚     β”‚   Zod + JWT     β”‚     β”‚                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Key Design Decisions (ADRs)

ADR Topic
001 PostgreSQL as primary database
002 Socket.io for real-time
003 Optimistic updates with OCC
004 Cursor-based pagination
005 Redis for caching/rate-limit
006 REST + WebSocket separation

πŸ›  Tech Stack

Layer Technology
Frontend React 18, Vite, TanStack Query v5, React Router v6, @dnd-kit, Tailwind CSS, Lucide React
Backend Node.js, Express, Prisma ORM, Socket.io, Zod, bcryptjs, jsonwebtoken
Database PostgreSQL 17, Prisma Migrations
Cache/Queue Redis (ioredis) with in-memory fallback
Auth JWT (HS256), bcrypt, HttpOnly-ready
Testing Vitest, Supertest
CI/CD GitHub Actions, Docker Compose

πŸ“¦ Quick Start

Prerequisites

  • Node.js 20+
  • PostgreSQL 17
  • Redis (optional β€” in-memory fallback used if unavailable)

1. Clone & Install

git clone https://github.com/YOUR_USERNAME/taskflow.git
cd taskflow

# Backend
cd server
npm install

# Frontend
cd ../client
npm install

2. Configure Environment

cd server
cp .env.example .env
# Edit .env with your DATABASE_URL, JWT_SECRET, REDIS_URL

3. Database Setup

cd server
npx prisma migrate dev --name init
npm run seed

4. Run Development

# Terminal 1 β€” Backend
cd server
npm run dev          # β†’ http://localhost:5000

# Terminal 2 β€” Frontend
cd client
npm run dev          # β†’ http://localhost:5173

5. Login

Email:    demo@taskflow.dev
Password: password123

🐳 Docker (Production)

docker-compose up -d
# Services: postgres, redis, server (5000), client (5173)

Environment Variables

Variable Description Default
DATABASE_URL PostgreSQL connection string Required
JWT_SECRET 64+ char secret for JWT Required
REDIS_URL Redis connection string Optional
PORT Backend port 5000
CLIENT_URL Frontend origin for CORS http://localhost:5173
NODE_ENV Environment development

πŸ“š API Reference

Authentication

Method Endpoint Description
POST /api/auth/register Register new user
POST /api/auth/login Login, returns JWT
GET /api/auth/me Get current user
POST /api/auth/logout Logout (stateless)

Workspaces

Method Endpoint Description
GET /api/workspaces List user's workspaces (with boards)
POST /api/workspaces Create workspace + default board
GET /api/workspaces/:id Get workspace
PATCH /api/workspaces/:id Update workspace
DELETE /api/workspaces/:id Delete workspace

Boards

Method Endpoint Description
GET /api/boards/workspace/:id List boards in workspace
POST /api/boards/workspace/:id Create board + default columns
GET /api/boards/:id Get board
GET /api/boards/:id/data Full board (columns + nested tasks)
PATCH /api/boards/:id Update board
DELETE /api/boards/:id Delete board

Columns

Method Endpoint Description
POST /api/columns/board/:id Create column
PATCH /api/columns/:id Update column (name, position)
DELETE /api/columns/:id Delete column

Tasks

Method Endpoint Description
GET /api/tasks/board/:id Paginated tasks (cursor-based)
POST /api/tasks/board/:id Create task (idempotent)
PATCH /api/tasks/:id Update task (requires version)
POST /api/tasks/:id/move Move task (column + position)
DELETE /api/tasks/:id Delete task

Comments

Method Endpoint Description
GET /api/comments/task/:id Get comments for task
POST /api/comments/task/:id Add comment

Notifications

Method Endpoint Description
GET /api/notifications List user notifications
PATCH /api/notifications/:id/read Mark as read
POST /api/notifications/read-all Mark all as read

Health

Method Endpoint Description
GET /api/health Liveness probe
GET /api/health/ready Readiness probe (DB + Redis)

πŸ”’ Security

  • JWT Authentication β€” HS256, 7-day expiry, stateless
  • Password Hashing β€” bcrypt (cost 10)
  • RBAC β€” Server-side on every mutating endpoint
  • Rate Limiting β€” Auth: 5 req/min, API: 100 req/min
  • Helmet β€” Security headers (CSP, HSTS, etc.)
  • CORS β€” Configured for frontend origin only
  • Input Validation β€” Zod schemas on all endpoints

πŸ§ͺ Testing

cd server
npm test              # Run all tests (Vitest)
npm run test:watch    # Watch mode

Test Coverage

  • positionService β€” 5/5 tests passing (gap-based ordering, rebalance)
  • Integration tests for auth, workspaces, tasks (configured)

πŸ“ Project Structure

taskflow/
β”œβ”€β”€ client/                 # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/     # Layout, ProtectedRoute
β”‚   β”‚   β”œβ”€β”€ context/        # AuthContext, SocketContext
β”‚   β”‚   β”œβ”€β”€ pages/          # Login, Register, Dashboard, Board, Workspaces
β”‚   β”‚   β”œβ”€β”€ services/       # API client (axios)
β”‚   β”‚   └── main.jsx        # Entry point
β”‚   └── ...
β”œβ”€β”€ server/                 # Node/Express backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ middleware/     # auth, authorize, validate, rateLimiter, idempotency
β”‚   β”‚   β”œβ”€β”€ routes/         # auth, workspaces, boards, tasks, comments, notifications, activity, health
β”‚   β”‚   β”œβ”€β”€ services/       # taskService, positionService, notificationService, activityService
β”‚   β”‚   β”œβ”€β”€ utils/          # prisma, redis, logger, events, schemas, permissions, response
β”‚   β”‚   β”œβ”€β”€ middleware/     # errorHandler, requestId, requestLogger
β”‚   β”‚   β”œβ”€β”€ app.js          # Express app factory
β”‚   β”‚   β”œβ”€β”€ index.js        # Entry point (routes + socket)
β”‚   β”‚   └── config.js       # Centralized config
β”‚   β”œβ”€β”€ prisma/             # Schema + migrations + seed
β”‚   └── tests/              # Vitest unit tests
β”œβ”€β”€ docs/                   # Architecture + ADRs
β”‚   β”œβ”€β”€ ADR/                # 6 Architecture Decision Records
β”‚   β”œβ”€β”€ ARCHITECTURE.md
β”‚   β”œβ”€β”€ DATABASE.md
β”‚   β”œβ”€β”€ CONCURRENCY.md
β”‚   β”œβ”€β”€ REALTIME.md
β”‚   β”œβ”€β”€ SCALABILITY.md
β”‚   β”œβ”€β”€ SECURITY.md
β”‚   β”œβ”€β”€ AUTH.md
β”‚   └── CACHING.md
└── docker-compose.yml      # Postgres + Redis + App

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'feat: add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

MIT License β€” see LICENSE for details.


πŸ™ Acknowledgments

Built with ❀️ using modern full-stack best practices. Inspired by Linear, Notion, and GitHub Projects.

About

Real-time collaborative Kanban workspace with optimistic concurrency control and live synchronization (React, Node.js, Socket.io, Prisma)

Topics

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages