Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matgalv2/shop-app
Simple CRUD REST-based application for managing online store. Database consists of 5 tables: clients, products, orders, addresses and ordersproducts, which resolves N:N relation between those two.
https://github.com/matgalv2/shop-app
http4s openapi rest-api scala zio
Last synced: 6 days ago
JSON representation
Simple CRUD REST-based application for managing online store. Database consists of 5 tables: clients, products, orders, addresses and ordersproducts, which resolves N:N relation between those two.
- Host: GitHub
- URL: https://github.com/matgalv2/shop-app
- Owner: matgalv2
- Created: 2024-09-16T14:56:09.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2024-11-09T16:26:04.000Z (7 days ago)
- Last Synced: 2024-11-09T17:27:03.638Z (7 days ago)
- Topics: http4s, openapi, rest-api, scala, zio
- Language: Scala
- Homepage:
- Size: 203 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Shop app
Simple CRUD REST-based application for managing online store. Database consists of 5 tables: clients, products, orders, addresses and ordersproducts, which resolves N:N relation between those two.![image info](./icon.png)
### Progress
![](https://geps.dev/progress/80?dangerColor=800000&warningColor=ff9900&successColor=006600)| | Customers | Products | Orders |
|-------------------|-----------|----------|--------|
| Implementation | ✅ | ✅ | ❌ |
| Unit Tests | ✅ | ✅ | ❌ |
| Integration Tests | ✅ | ✅ | ❌ |
| Acceptance Tests | ✅ | ✅ | ❌ |## Technology & tools:
Technology stack:
* Scala 2.13
* ZIO 2
* PostgreSQL
* Flyway
* Http4s
* Cats 2
* OpenAPITools & libraries:
* Guardrail
* Quill
* Chimney
* Typesafe config## API
All APIs are described here:
* [Customers API](./api/customerApi.yaml)
* [Products API](./api/productApi.yaml)
* [Orders API]()## Design decisions:
### 1. REST API
* Based on OpenApi specifications Guardrail generates boilerplate code for controllers.### 2. Database
* Database migrations - to ensure application works with latest version of database Flyway controls database migrations.
* DSL - to simplify work with database Quill provides QDSL for expressing queries in Scala.
* Queries implementations - due to fact that quill queries return effects that can fail with SQLError all effects should die with DatabaseCriticalFailure### 3. Data transformation
* Mappers - Chimney library was utilized for transforming data types (Domain <-> DTO)### 4. Domain
* Validation - to ensure all data flowing through app is valid, all the objects are validated before being used.
* ErrorMessage - special type class for all domain errors to easily transform them into error responses