diff --git a/.gitignore b/.gitignore
index 54c8b94cd..fc8e78c98 100644
--- a/.gitignore
+++ b/.gitignore
@@ -69,7 +69,10 @@ yarn.lock*
react-app-env.d.ts
-#docs
+# docs
docs/site/.hugo_build.lock
docs/site/public/
docs/site/resources/
+
+# code format
+.cache
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 466322515..4c3ce6824 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -49,3 +49,40 @@ git remote add upstream https://github.com/Hyperfoil/Horreum.git
```
git checkout -b myfeature master
```
+
+### Code Style
+
+Horreum has a strictly enforced code style. Code formatting is done by the Eclipse code formatter, using the config files found in the `config/` directory. By default, when you run `mvn install`, the code will
+be formatted automatically. When submitting a pull request the CI build will fail if running the formatter results in any code changes, so it is recommended that you always run a full Maven build before submitting a pull request.
+
+If you want to run the formatting without doing a full build, you can run `mvn process-sources`.
+
+#### Eclipse Formatting Setup
+
+Open the *Preferences* window, and then navigate to _Java_ -> _Code Style_ -> _Formatter_. Click _Import_ and then
+select the `eclipse-formatting.xml` file in the `config/` directory.
+
+Next navigate to _Java_ -> _Code Style_ -> _Organize Imports_. Click _Import_ and select the `eclipse.importorder` file.
+
+#### IDEA Formatting Setup
+
+Open the _Preferences_ window (or _Settings_ depending on your edition), navigate to _Plugins_ and install
+the [Adapter for Eclipse Code Formatter](https://plugins.jetbrains.com/plugin/6546-eclipse-code-formatter) from the
+Marketplace.
+
+Restart your IDE, open the *Preferences* (or *Settings*) window again and navigate to _Adapter for Eclipse Code
+Formatter_ section on the left pane.
+
+Select _Use Eclipse's Code Formatter_, then change the _Eclipse workspace/project folder or config file_ to point to the
+`eclipse-formatting.xml` file in the `config/` directory. Make sure the _Optimize Imports_ box is
+ticked. Then, select _Import Order from file_ and make it point to the `eclipse.importorder` file in the `config/`
+directory.
+
+Next, disable wildcard imports:
+navigate to _Editor_ -> _Code Style_ -> _Java_ -> _Imports_
+and set _Class count to use import with '\*'_ to `999`. Do the same with _Names count to use static import with '\*'_.
+
+#### Git Formatting Setup
+
+If you want to be sure that the _formatting_ is properly executed before committing, you can make use of the git hooks, in particular the `pre-commit` one.
+Simply override the `.git/hooks/pre-commit` script with a custom logic that runs `mvn formatter:format impsort:sort` to format the source code and the remember to `git add` all changed files such that they are included in the ongoing commit.
\ No newline at end of file
diff --git a/config/eclipse-formatting.xml b/config/eclipse-formatting.xml
new file mode 100644
index 000000000..457ec1e28
--- /dev/null
+++ b/config/eclipse-formatting.xml
@@ -0,0 +1,322 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/config/eclipse.importorder b/config/eclipse.importorder
new file mode 100644
index 000000000..616f030f2
--- /dev/null
+++ b/config/eclipse.importorder
@@ -0,0 +1,6 @@
+#Organize Import Order
+0=java
+1=javax
+2=jakarta
+3=org
+4=com
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index bdcf35247..9c1b6be3d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -65,6 +65,7 @@
17
17
+ 17
true
1.7.0
@@ -98,6 +99,10 @@
${project.version}
0.15
+
+ false
+ 2.24.1
+ 1.10.0
@@ -330,6 +335,48 @@
+
+ net.revelc.code.formatter
+ formatter-maven-plugin
+ ${formatter-maven-plugin.version}
+
+ ${format.skip}
+
+ ${session.executionRootDirectory}/config/eclipse-formatting.xml
+
+ .cache/formatter-maven-plugin-${formatter-maven-plugin.version}
+ LF
+
+
+
+ apply-formatter
+
+ format
+
+
+
+
+
+ net.revelc.code
+ impsort-maven-plugin
+ ${impsort-maven-plugin.version}
+
+ ${format.skip}
+
+ .cache/impsort-maven-plugin-${impsort-maven-plugin.version}
+ java.,javax.,jakarta.,org.,com.
+ *
+ true
+
+
+
+ sort-imports
+
+ sort
+
+
+
+