A small task management application with a React/Vite frontend, an Express API, and a MySQL database.
- Frontend: React 19, Vite, Tailwind CSS, Axios
- Backend: Node.js, Express, MySQL2
- Database: MySQL
Install the following before running the application:
- Node.js 18 or later with npm
- MySQL 8 or later
- MySQL Workbench
Clone the project from GitHub to your local computer:
git clone https://github.com/Solayiwo/task_manager.git
cd <repository-name>On Windows, you can run these commands in gitbash, PowerShell, Command Prompt, or the VS Code terminal. After cloning, continue with the database setup, configuration, and dependency installation steps below.
backend/ Express API and MySQL connection
frontend/ React/Vite application
- Start the MySQL server.
- Open MySQL Workbench and connect to your local MySQL server.
- Open
backend/db/schema.sqlin MySQL Workbench. - Execute the complete script using the lightning-bolt button or
Ctrl+Enter. - Refresh the Schemas panel. You should see the
task_dbdatabase and itstaskstable.
The schema creates a database named task_db and a tasks table. The database user must have permission to create the database and tables, or the database can be created manually first.
Create backend/.env with the database connection and API port:
PORT=5000
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=task_dbCreate frontend/.env with the backend API base URL:
VITE_API_BASE_URL=http://localhost:5000/apiDo not commit real passwords or other secrets. The frontend variable is read by Vite at build time, so restart the frontend dev server after changing it.
Install dependencies in both applications:
cd backend
npm install
cd ../frontend
npm installRun the backend and frontend in separate terminals.
Backend:
cd backend
npm run devThe API runs at http://localhost:5000, with task endpoints under /api/tasks.
Frontend:
cd frontend
npm run devOpen the URL printed by Vite, normally http://localhost:5173.
The backend can be started without nodemon with npm run start or node server.js.
The application supports:
- Creating, viewing, updating, and deleting tasks
- Searching and filtering by task status
- Sorting by due date or creation date
- Tracking pending, in-progress, and completed tasks
The API validates required titles and descriptions, limits descriptions to 2,000 characters, accepts only the three supported statuses, and requires due dates in YYYY-MM-DD format on or after the current date. On update, the due date must also remain on or after both the current date and the task's creation date.
The frontend uses NotFound.jsx as React Router's route error page. It displays a 404 message when a requested page does not exist or a route cannot be resolved, and provides a Back to Home link so the user can return to the task dashboard.
The page is registered as the router's errorElement in App.jsx and is exported through pages/index.js.
The frontend communicates with the backend through the /api/tasks endpoints:
- Initial load:
GET /api/tasksretrieves all tasks when the dashboard opens. - Create:
POST /api/taskscreates a task, then the frontend fetches the task list again to show the saved record. - View: The selected task is displayed from the task data already loaded in frontend state, so no additional request is required.
- Edit:
PUT /api/tasks/:idupdates the task, updates the selected task, and refreshes the task list from the database. - Delete:
DELETE /api/tasks/:idremoves the task, then refreshes the task list.
Refreshing after create, edit, and delete keeps the dashboard synchronized with the database and ensures the UI displays the server's saved values.
- The application is intended for local development and does not include authentication or user-specific task ownership.
- MySQL is the source of truth; the frontend refreshes task data after create, update, and delete operations.
- Completed tasks are treated as finalized: the UI does not expose edit controls for them, and the API rejects update requests for them. They can still be viewed or deleted.
- The backend normalizes date values to
YYYY-MM-DDbefore returning them to the frontend. - CORS is enabled for local frontend/backend development.
- Database connection error: Confirm MySQL is running and that
DB_HOST,DB_USER,DB_PASSWORD, andDB_NAMEmatch the local database. - Frontend cannot load tasks: Confirm the backend is running on port 5000 and that
VITE_API_BASE_URLends with/api. - Schema import fails: Check that the MySQL user has permission to create
task_db, or create the database manually and rerun the table portion of the schema.