PremacAI

TaskMaster - MERN Stack Task Management App

A full-stack task management application built with the MERN stack (MongoDB, Express.js, React, Node.js) using Next.js framework.

πŸš€ Features

πŸ› οΈ Tech Stack

Frontend

Backend

Database

πŸ“¦ Installation & Setup

Prerequisites

1. Clone the Repository

```bash git clone https://github.com/yourusername/taskmaster-app.git cd taskmaster-app ```

2. Install Dependencies

```bash npm install ```

3. Environment Variables

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

```env MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/taskmaster JWT_SECRET=your-super-secret-jwt-key-here ```

4. MongoDB Setup

  1. Create a MongoDB Atlas account at mongodb.com
  2. Create a new cluster
  3. Get your connection string
  4. Replace the MONGODB_URI in your `.env.local` file

5. Run the Application

```bash npm run dev ```

The application will be available at `http://localhost:3000`

πŸ—οΈ Project Structure

``` taskmaster-app/ β”œβ”€β”€ app/ β”‚ β”œβ”€β”€ api/ β”‚ β”‚ β”œβ”€β”€ auth/ β”‚ β”‚ β”‚ β”œβ”€β”€ login/route.ts β”‚ β”‚ β”‚ └── register/route.ts β”‚ β”‚ └── tasks/ β”‚ β”‚ β”œβ”€β”€ route.ts β”‚ β”‚ └── [id]/route.ts β”‚ β”œβ”€β”€ auth/ β”‚ β”‚ β”œβ”€β”€ login/page.tsx β”‚ β”‚ └── register/page.tsx β”‚ β”œβ”€β”€ dashboard/page.tsx β”‚ β”œβ”€β”€ layout.tsx β”‚ └── page.tsx β”œβ”€β”€ components/ui/ β”œβ”€β”€ contexts/ β”‚ └── AuthContext.tsx β”œβ”€β”€ lib/ β”‚ └── mongodb.ts β”œβ”€β”€ models/ β”‚ β”œβ”€β”€ User.ts β”‚ └── Task.ts └── types/ └── global.d.ts ```

πŸ”Œ API Endpoints

Authentication

Tasks (Protected)

πŸ—„οΈ Database Schema

User Model

```javascript { name: String (required), email: String (required, unique), password: String (required, hashed), timestamps: true } ```

Task Model

```javascript { title: String (required), description: String, completed: Boolean (default: false), userId: ObjectId (ref: User), timestamps: true } ```

πŸ” Authentication Flow

  1. User registers with name, email, and password
  2. Password is hashed using bcrypt
  3. User logs in with email and password
  4. Server validates credentials and returns JWT token
  5. Token is stored in localStorage and sent with API requests
  6. Protected routes verify token before allowing access

🎨 UI Components

The application uses a modern, responsive design with:

πŸš€ Deployment

Frontend (Vercel)

  1. Push code to GitHub
  2. Connect repository to Vercel
  3. Add environment variables in Vercel dashboard
  4. Deploy automatically

Database (MongoDB Atlas)

πŸ§ͺ Testing

Manual Testing Checklist

πŸ”’ Security Features

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (`git checkout -b feature/amazing-feature`)
  3. Commit your changes (`git commit -m β€˜Add amazing feature’`)
  4. Push to the branch (`git push origin feature/amazing-feature`)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License.

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

Your Name

πŸ™ Acknowledgments