Skip to content

About

A modern, full-stack task management application built with Next.js 16, Prisma ORM, and Tailwind CSS. Organize your tasks efficiently with an intuitive interface and persistent SQLite database.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Task Management App

A modern, full-stack task management application built with Next.js 16, Prisma ORM, and Tailwind CSS. Organize your tasks efficiently with an intuitive interface and persistent SQLite database.

🎯 Features

  • βœ… Create Tasks - Add new tasks with title, description, and priority levels
  • βœ… Edit Tasks - Update existing task details inline
  • βœ… Delete Tasks - Remove completed or unwanted tasks
  • βœ… Toggle Completion - Mark tasks as complete or incomplete
  • βœ… Priority Levels - Set Low, Medium, or High priority for each task
  • βœ… Task Organization - View pending and completed tasks in separate sections
  • βœ… Persistent Storage - SQLite database for reliable data persistence
  • βœ… Dark Theme - Modern dark interface with black background and white text
  • βœ… Server Actions - Secure server-side operations for all database mutations

πŸ› οΈ Tech Stack

πŸ“‹ Project Structure

.
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ action.ts          # Server actions for CRUD operations
β”‚   β”œβ”€β”€ layout.tsx         # Root layout with dark theme setup
β”‚   β”œβ”€β”€ page.tsx           # Home page component
β”‚   └── globals.css        # Global styles
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ AddTaskButton.tsx  # Add task modal toggle button
β”‚   β”œβ”€β”€ TaskForm.tsx       # Create/edit task form
β”‚   β”œβ”€β”€ TaskItem.tsx       # Individual task card
β”‚   └── TaskList.tsx       # Task list container
β”œβ”€β”€ lib/
β”‚   └── prisma.ts          # Prisma client singleton
β”œβ”€β”€ prisma/
β”‚   └── schema.prisma      # Database schema definition
β”œβ”€β”€ public/                # Static assets
β”œβ”€β”€ package.json           # Dependencies and scripts
β”œβ”€β”€ tailwind.config.ts     # Tailwind configuration
β”œβ”€β”€ tsconfig.json          # TypeScript configuration
└── next.config.ts         # Next.js configuration

πŸš€ Getting Started

Prerequisites

  • Node.js 18+ or higher
  • npm, yarn, or pnpm package manager

Installation

  1. Clone or extract the project:
cd prisma-nextjs-task-management-app
  1. Install dependencies:
npm install
# or
yarn install
# or
pnpm install
  1. Setup environment variables:

Create a .env.local file in the root directory (optional - defaults to file:./dev.db):

DATABASE_URL="file:./dev.db"
  1. Initialize the database:
npx prisma db push
  1. Start the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
  1. Open in browser: Navigate to http://localhost:3000 to see the application.

πŸ’Ύ Database Schema

The application uses a single Task model with the following fields:

model Task {
  id          Int      @id @default(autoincrement())
  title       String                           // Task title (required)
  description String?                          // Task description (optional)
  completed   Boolean  @default(false)        // Completion status
  priority    String   @default("medium")     // Priority: low | medium | high
  createdAt   DateTime @default(now())        // Creation timestamp
  updatedAt   DateTime @updatedAt             // Last update timestamp
}

πŸ”§ Server Actions

All database operations are handled through server actions in app/action.ts:

createTask(formData: FormData)

Creates a new task in the database.

  • Parameters: FormData with title, description, and priority
  • Returns: { error?: string }

getTasks()

Fetches all tasks from the database.

  • Parameters: None
  • Returns: Task[] (sorted by creation date, newest first)

toggleTaskComplete(id: number)

Toggles the completion status of a task.

  • Parameters: Task ID
  • Returns: Task update result

updateTask(id: number, formData: FormData)

Updates an existing task's details.

  • Parameters: Task ID and FormData with new values
  • Returns: { error?: string }

deleteTask(id: number)

Deletes a task from the database.

  • Parameters: Task ID
  • Returns: Task deletion result

🎨 Component Guide

AddTaskButton

Modal toggle button for opening the task creation form.

  • State: isOpen - controls modal visibility
  • Props: None

TaskForm

Reusable form component for creating and editing tasks.

  • Props:
    • task? - Optional task object for edit mode
    • onSuccess? - Callback when submission succeeds
  • Features: Validation, error handling, loading states

TaskItem

Individual task card with actions.

  • Props: task - Task object to display
  • Actions: Edit, Delete, Toggle Completion
  • Features: Inline editing, priority badges, completion indicators

TaskList

Server component that fetches and displays all tasks.

  • Props: None
  • Features: Separates tasks into pending and completed sections

πŸŒ™ Dark Theme

The application uses a permanent dark theme with:

  • Black background (bg-black)
  • White text (text-white)
  • Dark gray cards (bg-gray-900)
  • Colored priority badges:
    • Low: Green background
    • Medium: Yellow background
    • High: Red background

Theme is configured in app/layout.tsx with the dark class on the HTML element.

πŸ“¦ Available Scripts

# Development server
npm run dev

# Build for production
npm run build

# Start production server
npm run start

# Run linter
npm run lint

# Run TypeScript type checking
npm run tsc

πŸ” Data Persistence

All tasks are stored in a local SQLite database at ./dev.db. The database is created automatically on first run via Prisma migrations.

To reset the database:

rm dev.db
npx prisma db push

πŸ› Troubleshooting

Port 3000 already in use

# Kill process on port 3000
npx kill-port 3000

# Or use a different port
npm run dev -- -p 3001

Database issues

# Reset Prisma client
rm -rf node_modules/.prisma

# Reinitialize database
npx prisma db push --force-reset

Hydration warnings

The app uses suppressHydrationWarning on the root HTML element to prevent mismatches between server and client rendering during theme initialization.

πŸš€ Deployment

The application can be deployed to:

  • Vercel - Recommended for Next.js apps (native support)
  • Netlify - Via Next.js adapters

For Vercel deployment:

npm install -g vercel
vercel

πŸ“„ License

This project is open source and available under the MIT License.

Built with ❀️ using Next.js, Prisma, and Tailwind CSS

About

A modern, full-stack task management application built with Next.js 16, Prisma ORM, and Tailwind CSS. Organize your tasks efficiently with an intuitive interface and persistent SQLite database.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages