A simple, full-stack TODO application built with React and PHP.
- Create, Read, Update, and Delete tasks
- Mark tasks as complete/incomplete
- Persistent storage using MySQL database
- RESTful API built with PHP
- Responsive front-end design using React
- Frontend:
- React
- Vite for build tool and development server
- Backend:
- PHP
- MySQL
- Development Tools:
- Git for version control
- npm for package management
react-php-todo/
├── client/ # React frontend
│ ├── src/
│ │ ├── components/
│ │ └── App.jsx
│ ├── index.html
│ └── package.json
└── server/ # PHP backend
├── tasks.php
└── db_connection.php
- Node.js and npm
- PHP 7.4 or higher
- MySQL
- Web server (e.g., Apache, Nginx)
-
Clone the repository:
git clone https://github.com/bufordeeds/react-php-todo.git cd react-php-todo
-
Set up the database:
- Create a new MySQL database named
task_manager
- Use the following SQL to create the
tasks
table:CREATE TABLE tasks ( id INT AUTO_INCREMENT PRIMARY KEY, title VARCHAR(255) NOT NULL, completed TINYINT(1) NOT NULL DEFAULT 0 );
- Create a new MySQL database named
-
Configure the backend:
- Navigate to the
server
directory - Open
db_connection.php
and update the database connection details:$host = 'localhost'; $db = 'task_manager'; $user = 'your_database_username'; $pass = 'your_database_password';
- Navigate to the
-
Install frontend dependencies and start the development server:
cd client npm install npm run dev
-
Configure your web server:
- Set up your web server (Apache or Nginx) to serve the
server
directory - Ensure PHP is properly configured with your web server
- Set up your web server (Apache or Nginx) to serve the
-
Access the application:
- The React app will be running at the URL provided by Vite (usually
http://localhost:5173
) - The API should be accessible at
http://localhost/path-to-your-server-directory/tasks.php
- The React app will be running at the URL provided by Vite (usually
Make sure your web server and MySQL server are running before starting the application.
- GET
/tasks.php
: Fetch all tasks - POST
/tasks.php
: Create a new task - PUT
/tasks.php
: Update an existing task - DELETE
/tasks.php?id={taskId}
: Delete a task
- Add user authentication
- Implement task categories or tags
- Add due dates for tasks
- Enhance error handling and validation
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.