What is Moodboard (Digital pinboard) = ID App by Amo
-
Suppose you are going on vacation and you created pinboard where you will pin (photos, videos, text)
Requirements
Functional (CRUD)
- 1. Create. User can create the pinboard
- 2. Read. User can see the created pinboard
- 3. Update. User can add/delete/update text/video/image on pinboard
- 4. Delete. User can delete pinboard
Non-Functional
- 1. Reliable. Once board created, it should be not autoremove image,text,video on board
- 2. Latency: No latency in viewing/editing the Moodboard
- 3. Secure: Board should be visible to friends only
BOE
-
BW requirements not huge, User can create video(upload), then photo(upload) etc.
System APIs (CRUD)
-
REST API?
REST API Versioning(v1,v2)
1. Create |
2. Read |
3. Update |
4. Delete |
|---|---|---|---|
|
|
|
|
|
|
|
|
DB Schema
- Graph DB
user Table
| userid(pk) | username | created_at(timestamp) | enabled |
password Table
| user_id(pk) | password_hash | created_at | expiry_at |
- Photos, Videos will be stored in Object Store
- Friends list, comments would be stored in Graph DB.
Photo Table
| photo_id(pk) | photo_url(url on object store) | user_id (fk) | comment_id |
MoodBoard Table
| moodboard_id(pk) | user_id(fk) |
HLD
1. Reading moodboard
2. Updating moodboard (ie upload photo)
| 1 user | 1 Million users | ||||||
|---|---|---|---|---|---|---|---|
@startuml
actor User as u
box "Data Center" #Cyan
participant LoadBalancer as lb
participant AppServer as as
queue Kafka as kafka #LightPink
participant "Photo\nProcessor" as pa
participant Diesel as diesel
database DB as db
end box
database "ObjectStore\nAmazon S3" as os #Brown
u -> lb: HTTP GET moodboard
lb -> as: HTTP GET moodboard
as -> diesel: "SELECT * FROM"
diesel -> db: "SELECT * FROM"
db -> as: content
note over as
Create HTTP Response
Body(moodboard)
end note
as -> u: moodboard
note over u
moodboards shown
to user
end note
note over u
User selects
moodboard2 and
drop photo on
coordinates (x,y)
end note
u -> lb: HTTP PUT(Update)\nuserId=1, moodboardId=2\n content=image, location=(x,y)\nphoto url
u -> lb: photo
lb -> as: HTTP PUT(Update)\nuserId=1, moodboardId=2\n content=image, location=(x,y)\nphoto url
lb -> as: photo
note over as
validate photo:
- acceptable format(jpg,png)
- acceptable size
- not virus
end note
as -> kafka: photo
kafka -> pa: photo
note over pa
resize, compress
end note
pa -> os: photo
pa -> db: Metadata of photo
note over db
URLs/
Thumbnails
end note
as -> diesel: INSERT INTO\nmoodboard table
diesel -> db: INSERT INTO\nmoodboard table
as -> u: ACK, Update success
@enduml
|
|