This project provides a RESTful API for managing users and user groups, built using Spring Boot.
- Manage users and groups
- Associate users with groups
- H2 in-memory database for persistence
-
Clone the repository:
git clone https://github.com/esa-kian/user-manager cd user-manager
-
Ensure you have JDK 17+ and Maven installed.
-
Build and run the application using Maven:
mvn spring-boot:run
-
Access the API at
http://localhost:8080
GET /api/users
: Fetch all usersGET /api/users/{id}
: Get user by IDPOST /api/users
: Create new userDELETE /api/users/{id}
: Delete user
POST /api/groups
: Create new groupPOST /api/groups/{groupId}/users/{userId}
: Add user to groupDELETE /api/groups/{groupId}/users/{userId}
: Remove user from group
Swagger API documentation is available at http://localhost:8080/swagger-ui.html
- Build the Docker Image:
docker build -t user-management-rest .
# for ARM architecture (like M1/M2 Macs):
docker build --platform linux/amd64 -t user-management-rest .
- Run the Container:
docker run -p 8000:8080 user-management-rest
- Stop the Container:
docker stop user-management-rest
To run unit tests for the application, run:
mvn test
This project is open-source and available under the MIT License.