# Market System Design Issues and Considerations
It is very important to get the system design for Market right from day one.
The difficult pieces are:
- Carts and Orders
- Images*
## Carts and Orders
### Serializing orders
How do we generate order numbers that are unique and ordered based on the store they are related to?
First of all, is this necessary? And if not, what would be a better way to generate order numbers that look decent, and are also unique.
### Managing carts and order items
What if on the carts, we store the quantity of the items and all (so that we can actually get the live price information), but then when the user places the order, the price is fixed on the actual order item.
It also should be noted that this structure expects that the cart will be stored on the frontend, but should also work if it's on the server.
Also, it's scary that since we're using Hasura, a lot of this logic is going to run on the frontend. It makes me think that Hasura is probably not the way to go to run this sort of thing.
It is possible to build a *microservice* for handling orders, most importantly the conversion of cart to order, and the calculations that come with that, but already that means that we are building so many microservices already, that it isn't clear exactly what the value proposition for Hasura is. Things like subtotal, total, discount et al. just shouldn't be calculated with the user's compute.
More and more, it seems like Hasura isn't the right choice for an application of this structure.
On the other hand, it may be sensible to just keep building with this for the MVP, and switch after the launch, to something more structured and convenient from a development standpoint.
## Data Structures
It should be noted that image-related data structures have been omitted from this list.
### Users
- id
- name
- phone
- expo_push_token
### Stores
- id
- name
- short_name
- description* (To add)
### Items
- id
- name
- description
- unit
- quantity
- unit_price
### Orders
- id
- store_id
- order_number
- status (Pending, Fulfilled, Delivered)
- subtotal
- total (Fixed, not computed)
### Order Items
- id
- order_id
- item_id
- quantity
- unit_price
## Launch Plan
- CRUD for items
- Finalize and implement order system
- Set up image storage and uploads