This project is an API built useing Quarkus, the Supersonic Subatomic Java Framework. If you want to learn more about Quarkus, please visit its website: https://quarkus.io/.
A simple social network for users to send short texts and follow each other. Contains a Users, Posts and Followers API
- Java 17
- Quarkus 3.14.2
- H2 (tests)
- PostgreSQL (production)
- OpenAPI (Swagger)
- API unit testes
- Telemetry with Prometheus and Grafana
- Clone the repository:
git clone https://github.com/jonasfschuh/quarkus-social-network-api.git
Notes:
NOTE: Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/.
The application can be packaged using:
./mvnw package
It produces the quarkus-run.jar
file in the target/quarkus-app/
directory.
Be aware that it’s not an über-jar as the dependencies are copied into the target/quarkus-app/lib/
directory.
The application is now runnable using java -jar target/quarkus-app/quarkus-run.jar
.
If you want to build an über-jar, execute the following command:
./mvnw package -Dquarkus.package.jar.type=uber-jar
The application, packaged as an über-jar, is now runnable using java -jar target/*-runner.jar
.
You can create a native executable using:
./mvnw package -Dnative
Or, if you don't have GraalVM installed, you can run the native executable build in a container using:
./mvnw package -Dnative -Dquarkus.native.container-build=true
You can then execute your native executable with: ./target/quarkus-social-network-api-1.0-runner
-
Start your PostgreSQL database using Docker or Local
-
You can run your application in dev mode that enables live coding using:
./mvnw compile quarkus:dev
The API provides the following endpoints:
GET /users - Retrieve a list of all registered users
POST /users - Create a new user and return the create user´s data
PUT /users - Update the data of an existing user based on its ID
DELETE /users - Delete an existing user based on its ID
GET /users/{userId}/posts - Retrieve a list of all posts from a specific user
POST /users/{userId}/posts - Create a new post for a specific user
GET /users/{userId}/followers - Retrieve a list of all followers from a specific user
PUT /users/{userId}/followers - Add a new follower to a specific user
DELETE /users/{userId}/followers - Delete an existed follower from a specific user
NOTES: More details about the API endpoints can be found in the Swagger UI, which is available at http://localhost:8080/q/swagger-ui/.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request to the repository.
When contributing to this project, please follow the existing code style, commit conventions, and submit your changes in a separate branch.
Metrics