## Task 1: Implement Backend User Authentication & Profile Management [BACKEND] — TEST: UNSUCCESSFUL
Develop the Python FastAPI backend services for user registration, secure login (JWT-based), user profile management (view and edit), and user search functionality. This includes implementing secure password hashing (bcrypt), API rate limiting on authentication and registration endpoints, and defining the initial PostgreSQL database schema for users.

### 1.1 Database Schema for Users
- [x] Define and implement the PostgreSQL schema for users.

### 1.2 User Entity and Repository
- [x] Create the User entity and Spring Data JPA repository.

### 1.3 Authentication Service (Registration & Login)
- [x] Implement user registration with password hashing (bcrypt) and JWT-based login.

### 1.4 User Profile Service
- [x] Define UserProfile DTO for request and response.
- [x] Implement service method to retrieve user profile by ID.
- [x] Implement service method to update user profile.
- [x] Create REST controller endpoints for user profile management.

### 1.5 User Search Service
- [x] 1.5.1 Create UserSearchDTO for search results.
- [z] 1.5.2 Add search method to UserRepository.
- [x] 1.5.3 Implement search logic in UserService.
- [z] 1.5.4 Create REST endpoint for user search.

### 1.6 JWT Utility and Security Configuration
- [z] Implement JWT token generation, validation, and integrate with Spring Security.

### 1.7 API Rate Limiting
- [z] Implement rate limiting for authentication and registration endpoints.

## Task 2: Develop Frontend User Authentication & Profile Integration [FRONTEND]
Integrate the existing Angular Clarity frontend components for user authentication and profile management with the new FastAPI backend. This involves adapting the login, registration, and profile UI to consume the new backend APIs, implementing secure JWT handling (e.g., HttpOnly cookies, token refresh), developing new UI for user search, and displaying user online/offline presence. Also, implement a strict Content Security Policy (CSP) for the frontend.

## Task 3: Build Full-Stack One-to-One Real-time Messaging (MVP) [FULL-STACK]
Implement the core one-to-one real-time messaging functionality. This includes:
- **Backend:** Developing FastAPI/Starlette WebSocket services for real-time message delivery, implementing message persistence in PostgreSQL, utilizing Redis for Pub/Sub to scale WebSocket services, and using Redis Streams/Lists for guaranteed message delivery to offline users.
- **Frontend:** Developing Angular UI components for displaying a list of active conversations, an interactive chat window for sending and receiving messages in real-time, and efficiently loading and displaying historical messages.

## Task 4: Implement Full-Stack Group Chat Capabilities [FULL-STACK]
Extend the messaging application to support group conversations. This task involves:
- **Backend:** Developing APIs and WebSocket logic for creating new group chats, managing group members (add/remove), and handling message sending/receiving within groups.
- **Frontend:** Developing UI for creating and managing group chats, displaying group conversation lists, and an enhanced chat interface for group messaging.

## Task 5: Develop Full-Stack Enhanced Communication Features [FULL-STACK]
Introduce advanced communication features to enrich the user experience. This includes:
- **Backend:** Developing services for real-time new message notifications, user status notifications, and integrating with object storage for media sharing (upload/storage).
- **Frontend:** Implementing UI for displaying in-app notifications, visual indicators for user status, and functionality for uploading and displaying various media types within chat conversations.

## Current Task Status
**Currently Working On:** Task 2 - Develop Frontend User Authentication & Profile Integration [FRONTEND]
**Next Task:** Task 2 - Develop Frontend User Authentication & Profile Integration [FRONTEND]
**Completed Tasks:** Task 1.4 - User Profile Service, Task 1.5.1 - Create UserSearchDTO for search results., Task 1.5.2 - Add search method to UserRepository., Task 1.5.3 - Implement search logic in UserService., Task 1.5.4 - Create REST endpoint for user search., Task 1.6 - JWT Utility and Security Configuration., Task 1.7 - API Rate Limiting.

## Task Completion Guidelines
- Use `- [x]` to mark completed subtasks (to be added by Developer)
- Use `- [ ]` for pending subtasks (to be added by Developer)
- Update "Currently Working On" when starting a new subtask (to be managed by Developer)
- Update "Completed Tasks" when finishing a task (to be managed by Developer)
- Always maintain the hierarchical structure (Task → Subtask → Subtask items)
- **IMPORTANT: Do NOT add subtasks here. Only create main tasks. Subtasks will be added by the Developer agent.
