https://github.com/green-ecolution/backend
Green Ecolution - Backend
https://github.com/green-ecolution/backend
backend go golang green-ecolution smart-city
Last synced: 5 months ago
JSON representation
Green Ecolution - Backend
- Host: GitHub
- URL: https://github.com/green-ecolution/backend
- Owner: green-ecolution
- License: agpl-3.0
- Created: 2024-07-06T12:45:37.000Z (almost 2 years ago)
- Default Branch: develop
- Last Pushed: 2025-10-20T03:03:07.000Z (8 months ago)
- Last Synced: 2025-10-20T07:11:41.108Z (8 months ago)
- Topics: backend, go, golang, green-ecolution, smart-city
- Language: Go
- Homepage: https://green-ecolution.de
- Size: 22.5 MB
- Stars: 7
- Watchers: 0
- Forks: 2
- Open Issues: 29
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Citation: CITATION.cff
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Green Ecolution Backend πΏ
> [!IMPORTANT]
> **This repository has been archived.**
> Active development of the Green Ecolution backend now takes place in the **[green-ecolution/green-ecolution](https://github.com/green-ecolution/green-ecolution)** monorepo.
> No further updates, issues, or pull requests will be processed here.
Smart irrigation is essential to saving water, reducing staff workload, and cutting costs. This project provides the backend for **Green Ecolution** β a digital system to manage urban greenery efficiently.
π For the frontend implementation, visit the [Green Ecolution Frontend](https://github.com/green-ecolution/frontend).
The backend acts as the interface between the website and the database, managing data about:
- π³ Trees
- πΏ Tree clusters
- π‘ Sensors
- πΊοΈΒ Watering plans
- π Vehicles
- π€ Users
In the current setup, sensors are connected to a microcontroller with an LoRaWAN modules. Sensor data is transmitted via LoRaWAN to an MQTT gateway, then forwarded to the server for processing.
Developed in collaboration with **TBZ Flensburg**, this software is designed to be adaptable for other cities. It originated as a research project within the **Applied Computer Science Master's program** at the **University of Applied Sciences Flensburg**.
For further information, visit:
- π [Project website](https://green-ecolution.de/)
- π₯οΈ [Live demo](https://demo.green-ecolution.de)
- π [University of Applied Sciences Flensburg](https://hs-flensburg.de/en)
## Quick Start Guide π
To quickly run the application locally:
1. Clone this repository
2. Copy the `env.example` to `.env`
3. Build and launch the application containers
```bash
make run/docker
```
make will download a `pbf` file of the open street map geographical tileset from Germany Schleswig-Holstein and place it in a directory where `vahalla` can access it via docker. If you don't want to download this part or want to load a different location into valhalla, you can download it yourself and place the file in `.docker/infra/valhalla/custom_files/`. After that you can start the docker services with the backend using this command:
```bash
docker compose -f compose.yaml -f compose.app.yaml up -d --build
```
By default, all services such as auth, routing and s3 are enabled and running with docker, except mqtt. This service is currently disabled by default and must be configured manually.
π Once the service is up and running, the backend is available at: [http://localhost:3000](http://localhost:3000)
The other services can be accessed via the following URLs:
| Service | URL |
| ------------- | -------------------------------- |
| Minio | `http://minio.localhost:3000` |
| S3 | `http://s3.localhost:3000` |
| Keycloak | `http://auth.localhost:3000` |
| Valhalla | `http://valhalla.localhost:3000` |
| Vroom | `http://vroom.localhost:3000` |
| pgadmin | `http://pgadmin.localhost:3000` |
| reverse-proxy | `http://traefik.localhost:3000` |
| backend | `http://localhost:3000` |
## Technologies Used βοΈ
- [Go (Golang)](https://go.dev/) as the main language
- [env](https://github.com/caarlos0/env) for environment configuration
- [godotenv](https://github.com/joho/godotenv) for `.env` file handling
- [Fiber](https://docs.gofiber.io/) as the web framework
- [Testify](https://github.com/stretchr/testify) for unit testing
## Local Development Setup π»
For a detailed step-by-step guide on setting up your local development environment, refer to the [Local Development Wiki](https://github.com/green-ecolution/backend/wiki/Local-Development) π.
### Prerequisites
- [Golang](https://go.dev/)
- [Air](https://github.com/air-verse/air) for live reload
- [Mockery](https://github.com/vektra/mockery) `v2.52.2` for generating mocks
- [Make](https://www.gnu.org/software/make/)
- [Docker](https://github.com/docker)
- [Docker Compose](https://github.com/docker/compose)
### Initial Setup βοΈ
Install required tools:
```bash
make setup
```
Generate code:
```bash
make generate
```
Start the infrastructure services using Docker Compose. This setup includes:
- a local PostgreSQL database,
- routing services such as Valhalla, ORS and VROOM for route and vehicle scheduling calculations
```bash
make infra/up
```
### Running the Project βΆοΈ
With live reload:
```bash
make run/live
```
Without live reload:
```bash
make run
```
π Once the service is up and running, you can access it at: [http://localhost:3000](http://localhost:3000)
### How to Contribute π€
We welcome contributions! Please follow these guidelines:
1. Fork this repository.
1. Create a topic branch off develop.
1. Commit your changes.
1. Push your branch to your fork.
1. Open a Pull Request.
This project follows:
- [Git-Flow Workflow](https://danielkummer.github.io/git-flow-cheatsheet/) for branching and releases.
- [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) for commit messages.
Thank you for helping us improve Green Ecolution! πΏ