Keep.id Server Application. Built with Java and Kotlin, this application serves to empower organizations fighting homelessness with tools to help with document storage and other aid.
https://docs.google.com/document/d/1gmrSSzV4gzMEUXjU6bq57TjtAl6zrw1i61FxxzykK94/edit?usp=sharing
This is the easiest way to get started. It works on any device (Mac, Windows, Linux) and does NOT require you to install Java, Maven, or MongoDB on your machine.
Prerequisites:
How to run:
-
Ask a team member for an
.envfile to copy into the root directory (same level as this README). This file contains things like db connections and encryption keys so don't share them. -
Run the application:
docker-compose up --build
This will start both the Java Server and the MongoDB database. You have to rerun with --build everytime you make a change.
-
The server is ready when you see "Javalin has started" in the logs.
Access the server at
http://localhost:7001. The app exposes port5005for remote debugging. -
mvn test won't work out of the box since it relies on loading in .env variables into the terminal. IntelliJ handled that with the EnvFile plugin. If you have Node, you can use
npx env-cmd -f .env -- mvn verifyornpx env-cmd -f .env -- mvn test -Dtest={test class}
How to get the backend service running locally (without Docker):
- make sure you have Java in the JAVA_HOME environment variable
- make sure you have maven (run "mvn --version" in terminal to check)
- make sure you have Java 21 JDK/JRE installed. If you wish to have multiple Java versions, look into Java Jabba, which is a Java Version Manager.
- make sure you install IntelliJ, and install these extensions under File -> Settings -> Plugins:
- google-java-format (this will help enforce Java code style)
- Save Actions (this will automatically enforce Java code style on save)
- make sure that in IntelliJ, maven auto-import is turned on (there will be a pop up usually, or just search up online on how to enable this). You may have to restart IntelliJ multiple times for it to show up
- under File -> Settings -> Other Settings -> Save Actions, check the first two boxes under General and the first two boxes under Formatting Actions. This will enforce the code style on save
- under File -> Project Structure -> Modules, set Project SDK and Project Language Level to 21. Additionally, YOU MUST SET YOUR SOURCES, TESTS, TEST RESOURCES, AND EXCLUDED FOLDERS. This step is VERY IMPORTANT, or else nothing will run. Set Source Folders as src/main, Test Source Folders as src/test, Test Resource Folders as src/test/resources, and Excluded Folders as target. Make sure Language level is set to 21. Under the Dependencies tab, make sure the Project SDK is set to 21.
- you can run tests or run App
- check logs in logs/app.log
- ALSO if you are having a Null Pointer CustomException in the Mongo Config, please follow the instructions here: https://github.com/Ashald/EnvFile. We are deprecating the use of dotenv because it is interfering with our heroku deployment (also the heroku deployment doesn't see the env file anyway). Therefore, please edit the run configurations in IntelliJ at this link here: https://github.com/Ashald/EnvFile.