Skip to content

Instantly share code, notes, and snippets.

@akhr
Last active September 3, 2025 05:01
Show Gist options
  • Select an option

  • Save akhr/86d0702cc2436b9adca6b32cfac08b60 to your computer and use it in GitHub Desktop.

Select an option

Save akhr/86d0702cc2436b9adca6b32cfac08b60 to your computer and use it in GitHub Desktop.

ChatGPT Prompt for detailed PREP plan

Create a detailed 3-week preparation plan for a Java backend developer with 3 years of experience in Spring Boot, databases (SQL/NoSQL), Jenkins, JSON, Kafka, and Git. The person had a 2-month career gap and wants to regain confidence, practice hands-on coding, and prepare for technical interviews to secure a backend developer job. The plan should:

Be broken down week-by-week and day-by-day.

Cover technical refreshers (Java, Spring Boot, REST APIs, databases, Kafka, Git, CI/CD).

Include coding practice (DSA/LeetCode-style) and small project tasks.

Add interview prep (mock interviews, behavioral questions, system design discussions).

Suggest confidence-building activities and ways to track progress.

Be realistic and achievable in ~2–3 hours daily (since she may not have full-time availability).
Output should be structured and actionable so she can follow it step by step."*

πŸ“ Assignment: Build a User Management API with Spring Boot

Objective

Create a Spring Boot REST service that proxies selected endpoints from ReqRes API and exposes them under your own /api namespace. Implement GET users, GET user by ID, and Update user functionality with proper validation, error handling, and documentation.

Here Request and Response structures: https://reqres.in/api-docs/#/


Requirements

1. Endpoints (your service should provide)

  • GET /api/users

    • Fetch users from ReqRes (GET https://reqres.in/api/users).
  • GET /api/users/{id}

    • Fetch a single user (GET https://reqres.in/api/users/{id}).
    • Return 404 if user not found.
  • PUT /api/users/{id}

    • Update user data (PUT https://reqres.in/api/users/{id}) with JSON body:

      {
        "name": "Jane Doe",
        "job": "Developer"
      }
    • Forward request to ReqRes and return response.

    • Validate request body (name & job not blank).


2. Functional Requirements

  • Input validation:

    • page >= 1, id > 0.
    • Request body must contain name and job.
  • Error handling:

    • If ReqRes returns 404 β†’ return 404 { "error": "User not found" }.
    • If validation fails β†’ return 400 { "error": "Invalid input" }.
  • Logging:

    • Log request method, URL, and response time for outgoing ReqRes calls.

3. Non-Functional

  • Use WebClient (preferred) or RestTemplate for outbound calls.
  • Timeout 3s for ReqRes calls.
  • Return JSON with appropriate status codes.
  • Document endpoints with Swagger/OpenAPI.
  • Write at least 3–4 unit tests (happy path, validation fail, ReqRes 404).

4. Bonus (Optional Enhancements)

  • Add pagination support with validation in GET /api/users?page={page}.
  • Cache results of GET /api/users?page=1 for 30 seconds.
  • Add integration test hitting real ReqRes API.
  • Dockerize the application.

5. Acceptance Criteria (Definition of Done)

  • βœ… GET /api/users?page=2 returns list of users from ReqRes.
  • βœ… GET /api/users/2 returns correct user JSON.
  • βœ… PUT /api/users/2 accepts valid JSON body and forwards update to ReqRes.
  • βœ… Error cases (bad page/id, not found, missing body fields) return appropriate error JSON.
  • βœ… Swagger available at /swagger-ui.html.
  • βœ… Unit tests pass.
  • βœ… README with run instructions + sample curl commands.

Example Usage

# List users (page=2)
curl -s http://localhost:8080/api/users?page=2 | jq

# Get single user
curl -s http://localhost:8080/api/users/2 | jq

# Update user
curl -X PUT http://localhost:8080/api/users/2 \
  -H "Content-Type: application/json" \
  -d '{"name": "Jane Doe", "job": "Developer"}' | jq

πŸ‘‰ This way she gets to practice GET, path variables, query params, PUT with request body, validation, error handling, logging, and Swagger β€” a mini but realistic backend task.


Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment