Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/akdasa-studios/framework
📦 Build solid applications
https://github.com/akdasa-studios/framework
clean-architecture clean-code ddd framework typescript
Last synced: about 2 months ago
JSON representation
📦 Build solid applications
- Host: GitHub
- URL: https://github.com/akdasa-studios/framework
- Owner: akdasa-studios
- Created: 2022-10-13T12:14:21.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-26T11:56:40.000Z (12 months ago)
- Last Synced: 2024-05-01T09:40:02.197Z (8 months ago)
- Topics: clean-architecture, clean-code, ddd, framework, typescript
- Language: TypeScript
- Homepage:
- Size: 351 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
_Framework_ is a simple library we use to build our application. It is based on _Domain Driven Development_ principles. The goals of that framework are to help with:
1. Create applications using domain-oriented principles.
2. Create testable and robust applications.
3. Work on every platform: mobile, desktop, and web.# Documentation
[Read the docs](./docs/index.md). Documentation is still in progress, but you can already find some useful information. If you have any questions, feel free to ask them in issues. We will try to answer them as soon as possible.## Development
1. `npm run test` - Run all tests
2. `npm run test:unit` - Run unit tests
3. `npm run test:mutational` - Run mutational tests# Show me the code!
```ts
import { UuidIdentity, Aggregate, Entity } from '@akdasa-studios/framework/domain/models'
import { QueryBuilder } from '@akdasa-studios/framework/domain/persistence'// Identities
class OrderId extends UuidIdentity<'Order'> {}
class OrderLineId extends UuidIdentity<'OrderLine'> {}// Entity
class OrderLine extends Entity {
constructor(
public readonly line: string,
public readonly quantity: number,
id?: OrderLineId
) {
super(id || new UuidIdentity())
}
}// Aggregate
class Order extends Aggregate {
constructor(
public readonly lines: OrderLine[],
public readonly price: Price,
id?: OrderId
) {
super(id || new UuidIdentity())
}addLine(line: OrderLine) {
this.lines.push(line)
}
}// Fetching data
const q = new QueryBuilder()// Build queries using builder methods
const tastyDishes = q.or(
q.eq('sku.itemName', 'Lassi'),
q.eq('sku.itemName', 'Dosa'),
)// Use parametric query
const moreExpensiveThan = (price: number) => q.gte('price', price)
const goldenOrders = moreExpensiveThan(1000)// Execute query
clientRepository.find(q.and(goldenOrders, commonLastName))
```