Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sdeleuze/geospatial-messenger
Geospatial messenger application written with Spring Boot + Kotlin + PostgreSQL
https://github.com/sdeleuze/geospatial-messenger
Last synced: about 2 months ago
JSON representation
Geospatial messenger application written with Spring Boot + Kotlin + PostgreSQL
- Host: GitHub
- URL: https://github.com/sdeleuze/geospatial-messenger
- Owner: sdeleuze
- Created: 2016-03-13T14:41:50.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-11T19:52:00.000Z (almost 7 years ago)
- Last Synced: 2024-10-11T16:11:25.053Z (2 months ago)
- Language: Kotlin
- Homepage: https://spring.io/blog/2016/03/20/a-geospatial-messenger-with-kotlin-spring-boot-and-postgresql
- Size: 1.51 MB
- Stars: 218
- Watchers: 17
- Forks: 43
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-starred - sdeleuze/geospatial-messenger - Geospatial messenger application written with Spring Boot + Kotlin + PostgreSQL (others)
README
This is a sample application that demonstrates how to build a Kotlin + Spring Boot applications with a PostgreSQL database.
The code is very concise, and the generated application is a 18 MBytes self-contained executable jar with low memory consumption.A detailed blog post describing this application is available [here](https://spring.io/blog/2016/03/20/a-geospatial-messenger-with-kotlin-spring-boot-and-postgresql).
It is used as a playground to demonstrate various features:
- Gradle [build.gradle.kts](https://github.com/sdeleuze/geospatial-messenger/blob/master/build.gradle.kts) file written in Kotlin instead of Groovy, see [gradle-script-kotlin](https://github.com/gradle/gradle-script-kotlin/releases) for more details.
- Simple [User](https://github.com/sdeleuze/geospatial-messenger/blob/master/src/main/kotlin/io/spring/messenger/domain/User.kt)
and [Message](https://github.com/sdeleuze/geospatial-messenger/blob/master/src/main/kotlin/io/spring/messenger/domain/Message.kt)
domain model classes thanks to [Kotlin data classes](https://kotlinlang.org/docs/reference/data-classes.html).
- The [Application](https://github.com/sdeleuze/geospatial-messenger/blob/master/src/main/kotlin/io/spring/messenger/Application.kt)
class shows how to configure a Kotlin Spring Boot application.
- Typesafe SQL DSL with [Exposed](https://github.com/JetBrains/Exposed) that allows to define your
[SQL tables](https://github.com/sdeleuze/geospatial-messenger/blob/master/src/main/kotlin/io/spring/messenger/Database.kt#L8-L20)
and describe your [SQL requests](https://github.com/sdeleuze/geospatial-messenger/blob/master/src/main/kotlin/io/spring/messenger/repository/MessageRepository.kt)
with a fluent API without requiring code generation.
- [Controllers](https://github.com/sdeleuze/geospatial-messenger/blob/master/src/main/kotlin/io/spring/messenger/web/MessageController.kt)
demonstrates how to use Spring Framework 4.3 upcoming `@GetMapping` and `@PostMapping` annotation shortcuts, as well as Server-Sent Events
to push data to the client.
- [Kotlin extensions](https://github.com/sdeleuze/geospatial-messenger/blob/master/src/main/kotlin/io/spring/messenger/Database.kt#L23-L42)
allows to add Geospatial support to [Exposed](https://github.com/JetBrains/Exposed) and
[use it](https://github.com/sdeleuze/geospatial-messenger/blob/master/src/main/kotlin/io/spring/messenger/repository/UserRepository.kt#L35-L37)
as if this was supported out of the box.
- The REST API is fully tested and documented thanks to the awesome [Spring REST docs](http://projects.spring.io/spring-restdocs/)
, see [MessageControllerTests](https://github.com/sdeleuze/geospatial-messenger/blob/master/src/test/kotlin/io/spring/messenger/MessageControllerTests.kt)
and [index.adoc](https://github.com/sdeleuze/geospatial-messenger/blob/master/src/main/asciidoc/index.adoc).
- The client side is originally a pure HTML + Javascript application developed with [OpenLayers](http://openlayers.org) mapping library, see [index.html](https://github.com/sdeleuze/geospatial-messenger/blob/master/src/main/resources/static/index.html) and [map.js](https://github.com/sdeleuze/geospatial-messenger/blob/master/src/main/resources/static/map.js). But an experimental (work in progress) Kotlin2js version has ben contributed by @bashor, you can find it [here](https://github.com/sdeleuze/geospatial-messenger/tree/kotlin-js/gm-client/src/main/kotlin).A Spring Data version based on [spring-data-jdbc-repository](https://github.com/jirutka/spring-data-jdbc-repository/) is also available in [this branch](https://github.com/sdeleuze/geospatial-messenger/tree/spring-data-jdbc-repository). There is no Spring Data JPA version yet but feel free to fork this repo and contribute it with a pull request!
## Run the application- Install a PostgreSQL database with PostGis extension, on Mac you can use [Postgresapp](http://postgresapp.com/).
- Clone this repository.
- Customize database configuration on [application.yml](https://github.com/sdeleuze/geospatial-messenger/blob/master/src/main/resources/application.yml).
- Run it within your IDE or with `./gradlew bootRun`.
- Open `http://localhost:8080/` in your browser.
![Screenshot](/screenshot.png?raw=true)
- Documentation should be available at `http://localhost:8080/docs/index.html` when run from the JAR.
## Improvements I have in mind
- [Exposed issue #24](https://github.com/JetBrains/Exposed/issues/24): see if Exposed could support natively data classes + repository patten.
- [Spring HATEOAS issue #401](https://github.com/spring-projects/spring-hateoas/issues/401): add HATEOAS support, but without having to extend
`ResourceSupport` or wrapping it into a `Resource` container .