Skip to content

Repository files navigation

πŸ“‹ Mini-CRM - Task Manager

A modern task management application built with Next.js 16, TypeScript, Prisma, and NextAuth.

Next.js TypeScript Prisma Tailwind CSS

✨ Features

  • πŸ” Secure authentication with NextAuth (GitHub OAuth)
  • βœ… Task management - Create, complete, and delete tasks
  • 🎨 Modern UI with Tailwind CSS and Radix UI components
  • ⚑ Smooth animations with Framer Motion
  • πŸ“± Responsive design - Works on all devices
  • πŸ—„οΈ Database with Prisma and SQLite
  • πŸš€ Turbopack for ultra-fast development

πŸ› οΈ Technologies

Core

  • Next.js 16 - React framework with App Router
  • TypeScript - Static typing
  • React 19 - UI library

Database & Authentication

  • Prisma - ORM for database management
  • SQLite - Local database
  • NextAuth - OAuth authentication

UI & Styling

  • Tailwind CSS v4 - Utility-first CSS framework
  • Radix UI - Accessible unstyled components
  • Framer Motion - Animations and transitions
  • Lucide React - Icons

Validation & Forms

  • React Hook Form - Form management
  • Zod - Schema validation

πŸ“¦ Installation

Prerequisites

  • Node.js 20 or higher
  • npm or yarn

Installation Steps

  1. Clone the repository
git clone <your-repository>
cd mini-crm
  1. Install dependencies
npm install
  1. Configure environment variables

Create a .env file in the project root:

# Database
DATABASE_URL="file:./dev.db"

# NextAuth
NEXTAUTH_URL="http://localhost:3000"
NEXTAUTH_SECRET="your-secret-key-here"

# GitHub OAuth
GITHUB_ID="your-github-client-id"
GITHUB_SECRET="your-github-client-secret"
  1. Configure the database
# Generate Prisma client
npx prisma generate

# Run migrations
npx prisma migrate dev
  1. Start the development server
npm run dev

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

πŸ”‘ GitHub OAuth Setup

  1. Go to GitHub Developer Settings
  2. Create a new OAuth App
  3. Configure:
    • Homepage URL: http://localhost:3000
    • Authorization callback URL: http://localhost:3000/api/auth/callback/github
  4. Copy the Client ID and Client Secret to your .env file

πŸ“ Project Structure

mini-crm/
β”œβ”€β”€ app/                      # Next.js App Router
β”‚   β”œβ”€β”€ api/                  # API Routes
β”‚   β”‚   β”œβ”€β”€ auth/            # Authentication endpoints
β”‚   β”‚   └── tasks/           # Task endpoints
β”‚   β”œβ”€β”€ auth/                # Authentication pages
β”‚   β”‚   └── signin/          # Login page
β”‚   β”œβ”€β”€ globals.css          # Global styles
β”‚   β”œβ”€β”€ layout.tsx           # Root layout
β”‚   └── page.tsx             # Main page (Task Manager)
β”œβ”€β”€ components/              # React components
β”‚   β”œβ”€β”€ ui/                  # UI components (shadcn/ui)
β”‚   β”‚   β”œβ”€β”€ button.tsx
β”‚   β”‚   β”œβ”€β”€ card.tsx
β”‚   β”‚   β”œβ”€β”€ checkbox.tsx
β”‚   β”‚   β”œβ”€β”€ dialog.tsx
β”‚   β”‚   β”œβ”€β”€ input.tsx
β”‚   β”‚   └── ...
β”‚   └── providers.tsx        # Providers (SessionProvider)
β”œβ”€β”€ lib/                     # Utilities and configuration
β”‚   β”œβ”€β”€ api.ts              # API client
β”‚   β”œβ”€β”€ db.ts               # Database configuration
β”‚   β”œβ”€β”€ prisma.ts           # Prisma client
β”‚   └── utils.ts            # Utility functions
β”œβ”€β”€ prisma/                 # Prisma schema and migrations
β”‚   β”œβ”€β”€ schema.prisma       # Data model definition
β”‚   └── migrations/         # Migration history
β”œβ”€β”€ public/                 # Static files
β”œβ”€β”€ .env                    # Environment variables (not in git)
β”œβ”€β”€ package.json           # Project dependencies
β”œβ”€β”€ tailwind.config.ts     # Tailwind CSS configuration
└── tsconfig.json          # TypeScript configuration

πŸ—„οΈ Database Schema

Task

model Task {
  id          String   @id @default(cuid())
  title       String
  description String?
  completed   Boolean  @default(false)
  userId      String
  user        User     @relation(fields: [userId], references: [id], onDelete: Cascade)
  createdAt   DateTime @default(now())
  updatedAt   DateTime @updatedAt
}

User (NextAuth)

model User {
  id            String    @id @default(cuid())
  name          String?
  email         String?   @unique
  emailVerified DateTime?
  image         String?
  accounts      Account[]
  sessions      Session[]
  tasks         Task[]
}

πŸš€ Available Scripts

# Development
npm run dev          # Start development server

# Production
npm run build        # Build application for production
npm start            # Start production server

# Prisma
npx prisma studio    # Open Prisma Studio (DB UI)
npx prisma generate  # Generate Prisma client
npx prisma migrate dev  # Create and apply migrations

# Linting
npm run lint         # Run ESLint

πŸ“ API Endpoints

Authentication

  • GET /api/auth/signin - Login page
  • GET /api/auth/signout - Logout
  • GET /api/auth/session - Get current session

Tasks

  • GET /api/tasks - Get all user tasks
  • POST /api/tasks - Create a new task
  • PUT /api/tasks/[id] - Update a task
  • DELETE /api/tasks/[id] - Delete a task

🎨 Main Components

Card with Animations

Cards use Framer Motion for smooth animations:

<motion.div
  initial={{ opacity: 0, scale: 0.95 }}
  animate={{ opacity: 1, scale: 1 }}
  exit={{ opacity: 0, scale: 0.95 }}
  transition={{ duration: 0.25 }}
>
  {/* Content */}
</motion.div>

Task List with AnimatePresence

Tasks animate in and out:

<AnimatePresence mode="popLayout">
  {tasks.map((task, index) => (
    <motion.div
      key={task.id}
      initial={{ opacity: 0, x: 20 }}
      animate={{ opacity: 1, x: 0 }}
      exit={{ opacity: 0, x: -20 }}
      transition={{ duration: 0.2, delay: index * 0.05 }}
    >
      {/* Task card */}
    </motion.div>
  ))}
</AnimatePresence>

πŸ”’ Security

  • βœ… OAuth authentication with GitHub
  • βœ… Secure sessions with NextAuth
  • βœ… Data validation with Zod
  • βœ… CSRF protection
  • βœ… Environment variables for secrets

🀝 Contributing

Contributions are welcome. Please:

  1. Fork the project
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License.

πŸ‘¨β€πŸ’» Author

Your name - @your-username

πŸ™ Acknowledgments


⭐ If you found this project helpful, consider giving it a star on GitHub!

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages