All Projects → grant-burgess → Clean Architecture Example Java Spring Boot

grant-burgess / Clean Architecture Example Java Spring Boot

Licence: apache-2.0
An example of Robert C. Martin's Clean Architecture with Spring Boot

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Clean Architecture Example Java Spring Boot

Clean Architecture Delivery Example
A example of clean architecture in Java 8 and Spring Boot 2.0
Stars: ✭ 140 (+137.29%)
Mutual labels:  spring-boot, clean-architecture
Sample Spring Boot Javafx
Рыба Spring Boot + JavaFX
Stars: ✭ 59 (+0%)
Mutual labels:  spring-boot
Geekshop
极客商城 ~ 一个面向开发者的、基于Spring+GraphQL+Angular的、无前端(headless)电商框架
Stars: ✭ 52 (-11.86%)
Mutual labels:  spring-boot
Go Restful
🚀 A real world production-grade RESTful Web Services proof-of-concept project.
Stars: ✭ 58 (-1.69%)
Mutual labels:  clean-architecture
Business Search App Java
Showcases object oriented programming in Java, Java Swing, Kotlin, and Android
Stars: ✭ 53 (-10.17%)
Mutual labels:  clean-architecture
Mosbymvi
Model-View-Intent (MVI) sample app built in Kotlin with Mosby, RxJava and RxBinding
Stars: ✭ 57 (-3.39%)
Mutual labels:  clean-architecture
Testing With Spring Boot
Repository that explains how to test applications with Spring Boot
Stars: ✭ 51 (-13.56%)
Mutual labels:  spring-boot
Aspnet Core Clean Arch
It is a clean architecture project template which is based on hexagonal-architecture principles built with .Net core.
Stars: ✭ 60 (+1.69%)
Mutual labels:  clean-architecture
Springboard
Spring Boot based production grade starter kit.
Stars: ✭ 59 (+0%)
Mutual labels:  spring-boot
Springsecuritytotp
Spring Security Login with Google Authenticator (Time-based One-time Password Algorithm, TOTP)
Stars: ✭ 56 (-5.08%)
Mutual labels:  spring-boot
Radar Covid Backend Configuration Server
Radar COVID Configuration Service
Stars: ✭ 56 (-5.08%)
Mutual labels:  spring-boot
Kotlin Android Scaffolding
An android project structure using kotlin and most common libraries.
Stars: ✭ 53 (-10.17%)
Mutual labels:  clean-architecture
Multi Tenant App Demo
Demonstrates the discriminator field (shared schema) based multi-tenant application using Spring Boot & Hibernate 5.
Stars: ✭ 57 (-3.39%)
Mutual labels:  spring-boot
Server
Enterprise Open Source IM Solution
Stars: ✭ 53 (-10.17%)
Mutual labels:  spring-boot
Log Viewer
Web UI to viewing logs
Stars: ✭ 59 (+0%)
Mutual labels:  spring-boot
Mycollab
An open source, free, high performance, stable and secure Java Application Business Platform of Project Management and Document
Stars: ✭ 1,063 (+1701.69%)
Mutual labels:  spring-boot
Tdcapp
Sample app which access the TDC (The Developer's Conference) REST API.
Stars: ✭ 55 (-6.78%)
Mutual labels:  clean-architecture
Spring Boot Fx
🎈Spring Boot, JavaFX, bootstrap3, mongoDB
Stars: ✭ 57 (-3.39%)
Mutual labels:  spring-boot
Pinboard Kotlin
Unofficial Pinboard android app, developed as a playground to study many topics related to Android. Kotlin + Coroutines + MVVM
Stars: ✭ 60 (+1.69%)
Mutual labels:  clean-architecture
Stocktradetracking
A showcase for modularized MVVM Architecture for Android, powered by Kotlin Coroutines and Clean Architecture.
Stars: ✭ 60 (+1.69%)
Mutual labels:  clean-architecture

Offer service Build Status

Dear stargazers, hope you like the project. Feel free to ask questions. I'll add some diagrams when I get a chance

This is a REST based service that allows API consumers to create, cancel and query offers for merchants.

The project was developed using TDD. The system architecture is heavily inspired by Robert C. Martin's Clean Architecture, a use case driven approach. I developed this program with the mindset that this module is apart of a large system and attempted to make it as modular and pluggable as possible.

The APIs invoke a single Use Case. The Use Case constructs and acts over one to many Entities and in doing so also talks to a Gateway more commonly known as Repository or Adapters. When an API needs to return a result, a Presenter is passed into the API. As we pass through the various layers we use separate models. Use Cases produce Response Models, Presenters produce View Models.

For the delivery mechanism I used Spring's REST controllers to deliver JSON

There are 4 public APIs

  • Create Offer
POST /offer-service/api/v1/offers
{
  "name: "offer name",
  "description: "offer description",
  "price: "5.00",
  "currency: "GBP",
  "duration: {
    "startDate: "2018-01-01",
    "endDate: "2018-01-31"
  }
}

Response
HTTP Status 201 Created
{
  id: "12c3009d-046d-411c-85eb-6e379e2f5d2a"
}
  • Cancel Offer

There are various ways in which we could cancel an offer e.g. use the PATCH or DELETE HTTP method, I instead opted for a command style

POST /offer-service/api/v1/offers/{offer-id}/cancel

Response
HTTP Status 204 No Content
  • Get Offers
GET  /offer-service/api/v1/offers`

Response
HTTP Status 200
offers: [
  {
    id: "12c3009d-046d-411c-85eb-6e379e2f5d2a",
    name: "offer name",
    description: "offer description",
    price: "5.00",
    currency: "GBP",
    duration: {
      startDate: "2018-01-01",
      endDate: "2018-01-31"
    },
    status: "ACTIVE|EXPIRED"
  },
  {
    id: "cc3453d7-6d75-422c-87da-37ee9f65bd11",
    ...
  },
  {
    id: "3f5f779c-b145-49fd-8a73-c8770fad072a",
    ...
  }
]

  • Get Offer by ID
GET  /offer-service/api/v1/offers/{offer-id}`

Response
HTTP Status 200
{
  id: "12c3009d-046d-411c-85eb-6e379e2f5d2a",
  name: "offer name",
  description: "offer description",
  price: "5.00",
  currency: "GBP",
  duration: {
    startDate: "2018-01-01",
    endDate: "2018-01-31"
  },
  status: "ACTIVE|EXPIRED"
}

Or

HTTP Status 404 Not Found

Project dependencies

This project uses Java 8 with Spring Boot, H2 database and Swagger for API documentation. Tests were written with JUnit4.

Running the application

To build the project, run:

gradlew clean build

To run the application, from the root of the project run:

gradlew bootRun

View the Swagger documentation

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].