CodeNinjaResearch / NotesServerApp

Notes server-side app (clean architecture)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status

The project

Server-side

This is a server-side JVM application for simple notes keeping (you can add and list notes via REST and gRPC) implemented in clean architecture in Kotlin.

Client-side

Check out according client-side app(s). domain and app-api are Kotlin Multiplatform modules. Install them to local Maven repository for the JVM clients:

./gradlew publishToMavenLocal

Generate CocoaPod specs for iOS clients (iOS simulator target only - iosX64):

./gradlew podspec

Note: while Kotlin/Multiplatform is still experimental -Xuse-experimental=kotlin.ExperimentalMultiplatform compiler option is used.

The motivation

Here is a quick recap of the benefits that clean architecture brings:

  • Independent of Frameworks
  • Testable
  • Independent of UI
  • Independent of Database
  • Independent of any external agency

You can find few more README.md files in subdirectories.

Clean architecture implementation

Find the classes in clean architecture diagram:

Clean architecture diagram

Sequence diagram

Building

Run using Spring:

./gradlew :app-spring:bootJar

or Quarkus:

./gradlew publishToMavenLocal
./mvnw clean compile quarkus:dev -f app-quarkus/pom.xml

Current Gradle support is not mature enough, so using Maven instead.

Testing

Unit/integration testing

One can find few unit tests that demonstrate some benefits of clean architecture for testing.

./gradlew test
./gradlew publishToMavenLocal
./mvnw test -f app-quarkus/pom.xml

Integration testing of app-spring-vaadin is a bit tricky (one have to use commercial testing framework from Vaadin team Testbench or make Selenide working with TestContainers instead).

Manual testing

First, run the app from IDE or command line:

./gradlew :app-spring:bootRun

Application running

URLs

Add a note by navigating to URL as follows http://localhost:8080/api/add?title=title1&body=body1:

Add a note

List the notes by navigating to URL http://localhost:8080/api/list

List the notes

Simple UI (Spring MVC + Thymeleaf)

Add a note at web page with URL http://localhost:8080/app/add:

Add a note

Make sure you can see added note (forwarded after adding) http://localhost:8080/app/list

List the notes

Simple UI (Vaadin)

Make sure you've installed the modules into local Maven repo:

./gradlew publishToMavenLocal

Run the app from command line:

./mvnw spring-boot:run -f app-spring-vaadin/pom.xml

Add a note at web page with URL http://localhost:8080/app/add:

Add a note

Make sure you can see added note (forwarded after adding) http://localhost:8080/app/list

List the notes

Frameworks and tools

Feedback

Any feedback and discussion is appreciated. Contact me on e-mail for this or fork the repository and pull a request.

Author

Anton Smirnov

dev [at] antonsmirnov [dot] name

2019

About

Notes server-side app (clean architecture)


Languages

Language:Kotlin 97.7%Language:HTML 2.3%