A simple, yet powerful ToDo app for task management, built with a React.js, TailwindCSS front-end and Node.js/Express back-end. The app allows users to create, edit, delete, and mark tasks as completed. It uses MongoDB as the database to store tasks.
- Features
- Technologies Used
- Prerequisites
- Getting Started
- Environment Variables
- Challenges and Decisions
- Deployment
- User Authentication (Sign Up, Login)
- Create, update, delete, and mark tasks as complete.
- Responsive design.
- Real-time updates (if implemented).
- React.js: For building the user interface.
- Tailwind CSS: For styling and layout.
- React Router: For routing between login, sign-up, and dashboard pages.
- Node.js with Express: For building RESTful APIs.
- MongoDB with Mongoose: For managing and storing tasks.
- JWT (JSON Web Tokens): For user authentication.
- bcrypt.js: For password hashing and secure storage.
Before running this project locally, ensure that you have:
- Node.js installed on your machine.
- MongoDB (either locally or a connection to MongoDB Atlas).
To run this app locally, follow the instructions for both the front-end and back-end.
-
Clone the repository:
git clone https://github.com/yourusername/todo-app.git cd todo-app
-
Navigate to the frontend folder:
cd frontend
-
Install dependencies:
npm install
-
Run the React development server:
npm run dev
-
The app should now be running at http://localhost:3000.
-
Navigate to the backend folder:
cd backend
-
Install dependencies:
npm install
-
Create a
.env
file in the backend directory with the required environment variables (see Environment Variables). -
Run the backend server:
npm start
-
The server should be running at http://localhost:5000 or any port you configured.
The backend requires the following environment variables to be set in a .env
file located in the /backend
directory:
PORT=5000
MONGO_URI=your_mongo_db_connection_string
JWT_SECRET=your_jwt_secret
Make sure you update the MONGO_URI
to connect to your local MongoDB instance or MongoDB Atlas.
To ensure the app looks good across different screen sizes, Tailwind CSS was used. The grid layout adjusts based on screen size, reducing the number of columns as the screen width decreases.
For secure authentication, JWT and bcrypt were used to create a token-based authentication system. The challenge was ensuring that the authentication persisted across sessions and handled token expiry correctly.
Using MongoDB and Mongoose allowed for a flexible schema design. However, deciding between embedding and referencing tasks and users required consideration of performance and scalability.
Handling asynchronous operations with Express and MongoDB required implementing consistent error messages for both frontend and backend, improving the user experience.