{"id":30738699,"url":"https://github.com/garvmathur7700/task-manager-api","last_synced_at":"2026-05-18T03:33:49.739Z","repository":{"id":312910770,"uuid":"1049247040","full_name":"garvmathur7700/task-manager-api","owner":"garvmathur7700","description":"Task Manager with REST APIs and JWT-authentication in spring boot (java)","archived":false,"fork":false,"pushed_at":"2025-09-02T18:13:12.000Z","size":31,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-02T20:17:28.797Z","etag":null,"topics":["backend-api","jwt-authentication","rest-api","spring-boot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/garvmathur7700.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-02T17:40:20.000Z","updated_at":"2025-09-02T18:15:23.000Z","dependencies_parsed_at":"2025-09-02T20:17:39.385Z","dependency_job_id":"8760d4a3-1fe1-4375-b0bd-19b6876e0bd1","html_url":"https://github.com/garvmathur7700/task-manager-api","commit_stats":null,"previous_names":["garvmathur7700/task-manager-api"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/garvmathur7700/task-manager-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garvmathur7700%2Ftask-manager-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garvmathur7700%2Ftask-manager-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garvmathur7700%2Ftask-manager-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garvmathur7700%2Ftask-manager-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/garvmathur7700","download_url":"https://codeload.github.com/garvmathur7700/task-manager-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/garvmathur7700%2Ftask-manager-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33163753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T22:39:12.733Z","status":"online","status_checked_at":"2026-05-18T02:00:06.436Z","response_time":71,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend-api","jwt-authentication","rest-api","spring-boot"],"created_at":"2025-09-03T22:02:34.148Z","updated_at":"2026-05-18T03:33:49.722Z","avatar_url":"https://github.com/garvmathur7700.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📝 Task Management REST API\n\nA comprehensive backend-only Task Management System built with **Java Spring Boot**, featuring secure user authentication and full CRUD operations for task management.\n\n## 🎯 Project Overview\n\nThis is a production-ready REST API that allows users to register, log in, and manage their personal tasks. The system is designed with modern backend development practices, including JWT-based authentication, MongoDB integration, and proper security measures.\n\n### ✨ Key Features\n\n- 🔐 **Secure Authentication** - JWT-based user authentication and authorization\n- 📋 **Task Management** - Complete CRUD operations for tasks\n- 👤 **User Isolation** - Each user can only access their own tasks\n- 🏗️ **Clean Architecture** - Proper separation of concerns with controllers, services, and repositories\n- 🛡️ **Security** - BCrypt password hashing and JWT token validation\n- 📊 **Monitoring** - Built-in health checks and metrics via Spring Boot Actuator\n- 🚀 **Production Ready** - Error handling, validation, and proper HTTP status codes\n\n## 🛠️ Tech Stack\n\n| Technology | Purpose |\n|------------|---------|\n| **Java 17+** | Programming language |\n| **Spring Boot 3.5.5** | Framework for building the REST API |\n| **Spring Security + JWT** | Authentication and authorization |\n| **MongoDB** | NoSQL database for storing users and tasks |\n| **Spring Data MongoDB** | Database abstraction layer |\n| **Lombok** | Reducing boilerplate code |\n| **Maven** | Dependency management and build tool |\n\n## 📂 Project Structure\n\n```\nsrc/main/java/com/garv/task_api/\n├── controller/         # REST controllers\n│   └── TaskController.java\n├── dto/               # Data Transfer Objects\n│   └── AuthRequest.java\n├── exception/         # Custom exceptions\n│   ├── Forbidden.java\n│   └── NotFound.java\n├── model/             # Entity classes\n│   └── Task.java\n├── repository/        # Data access layer\n│   └── TaskRepository.java\n├── security/          # Security configuration\n│   ├── JwtFilter.java\n│   ├── JwtUtil.java\n│   └── SecurityConfig.java\n├── service/           # Business logic layer\n│   └── TaskService.java\n├── AuthController.java       # Authentication endpoints\n├── User.java                # User entity\n├── UserRepository.java      # User data access\n└── TaskApiApplication.java  # Main application class\n```\n\n## 🚀 Getting Started\n\n### Prerequisites\n\n- **Java 17** or higher\n- **Maven 3.6+**\n- **Docker** (for MongoDB)\n- **Git**\n\n### 📥 Clone the Repository\n\n```bash\ngit clone https://github.com/garvmathur7700/task-manager-api.git\ncd task-manager-api\n```\n\n### 🐳 MongoDB Setup with Docker\n\nThe easiest way to run MongoDB for this project is using Docker:\n\n#### Docker Run Command\n```bash\n# Run MongoDB in a Docker container\ndocker run -d \\\n  --name taskdb-mongo \\\n  -p 27017:27017 \\\n  -e MONGO_INITDB_ROOT_USERNAME=admin \\\n  -e MONGO_INITDB_ROOT_PASSWORD=password \\\n  -e MONGO_INITDB_DATABASE=taskdb \\\n  mongo:latest\n```\n\n#### Verify MongoDB is Running\n```bash\n# Check if MongoDB container is running\ndocker ps | grep mongo\n\n# Connect to MongoDB (optional)\ndocker exec -it taskdb-mongo mongosh\n```\n\n### ⚙️ Configuration\n\n1. **Configure MongoDB** in `src/main/resources/application.yml`:\n   \n   **For Docker MongoDB without authentication:**\n   ```yaml\n   spring:\n     data:\n       mongodb:\n         uri: mongodb://localhost:27017/taskdb\n   ```\n\n2. **Update JWT Secret** (recommended for production):\n   ```yaml\n   app:\n     jwt:\n       secret: \"your-super-secure-secret-key-here\"\n       expiration-minutes: 60\n   ```\n\n### 🏃‍♂️ Running the Application\n\n1. **Install dependencies and compile**:\n   ```bash\n   mvn clean compile\n   ```\n\n2. **Run the application**:\n   ```bash\n   mvn spring-boot:run\n   ```\n\n3. **Verify the application is running**:\n   ```bash\n   curl http://localhost:8080/actuator/health\n   ```\n   Expected response: `{\"status\":\"UP\"}`\n\n## 📚 API Documentation\n\n### 🔓 Public Endpoints (No Authentication Required)\n\n#### User Registration\n```http\nPOST /auth/register\nContent-Type: application/json\n\n{\n  \"username\": \"john_doe\",\n  \"password\": \"securePassword123\"\n}\n```\n\n#### User Login\n```http\nPOST /auth/login\nContent-Type: application/json\n\n{\n  \"username\": \"john_doe\",\n  \"password\": \"securePassword123\"\n}\n```\n**Response**: JWT token string\n\n### 🔐 Protected Endpoints (JWT Token Required)\n\nAdd the JWT token to the Authorization header:\n```\nAuthorization: Bearer your_jwt_token_here\n```\n\n#### Create Task\n```http\nPOST /tasks\nContent-Type: application/json\nAuthorization: Bearer {token}\n\n{\n  \"title\": \"Complete project documentation\",\n  \"description\": \"Write comprehensive API documentation\",\n  \"status\": \"TODO\",\n  \"dueDate\": \"2025-12-31\"\n}\n```\n\n#### Get All Tasks\n```http\nGET /tasks?status=TODO\u0026page=0\u0026size=10\nAuthorization: Bearer {token}\n```\n\n**Query Parameters**:\n- `status` (optional): Filter by `TODO`, `IN_PROGRESS`, or `DONE`\n- `page` (optional): Page number (default: 0)\n- `size` (optional): Items per page (default: 10)\n\n#### Get Specific Task\n```http\nGET /tasks/{taskId}\nAuthorization: Bearer {token}\n```\n\n#### Update Task\n```http\nPUT /tasks/{taskId}\nContent-Type: application/json\nAuthorization: Bearer {token}\n\n{\n  \"title\": \"Updated task title\",\n  \"description\": \"Updated description\",\n  \"status\": \"IN_PROGRESS\",\n  \"dueDate\": \"2025-11-30\"\n}\n```\n\n#### Delete Task\n```http\nDELETE /tasks/{taskId}\nAuthorization: Bearer {token}\n```\n\n### 💚 Health Check\n```http\nGET /actuator/health\n```\n\n## 🔧 Testing with Postman\n\n1. **Import the collection**: Create a new Postman collection for \"Task Management API\"\n2. **Set up environment variables**:\n   - `baseUrl`: `http://localhost:8080`\n   - `jwtToken`: (paste your token after login)\n3. **Test flow**:\n   1. Register a new user\n   2. Login to get JWT token\n   3. Set the token in your environment\n   4. Test all CRUD operations\n\n## 🗄️ Database Schema\n\n### User Collection\n```javascript\n{\n  \"_id\": \"ObjectId\",\n  \"username\": \"string (unique)\",\n  \"password\": \"string (bcrypt hashed)\"\n}\n```\n\n### Task Collection\n```javascript\n{\n  \"_id\": \"ObjectId\",\n  \"ownerId\": \"string (username)\",\n  \"title\": \"string\",\n  \"description\": \"string\",\n  \"status\": \"TODO | IN_PROGRESS | DONE\",\n  \"dueDate\": \"date\",\n  \"createdAt\": \"timestamp\",\n  \"updatedAt\": \"timestamp\"\n}\n```\n\n## 🛡️ Security Features\n\n- **Password Hashing**: BCrypt with salt for secure password storage\n- **JWT Authentication**: Stateless authentication using JSON Web Tokens\n- **Authorization**: Users can only access their own tasks\n- **Input Validation**: Comprehensive validation on all endpoints\n- **Error Handling**: Proper HTTP status codes and error messages\n\n## 🚀 Production Deployment\n\n### Environment Variables\nSet these environment variables in production:\n\n```bash\nMONGODB_URI=mongodb://your-production-mongodb-uri\nJWT_SECRET=your-super-secure-production-secret\nSERVER_PORT=8080\n```\n\n### Docker Support (Optional)\nCreate a `Dockerfile`:\n\n```dockerfile\nFROM openjdk:17-jdk-slim\nCOPY target/task-api-*.jar app.jar\nEXPOSE 8080\nENTRYPOINT [\"java\", \"-jar\", \"/app.jar\"]\n```\n\nBuild and run:\n```bash\nmvn clean package\ndocker build -t task-api .\ndocker run -p 8080:8080 task-api\n```\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 👨‍💻 Author\n\n- GitHub: [@garvmathur7700](https://github.com/garvmathur7700)\n- LinkedIn: [garvvmathur](https://linkedin.com/in/garvvmathur)\n\n---\n\n## 📊 API Response Examples\n\n### Successful Task Creation\n```json\n{\n  \"id\": \"507f1f77bcf86cd799439011\",\n  \"title\": \"Complete project documentation\",\n  \"description\": \"Write comprehensive API documentation\",\n  \"status\": \"TODO\",\n  \"dueDate\": \"2025-12-31\",\n  \"createdAt\": \"2025-09-02T10:15:30Z\",\n  \"updatedAt\": \"2025-09-02T10:15:30Z\"\n}\n```\n\n### Task List Response\n```json\n{\n  \"tasks\": [\n    {\n      \"id\": \"507f1f77bcf86cd799439011\",\n      \"title\": \"Complete project documentation\",\n      \"description\": \"Write comprehensive API documentation\",\n      \"status\": \"TODO\",\n      \"dueDate\": \"2025-12-31\",\n      \"createdAt\": \"2025-09-02T10:15:30Z\",\n      \"updatedAt\": \"2025-09-02T10:15:30Z\"\n    }\n  ],\n  \"totalTasks\": 1,\n  \"currentPage\": 0,\n  \"totalPages\": 1,\n  \"hasNext\": false,\n  \"hasPrevious\": false\n}\n```\n\n### Error Response\n```json\n{\n  \"error\": \"Task not found\",\n  \"message\": \"Task with id 507f1f77bcf86cd799439011 not found\",\n  \"timestamp\": \"2025-09-02T10:15:30Z\",\n  \"status\": 404\n}\n```\n\n\n---\n\n**Happy Coding! 🚀**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarvmathur7700%2Ftask-manager-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgarvmathur7700%2Ftask-manager-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgarvmathur7700%2Ftask-manager-api/lists"}