Skip to content

harunalpak/taskflow-pro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TaskFlow Pro

A production-like task management platform built with Node.js, Express, TypeScript, React, and Next.js.

License: MIT

πŸ—οΈ Architecture

This project follows a modular architecture inspired by NestJS, with clear separation of concerns:

  • Modules: Feature-based organization (Auth, Users, Projects, Tasks, Reports)
  • Controllers: Handle HTTP requests/responses
  • Services: Business logic
  • Repositories: Database access layer
  • DTOs: Request/response validation

πŸš€ Quick Start

Prerequisites

  • Node.js (LTS version - 18.x or higher)
  • Docker and Docker Compose
  • npm or yarn

Setup

  1. Clone the repository and install dependencies:

    npm run install:all
  2. Start infrastructure services (PostgreSQL + Redis):

    cd docker
    docker-compose up -d

    This will start:

    • PostgreSQL on port 5432
    • Redis on port 6379
  3. Set up environment variables:

    Backend:

    cd backend
    cp .env.sample .env

    Edit backend/.env and ensure:

    • DATABASE_URL points to your PostgreSQL instance
    • JWT_SECRET is set to a secure random string (use openssl rand -base64 32 to generate)
    • GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET (optional, for OAuth)
    • REDIS_HOST and REDIS_PORT match your Redis instance
    • FRONTEND_URL is set to http://localhost:3000

    Frontend:

    cd frontend
    cp .env.sample .env.local

    Edit frontend/.env.local and set:

    • NEXT_PUBLIC_API_URL=http://localhost:3001/api
  4. Run database migrations:

    cd backend
    npx prisma migrate dev
    npx prisma generate
  5. Start the backend (in one terminal):

    npm run dev:backend

    The backend will run on http://localhost:3001

  6. Start the frontend (in another terminal):

    npm run dev:frontend

    The frontend will run on http://localhost:3000

  7. Start the worker (optional, in another terminal):

    npm run dev:worker

    This processes background jobs for report generation.

πŸ“ Project Structure

taskflow-pro/
β”œβ”€β”€ backend/          # Express + TypeScript backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ modules/  # Feature modules (auth, users, projects, tasks, reports)
β”‚   β”‚   β”œβ”€β”€ common/   # Shared utilities (errors, middleware, logger)
β”‚   β”‚   β”œβ”€β”€ config/   # Configuration
β”‚   β”‚   └── infra/    # Infrastructure (DB, Redis, Workers)
β”‚   β”œβ”€β”€ tests/        # Test files
β”‚   β”œβ”€β”€ prisma/       # Prisma schema and migrations
β”‚   └── package.json
β”œβ”€β”€ frontend/         # Next.js 14 App Router frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/      # Next.js app router pages
β”‚   β”‚   └── lib/      # Utilities (API client, auth helpers)
β”‚   └── package.json
β”œβ”€β”€ docker/           # Docker Compose configuration
β”‚   └── docker-compose.yml
└── README.md

πŸ§ͺ Testing

Run backend tests:

cd backend
npm test

Run tests in watch mode:

npm run test:watch

Run tests with coverage:

npm run test:coverage

πŸ“ Features

Authentication & Authorization

  • βœ… JWT Authentication (access + refresh tokens)
  • βœ… Google OAuth 2.0
  • βœ… Token refresh mechanism
  • βœ… Protected routes with middleware

Project Management

  • βœ… Create, read, update, delete projects
  • βœ… Add/remove project members
  • βœ… Soft delete projects
  • βœ… Pagination and filtering

Task Management

  • βœ… Full CRUD operations for tasks
  • βœ… Task status workflow (TODO β†’ IN_PROGRESS β†’ DONE)
  • βœ… Task assignments
  • βœ… Tags and due dates
  • βœ… File attachments (metadata + URLs)
  • βœ… Kanban-style board view

Reports

  • βœ… Generate weekly/monthly reports
  • βœ… Background job processing with Worker Threads
  • βœ… Redis queue for job management
  • βœ… Project summary with caching

Infrastructure

  • βœ… Redis caching for expensive endpoints
  • βœ… Rate limiting (global and per-endpoint)
  • βœ… Security best practices (helmet, CORS, input validation)
  • βœ… Structured logging with Pino
  • βœ… Error handling middleware
  • βœ… Event Loop demonstration endpoint (/debug/event-loop)

πŸ”§ Tech Stack

Backend:

  • Node.js + TypeScript
  • Express.js
  • Prisma ORM
  • PostgreSQL
  • Redis (caching + rate limiting + job queue)
  • JWT + OAuth 2.0 (Passport.js)
  • Worker Threads for background processing
  • Jest for testing

Frontend:

  • Next.js 14 (App Router)
  • React + TypeScript
  • TailwindCSS
  • Axios for API calls

πŸ”Œ API Endpoints

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - Login
  • POST /api/auth/refresh - Refresh access token
  • POST /api/auth/logout - Logout
  • GET /api/auth/google - Google OAuth redirect
  • GET /api/auth/google/callback - Google OAuth callback

Users

  • GET /api/users/me - Get current user profile
  • PATCH /api/users/me - Update profile
  • GET /api/users - List users (paginated)

Projects

  • GET /api/projects - List user's projects
  • POST /api/projects - Create project
  • GET /api/projects/:id - Get project details
  • PATCH /api/projects/:id - Update project
  • DELETE /api/projects/:id - Delete project
  • POST /api/projects/:id/members - Add member
  • DELETE /api/projects/:id/members/:memberId - Remove member

Tasks

  • GET /api/tasks/projects/:projectId/tasks - List tasks in project
  • POST /api/tasks/projects/:projectId/tasks - Create task
  • GET /api/tasks/:id - Get task details
  • PATCH /api/tasks/:id - Update task
  • DELETE /api/tasks/:id - Delete task
  • POST /api/tasks/:id/attachments - Add attachment
  • DELETE /api/tasks/:id/attachments/:attachmentId - Remove attachment

Reports

  • GET /api/reports/projects/:projectId/reports - List reports
  • POST /api/reports/projects/:projectId/reports - Generate report
  • GET /api/reports/:id - Get report details
  • GET /api/reports/projects/:projectId/summary - Get project summary (cached)

Debug

  • GET /debug/event-loop - Event Loop demonstration

πŸ› οΈ Development

Database Management

Open Prisma Studio:

cd backend
npm run prisma:studio

Create a new migration:

cd backend
npm run prisma:migrate

Environment Variables

See backend/.env.example and frontend/.env.example for required environment variables.

πŸ“„ License

MIT

About

Full-stack task management platform showcasing production-grade Node.js architecture, modular design patterns, Redis caching, background workers, and a modern Next.js 14 frontend.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages