Developer
Overview
This page provides a comprehensive guide on setting up, contributing to, and testing the codebase for the Plant-it project. Whether you're working on the backend or the frontend, you'll find all the necessary steps and tools to get started here.
Requirements
Before you can run and test the project, ensure you have the following tools installed:
Backend
-
OpenJDK: Version 21 or higher is required to compile and run the backend.
-
Maven: A build automation tool for managing project dependencies and building the backend.
Frontend
- Flutter: Ensure you have Flutter installed to build and run the frontend. You can follow the official installation guide for your operating system.
CLI
Backend
To compile and run the backend:
-
Navigate to the
backend
folder:
cd backend
-
Compile the backend by running:
mvn clean install
-
Start the backend server with the development profile:
mvn spring-boot:run -Dspring-boot.run.profiles=dev
-
Open your browser and navigate to http://localhost:8085/api/swagger-ui/index.html. Here, you can view the API's Swagger documentation and test the endpoints.
Frontend
To run the frontend:
-
Navigate to the frontend folder:
cd frontend
-
Start the frontend on a web server by running:
flutter run -d web-server --web-port=56134
-
Open your browser and navigate to http://localhost:56134. This will display the Plant-it application.
IDE
Backend
For backend development, we recommend using IntelliJ IDEA:
-
Download and install IntelliJ IDEA (Community or Ultimate edition).
-
Open the IDE.
-
Navigate to File > Open and select the backend folder.
-
Wait for IntelliJ to index the project and download dependencies.
-
Use the built-in Run/Debug Configuration for managing and running your Spring Boot application.
Frontend
For frontend development, we recommend using Visual Studio Code:
-
Download and install Visual Studio Code.
-
Download and install Chrome Browser (required for web development)
-
Open the IDE.
-
Navigate to File > Open Folder and select the frontend folder.
-
Install the Flutter and Dart extensions from the Extensions Marketplace for enhanced development support.
-
In the bottom-right corner of the IDE, select
Chrome (web-javascript)
as the device. -
Open the
lib/main.dart
file and click on Run.
Workflow
Backend
In order to test changes for the backend:
-
Made the changes
-
Compile and test the project by running:
mvn clean install
-
If the compilation and tests pass, start the project:
mvn spring-boot:run -Dspring-boot.run.profiles=dev
-
Connect the frontend or navigate to http://localhost:8085/api/swagger-ui/index.html to test the API.
Frontend
In order to test changes for the frontend:
-
Make your changes in the codebase.
-
Test the project by running:
flutter test
-
If the tests are ok, then run the project
flutter run -d web-server --web-port=56134
-
Connect to the frontend at http://localhost:56134 to verify the changes.
Docker
Testing the system as a whole is crucial to ensure that changes do not introduce unexpected issues. To achieve this, you can build and test the Docker image of the project.
Steps
-
Build the Docker Image
From the root of the project, execute the following command to build the Docker image:
deployment/create-images.sh --versions latest
-
Run the Docker Image After building the image, follow the steps in the Quickstart Guide to run the Docker image and test the system.
By running the project in a Dockerized environment, you can verify that all components integrate seamlessly and perform as expected in a production-like setup.
Additional Resources
-
Flutter Documentation: Learn about Flutter development and troubleshooting.
-
Spring Boot Documentation: Reference material for Spring Boot.
-
Maven Documentation: Guides for working with Maven.