What clean architecture is, what it is useful for and how to use it on frontend.
My name is Alex.
I am a developer, mentor, and speaker.
Designing is fundamentally about taking things apart... in such a way that they can be put back together. ...Separating things into things that can be composed that's what design is.
Most important:
export type UserName = string;
export type User = {
id: UniqueId;
name: UserName;
email: Email;
preferences: Ingredient[];
allergies: Ingredient[];
};
export type ProductTitle = string;
export type Product = {
id: UniqueId;
title: ProductTitle;
price: PriceCents;
toppings: Ingredient[];
};
export type Cart = {
products: Product[];
};
export type OrderStatus =
"new" | "delivery" | "completed";
export type Order = {
user: UniqueId;
products: Product[];
created: DateTimeString;
status: OrderStatus;
total: PriceCents;
};
type Email = string;
type UniqueId = string;
type DateTimeString = string;
type PriceCents = number;
type OrderProducts = (user: User, cart: Cart)
=> Promise<void>