CarHov is a modern carpooling application designed to bridge the gap between drivers and passengers, making commuting more efficient, cost-effective, and environmentally friendly. The platform allows users to create and join rides effortlessly by leveraging real-time geolocation, secure payment integration, and smart matching algorithms.
Whether you're a driver with empty seats or a passenger looking for a convenient ride, CarHov streamlines the process with an intuitive interface and powerful backend services built on Spring Boot. Users can easily search for rides based on their origin, destination, and timing preferences, making daily commuting or intercity travel a seamless experience.
This repository is strictly for CarHov backend api and services. The front-end can be found here... [link to be updated]
-
Install Java Development Kit (JDK):
- Ensure Java 21 is installed.
- Verify by running:
java -version
-
Install a Build Tool:
- Use either Maven or Gradle, depending on your project setup.
- Verify installation with:
mvn -v # For Maven gradle -v # For Gradle
-
Set Up Your IDE:
- Use IntelliJ IDEA or another Java IDE.
- Install necessary plugins for Spring Boot (e.g., Spring Assistant).
-
Database Setup (if required):
- Ensure your database (e.g., MySQL, PostgreSQL) is installed and running.
- Create a database for the application and note its connection details.
-
Download or Clone the Project:
- If it's hosted on GitHub or another repository, clone it:
git clone <repository-url> cd <project-folder>
- If it's hosted on GitHub or another repository, clone it:
-
Open the Project in IntelliJ:
- Select "Open or Import" and choose the project folder.
- Wait for IntelliJ to index files and download dependencies (if using Maven/Gradle).
application.properties
- Navigate to
src/main/resources/application.properties
orapplication.yml
. - Add or verify the following configurations:
# Server settings server.port=8080 # Database settings spring.datasource.url=jdbc:mysql://localhost:3306/<your-database> spring.datasource.username=<your-username> spring.datasource.password=<your-password> # Hibernate settings spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true
Using Maven:
Open a terminal in the project folder and run:
mvn clean install
Fix any build errors before proceeding.
Using IntelliJ:
Locate the main class CarhovApplication.java
.
Right-click and select Run.
Using Command Line:
Navigate to the project folder and run:
Maven:
mvn spring-boot:run
Open a browser or API testing tool (e.g., Postman). Access the version URL: http://localhost:8080/api/version
Response should look like:
{
"application": "carhov",
"version": "0.0.1-SNAPSHOT"
}
For further reference, please consider the following sections:
- Official Apache Maven documentation
- Spring Boot Maven Plugin Reference Guide
- Create an OCI image
- Spring Boot Testcontainers support
- Testcontainers Postgres Module Reference Guide
- Spring Data JPA
- JTE
- OAuth2 Client
- Spring Security
- Testcontainers
- Spring Web
The following guides illustrate how to use some features concretely:
- Accessing Data with JPA
- Securing a Web Application
- Spring Boot and OAuth2
- Authenticating a User with LDAP
- Building a RESTful Web Service
- Serving Web Content with Spring MVC
- Building REST services with Spring
This project has been configured to use JTE precompiled templates.
However, to ease development, those are not enabled out of the box. For production deployments, you should remove
gg.jte.development-mode=true
from the application.properties
file and set
gg.jte.use-precompiled-templates=true
instead. For more details, please take a look at the official documentation.
This project uses Testcontainers at development time.
Testcontainers has been configured to use the following Docker images:
Please review the tags of the used images and set them to the same as you're running in production.
Due to Maven's design, elements are inherited from the parent POM to the project POM.
While most of the inheritance is fine, it also inherits unwanted elements like <license>
and <developers>
from the
parent.
To prevent this, the project POM contains empty overrides for these elements.
If you manually switch to a different parent and actually want the inheritance, you need to remove those overrides.