Skip to content

Aakarsh-Kumar/binary-ops

Repository files navigation

BinaryFlow

A full-stack Task Management System for NSCC SRM built with Next.js and Supabase. The system supports multi-role structure, domain-based permissions, hierarchical task assignment, and reverse review flow.

Features

User Roles & Permissions

  • 5 Roles: Core, Director, Associate Director, Associate, Member
  • 3 Domains: Technical, Non-Technical, Creatives
  • Role-based access control with domain restrictions
  • Core users can manage all domains and users

Task Management

  • Create tasks with domain assignment
  • Hierarchical task assignment (Core → Director → AD → Associate → Member)
  • Task status tracking: Open, In Progress, Submitted, Under Review, Completed
  • Deadline management with overdue indicators

Submissions

  • Multiple submission types: Text, Link, File
  • File upload support (requires Supabase Storage setup)
  • Submission history tracking

Review System

  • Reverse review hierarchy: Member → Associate → AD → Director → Core
  • Review actions: Approve or Request Changes
  • Feedback system for reviewers
  • Visual review timeline with progress tracking
  • Automatic task completion when all reviews are approved

Security

  • Row-Level Security (RLS) policies on all tables
  • Domain-based access restrictions
  • Role-based API route protection
  • Secure authentication via Supabase Auth

Tech Stack

  • Framework: Next.js 16 (App Router)
  • Database: Supabase (PostgreSQL)
  • Authentication: Supabase Auth
  • Styling: Tailwind CSS v4
  • Language: TypeScript

Setup Instructions

Prerequisites

  • Node.js 18+ or Bun
  • A Supabase account and project (supabase.com)

1. Clone and Install Dependencies

# If using npm
npm install

# If using bun (recommended)
bun install

2. Set Up Supabase

  1. Create a new project at supabase.com
  2. Go to SQL Editor in your Supabase dashboard
  3. Copy and paste the entire contents of supabase/schema.sql
  4. Run the SQL script to create all tables, policies, and functions

3. Configure Environment Variables

Create a .env.local file in the root directory:

NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key

You can find these values in your Supabase project settings:

  • Go to SettingsAPI
  • Copy the Project URL and anon/public key

4. Set Up Supabase Storage (Optional - for file uploads)

  1. Go to Storage in your Supabase dashboard
  2. Create a new bucket named submissions
  3. Set it to Public if you want direct file access
  4. Update the SubmissionForm component to use Supabase Storage API

5. Run the Development Server

# Using npm
npm run dev

# Using bun
bun dev

Open http://localhost:3000 in your browser.

Project Structure

binaryflow/
├── supabase/
│   └── schema.sql              # Database schema and RLS policies
├── src/
│   ├── app/
│   │   ├── api/                # API routes
│   │   │   ├── tasks/          # Task CRUD operations
│   │   │   └── users/          # User management (Core only)
│   │   ├── auth/               # Authentication pages
│   │   │   ├── login/
│   │   │   └── signup/
│   │   ├── dashboard/          # Main dashboard
│   │   ├── tasks/              # Task pages
│   │   │   ├── create/         # Create task form
│   │   │   └── [id]/           # Task detail page
│   │   └── users/              # User management (Core only)
│   ├── components/             # Reusable UI components
│   │   ├── CreateTaskForm.tsx
│   │   ├── DomainBadge.tsx
│   │   ├── Navbar.tsx
│   │   ├── ReviewForm.tsx
│   │   ├── ReviewTimeline.tsx
│   │   ├── RoleBadge.tsx
│   │   ├── SubmissionForm.tsx
│   │   └── TaskCard.tsx
│   ├── lib/
│   │   ├── supabase/           # Supabase client utilities
│   │   │   ├── client.ts       # Browser client
│   │   │   ├── server.ts       # Server client
│   │   │   └── types.ts        # TypeScript types
│   │   └── utils.ts            # Utility functions
│   └── middleware.ts           # Auth middleware
└── README.md

Role Capabilities

Role Can Assign To Task Scope Can Review Can Submit
Core D, AD, A, Members (any domain) All domains Final reviewer
Director (D) AD, A, Members (same domain) Own domain Review below hierarchy
Associate Director (AD) A, Members (same domain) Own domain Review below hierarchy
Associate (A) Members (same domain) Own domain Review Members
Member Own domain Reviewed by A→AD→D→Core

Task Workflow

  1. Creation: Core/D/AD/A creates a task and assigns it to users below in hierarchy
  2. Assignment: Task is assigned to users within the same domain
  3. Submission: Assignee submits file/link/text
  4. Review: Sequential approval chain (A → AD → D → Core)
  5. Completion: Task marked completed after Core approval

API Routes

Route Method Description Access
/api/tasks GET Fetch tasks (filtered by role/domain) All authenticated
/api/tasks POST Create task Core/D/AD/A
/api/tasks/[id]/submit POST Submit task Assignees only
/api/tasks/[id]/review POST Submit review Reviewers only
/api/users GET Fetch all users Core only

UI Components

  • TaskCard: Displays task information with status and domain badges
  • RoleBadge: Visual role indicator with color coding
  • DomainBadge: Domain indicator
  • ReviewTimeline: Visual progress of review chain
  • SubmissionForm: Multi-type submission form (text/link/file)
  • ReviewForm: Review submission form with approve/request changes

Security Features

  • Row-Level Security (RLS): All tables have RLS enabled
  • Domain Isolation: Users can only access tasks in their domain (except Core)
  • Role-Based Access: API routes check user roles before allowing operations
  • Assignment Validation: Users can only submit tasks assigned to them
  • Review Validation: Users cannot review their own assigned tasks

Future Enhancements

  • Real-time notifications via Supabase Realtime
  • Analytics dashboard (tasks completed/pending per domain)
  • Comment threads per task
  • Auto-email reminders before deadlines
  • Domain-level leaderboards
  • File upload to Supabase Storage
  • Task templates
  • Bulk task operations

📄 License

This project is for NSCC SRM internal use.

Built with ❤️ for NSCC SRM by Aakarsh Kumar

Connect with me: Instagram | LinkedIn | Website

About

Hierarchical Task Management System

Topics

Resources

Stars

Watchers

Forks

Contributors 7