This is the backend API for the Taskify project, a task management application. The API allows users to create, read, update, and delete tasks while handling authentication.
- User authentication (Sign Up, Sign In)
- CRUD operations for tasks (Create, Read, Update, Delete)
- Secure endpoints using JWT authentication
- MongoDB database for storing users and tasks
- Node.js + Express.js
- Mongoose for storing user and task data
- JWT for authentication and secure access control
- bcrypt.js for password hashing and securely storing passwords
- Dotenv for managing environment variables securely
Important
Ensure you've created an account on MongoDB before proceeding.
1. Clone the repository
git clone https://github.com/artyomagadzhanyan421/rest-api-taskify.git
cd rest-api-taskify
2. Install dependencies
npm install
3. MongoDB Atlas (cloud database)
- Create a free account at MongoDB Atlas
- Create a new cluster and database
- Add
users
andtasks
collections in your database - Get your connection string (formatted as
mongodb+srv://<username>:<db_password>@<clustername>.gdbya.mongodb.net/<dbname>
). - Replace
<username>
,<password>
,<clustername>
and<dbname>
with your actual details - Add this connection string as
MONGO_URI
andJWT_SECRET
in your created.env
file
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
4. Generate an App Password
- Go to your Google Account settings
- Click on Security from the sidebar
- Enable 2-Step Verification if it's not already enabled
- In your search tab select App Passwords
- Create a new app and copy your generated password
- Add new variales in your
.env
file
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
EMAIL_USER=your-email@gmail.com
EMAIL_PASS=your-generated-app-password
5. Start your server
npx nodemon index.js