diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..43a564b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,38 @@
+# Maven
+target/
+pom.xml.tag
+pom.xml.releaseBackup
+pom.xml.versionsBackup
+pom.xml.next
+release.properties
+dependency-reduced-pom.xml
+buildNumber.properties
+.mvn/timing.properties
+.mvn/wrapper/maven-wrapper.jar
+
+# IDEs
+.idea/
+*.iws
+*.iml
+*.ipr
+.vscode/
+.classpath
+.project
+.settings/
+
+# OS
+.DS_Store
+.DS_Store?
+._*
+.Spotlight-V100
+.Trashes
+ehthumbs.db
+Thumbs.db
+
+# Logs
+*.log
+
+# Other
+.env
+.env.local
+.env.*.local
\ No newline at end of file
diff --git a/README.md b/README.md
index a6bbd59..5c1d531 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,104 @@
-# coding-agent-output-comparison
\ No newline at end of file
+# User Management REST API
+
+REST API for user management with JWT authentication based on the provided specifications.
+
+## Features
+
+- **Endpoint:** `GET /api/users/{id}`
+- **Authentication:** JWT token required
+- **Authorization:** Admin role only
+- **Response:** JSON with user data (id, name, email, role)
+- **Error Handling:** Proper HTTP status codes (200, 401, 403, 404)
+
+## Technical Stack
+
+- **Framework:** Spring Boot 3.1.5
+- **Java Version:** 17
+- **Security:** JWT tokens with HMAC-SHA384 signing
+- **Database:** H2 in-memory
+- **ORM:** JPA/Hibernate
+
+## Quick Start
+
+### 1. Build and Run
+
+```bash
+# Build and run the application
+mvn spring-boot:run
+```
+
+The API will start on `http://localhost:8080`
+
+### 2. Generate JWT Tokens
+
+```bash
+# Generate test tokens
+mvn spring-boot:run -Dspring-boot.run.profiles=token-gen
+```
+
+This will output admin and user tokens for testing.
+
+### 3. Test API Endpoints
+
+```bash
+# Test with admin token (replace {admin-token} with actual token)
+curl -H "Authorization: Bearer {admin-token}" http://localhost:8080/api/users/1
+
+# Test without token (should return 403)
+curl http://localhost:8080/api/users/1
+
+# Test with non-existent user (should return 404)
+curl -H "Authorization: Bearer {admin-token}" http://localhost:8080/api/users/999
+```
+
+## API Documentation
+
+### GET /api/users/{id}
+
+Retrieve user by ID (Admin only).
+
+**Parameters:**
+- `id` (path) - User ID (Long, required)
+
+**Headers:**
+- `Authorization: Bearer {jwt-token}` (required)
+
+**Responses:**
+
+- **200 OK** - User found and returned
+```json
+{
+ "id": 1,
+ "name": "Admin User",
+ "email": "admin@example.com",
+ "role": "ADMIN"
+}
+```
+
+- **401 Unauthorized** - Missing or invalid JWT token
+- **403 Forbidden** - Insufficient permissions (non-admin user)
+- **404 Not Found** - User not found
+```json
+{
+ "error": "Not Found",
+ "message": "User not found with id: 999",
+ "timestamp": "2025-09-02T07:00:00.000",
+ "status": 404
+}
+```
+
+## Test Data
+
+The application automatically loads test data:
+
+1. **ID: 1** - Admin User (admin@example.com, ADMIN)
+2. **ID: 2** - Regular User (user@example.com, USER)
+3. **ID: 3** - Test User (test@example.com, USER)
+
+## Database Console
+
+For development, H2 console is available at: `http://localhost:8080/h2-console`
+
+- **JDBC URL:** `jdbc:h2:mem:testdb`
+- **Username:** `sa`
+- **Password:** (empty)
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..ba8696b
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,93 @@
+
+
+ 4.0.0
+
+
+ org.springframework.boot
+ spring-boot-starter-parent
+ 3.1.5
+
+
+
+ com.example
+ user-api
+ 1.0.0
+ jar
+
+ User API
+ REST API for user management with JWT authentication
+
+
+ 17
+ 0.11.5
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
+
+
+
+ io.jsonwebtoken
+ jjwt-api
+ ${jwt.version}
+
+
+ io.jsonwebtoken
+ jjwt-impl
+ ${jwt.version}
+ runtime
+
+
+ io.jsonwebtoken
+ jjwt-jackson
+ ${jwt.version}
+ runtime
+
+
+
+
+ com.h2database
+ h2
+ runtime
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.security
+ spring-security-test
+ test
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/example/userapi/UserApiApplication.java b/src/main/java/com/example/userapi/UserApiApplication.java
new file mode 100644
index 0000000..d11cecc
--- /dev/null
+++ b/src/main/java/com/example/userapi/UserApiApplication.java
@@ -0,0 +1,11 @@
+package com.example.userapi;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class UserApiApplication {
+ public static void main(String[] args) {
+ SpringApplication.run(UserApiApplication.class, args);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/userapi/config/DataLoader.java b/src/main/java/com/example/userapi/config/DataLoader.java
new file mode 100644
index 0000000..e7ce084
--- /dev/null
+++ b/src/main/java/com/example/userapi/config/DataLoader.java
@@ -0,0 +1,26 @@
+package com.example.userapi.config;
+
+import com.example.userapi.entity.User;
+import com.example.userapi.repository.UserRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.CommandLineRunner;
+import org.springframework.context.annotation.Profile;
+import org.springframework.stereotype.Component;
+
+@Component
+@Profile("!test")
+public class DataLoader implements CommandLineRunner {
+
+ @Autowired
+ private UserRepository userRepository;
+
+ @Override
+ public void run(String... args) throws Exception {
+ // Only load data if the repository is empty
+ if (userRepository.count() == 0) {
+ userRepository.save(new User("Admin User", "admin@example.com", "ADMIN"));
+ userRepository.save(new User("Regular User", "user@example.com", "USER"));
+ userRepository.save(new User("Test User", "test@example.com", "USER"));
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/userapi/controller/UserController.java b/src/main/java/com/example/userapi/controller/UserController.java
new file mode 100644
index 0000000..6671ec6
--- /dev/null
+++ b/src/main/java/com/example/userapi/controller/UserController.java
@@ -0,0 +1,34 @@
+package com.example.userapi.controller;
+
+import com.example.userapi.dto.UserResponse;
+import com.example.userapi.entity.User;
+import com.example.userapi.exception.UserNotFoundException;
+import com.example.userapi.repository.UserRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+@RestController
+@RequestMapping("/api/users")
+public class UserController {
+
+ @Autowired
+ private UserRepository userRepository;
+
+ @GetMapping("/{id}")
+ @PreAuthorize("hasRole('ADMIN')")
+ public ResponseEntity getUserById(@PathVariable Long id) {
+ User user = userRepository.findById(id)
+ .orElseThrow(() -> new UserNotFoundException(id));
+
+ UserResponse response = new UserResponse(
+ user.getId(),
+ user.getName(),
+ user.getEmail(),
+ user.getRole()
+ );
+
+ return ResponseEntity.ok(response);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/userapi/dto/UserResponse.java b/src/main/java/com/example/userapi/dto/UserResponse.java
new file mode 100644
index 0000000..b0dc4b5
--- /dev/null
+++ b/src/main/java/com/example/userapi/dto/UserResponse.java
@@ -0,0 +1,51 @@
+package com.example.userapi.dto;
+
+public class UserResponse {
+ private Long id;
+ private String name;
+ private String email;
+ private String role;
+
+ // Constructors
+ public UserResponse() {}
+
+ public UserResponse(Long id, String name, String email, String role) {
+ this.id = id;
+ this.name = name;
+ this.email = email;
+ this.role = role;
+ }
+
+ // Getters and Setters
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/userapi/entity/User.java b/src/main/java/com/example/userapi/entity/User.java
new file mode 100644
index 0000000..008a576
--- /dev/null
+++ b/src/main/java/com/example/userapi/entity/User.java
@@ -0,0 +1,69 @@
+package com.example.userapi.entity;
+
+import jakarta.persistence.*;
+import jakarta.validation.constraints.Email;
+import jakarta.validation.constraints.NotBlank;
+import jakarta.validation.constraints.NotNull;
+
+@Entity
+@Table(name = "users")
+public class User {
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Long id;
+
+ @NotBlank
+ @Column(nullable = false)
+ private String name;
+
+ @Email
+ @NotBlank
+ @Column(nullable = false, unique = true)
+ private String email;
+
+ @NotBlank
+ @Column(nullable = false)
+ private String role;
+
+ // Constructors
+ public User() {}
+
+ public User(String name, String email, String role) {
+ this.name = name;
+ this.email = email;
+ this.role = role;
+ }
+
+ // Getters and Setters
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getEmail() {
+ return email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ public String getRole() {
+ return role;
+ }
+
+ public void setRole(String role) {
+ this.role = role;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/example/userapi/exception/GlobalExceptionHandler.java b/src/main/java/com/example/userapi/exception/GlobalExceptionHandler.java
new file mode 100644
index 0000000..10d42cc
--- /dev/null
+++ b/src/main/java/com/example/userapi/exception/GlobalExceptionHandler.java
@@ -0,0 +1,49 @@
+package com.example.userapi.exception;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.security.authentication.BadCredentialsException;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+
+import java.time.LocalDateTime;
+import java.util.HashMap;
+import java.util.Map;
+
+@RestControllerAdvice
+public class GlobalExceptionHandler {
+
+ @ExceptionHandler(UserNotFoundException.class)
+ public ResponseEntity