Skip to content

alex-web13-2001/task24

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

task24 - Kanban Board (MERN Stack)

A full-stack Kanban board application built with the MERN stack (MongoDB, Express, React, Node.js). Manage your tasks with drag-and-drop functionality, priority levels, and real-time database synchronization.

Features

  • βœ… Create, read, update, and delete tasks
  • 🎯 Three status columns: To Do, In Progress, Done
  • 🎨 Priority levels: Low, Medium, High
  • πŸ–±οΈ Drag and drop tasks between columns
  • πŸ’Ύ MongoDB database integration
  • 🎭 Modern and responsive UI
  • ⚑ Fast development with Vite

Tech Stack

  • MongoDB - NoSQL database for storing tasks
  • Express.js - Backend web framework
  • React - Frontend library with Vite
  • Node.js - JavaScript runtime
  • Axios - HTTP client for API calls

Project Structure

task24/
β”œβ”€β”€ client/                  # React frontend (Vite)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/      # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ KanbanColumn.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ TaskCard.jsx
β”‚   β”‚   β”‚   └── TaskModal.jsx
β”‚   β”‚   β”œβ”€β”€ services/        # API service layer
β”‚   β”‚   β”‚   └── api.js
β”‚   β”‚   β”œβ”€β”€ App.jsx          # Main app component
β”‚   β”‚   └── main.jsx         # Entry point
β”‚   β”œβ”€β”€ .env                 # Environment variables
β”‚   └── package.json
β”œβ”€β”€ server/                  # Express backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ models/          # Mongoose models
β”‚   β”‚   β”‚   └── Task.js
β”‚   β”‚   β”œβ”€β”€ routes/          # API routes
β”‚   β”‚   β”‚   └── taskRoutes.js
β”‚   β”‚   β”œβ”€β”€ controllers/     # Route controllers
β”‚   β”‚   β”‚   └── taskController.js
β”‚   β”‚   β”œβ”€β”€ config/          # Configuration
β”‚   β”‚   β”‚   └── database.js
β”‚   β”‚   └── index.js         # Server entry point
β”‚   β”œβ”€β”€ .env.example         # Environment template
β”‚   └── package.json
β”œβ”€β”€ package.json             # Root scripts
β”œβ”€β”€ .gitignore
└── README.md

Installation

Prerequisites

  • Node.js (v14 or higher)
  • MongoDB (local installation or MongoDB Atlas account)
  • npm or yarn

Step 1: Clone the repository

git clone https://github.com/alex-web13-2001/task24.git
cd task24

Step 2: Install dependencies

# Install root dependencies
npm install

# Install server dependencies
cd server
npm install

# Install client dependencies
cd ../client
npm install

Step 3: Configure MongoDB

Option A: Local MongoDB

If you have MongoDB installed locally, it will connect to mongodb://localhost:27017/task24 by default.

Option B: MongoDB Atlas

  1. Create a free account at MongoDB Atlas
  2. Create a new cluster
  3. Get your connection string
  4. Create .env file in the server directory:
cd server
cp .env.example .env
  1. Edit .env and add your MongoDB URI:
PORT=5000
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/task24?retryWrites=true&w=majority
NODE_ENV=development

Step 4: Run the application

Option A: Run both client and server together (Recommended)

# From the root directory
npm run dev

This will start:

Option B: Run separately

# Terminal 1 - Start backend server
cd server
npm run dev

# Terminal 2 - Start frontend
cd client
npm run dev

API Endpoints

Tasks

Method Endpoint Description
GET /api/tasks Get all tasks
GET /api/tasks/:id Get task by ID
POST /api/tasks Create new task
PUT /api/tasks/:id Update task
DELETE /api/tasks/:id Delete task
PUT /api/tasks/batch/update Update multiple tasks

Task Schema

{
  title: String (required),
  description: String,
  status: String (enum: ['todo', 'in-progress', 'done']),
  priority: String (enum: ['low', 'medium', 'high']),
  order: Number,
  createdAt: Date,
  updatedAt: Date
}

Usage

  1. Create a task: Click the "+ Add Task" button in the header
  2. Edit a task: Click the ✏️ icon on any task card
  3. Delete a task: Click the πŸ—‘οΈ icon on any task card
  4. Move a task: Drag and drop task cards between columns
  5. Set priority: Use the priority dropdown when creating/editing tasks

Development

Available Scripts

Root directory

  • npm run dev - Run both client and server concurrently
  • npm run client - Run only the React frontend
  • npm run server - Run only the Express backend
  • npm run install-all - Install all dependencies

Server directory

  • npm start - Start server in production mode
  • npm run dev - Start server with nodemon (auto-reload)

Client directory

  • npm run dev - Start Vite dev server
  • npm run build - Build for production
  • npm run preview - Preview production build

Deployment

Backend Deployment

  1. Set environment variables on your hosting platform
  2. Ensure MongoDB URI is configured
  3. Run npm start in the server directory

Frontend Deployment

  1. Update VITE_API_URL in client .env to your backend URL
  2. Build the app: npm run build in client directory
  3. Deploy the dist folder to your hosting platform

Recommended Platforms

  • Backend: Heroku, Railway, Render, DigitalOcean
  • Frontend: Vercel, Netlify, GitHub Pages
  • Database: MongoDB Atlas (free tier available)

Environment Variables

Server (.env)

PORT=5000
MONGODB_URI=mongodb://localhost:27017/task24
NODE_ENV=development

Client (.env)

VITE_API_URL=http://localhost:5000/api

Troubleshooting

Cannot connect to MongoDB

  • Make sure MongoDB is running locally, or
  • Check your MongoDB Atlas connection string
  • Verify network access is allowed in MongoDB Atlas

CORS errors

  • Ensure the backend server is running
  • Check that CORS is enabled in server/src/index.js

Tasks not loading

  • Open browser console to check for errors
  • Verify the API URL in client/.env
  • Ensure backend server is running on the correct port

License

MIT

Author

Created with ❀️ using MERN stack

About

MERN Stack Project (MongoDB + Express + React + Node.js)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published