List the key functional requirements for the system (Ask the AI for hints if stuck)...
List the key non-functional requirements (performance, scalability, reliability, etc.)...
Define the APIs expected from the system. This is your chance to analyze and define the read and write paths so that you can come up with the high-level design...
There will be 5 major APIs:
Endpoint 1: Create a new tag
POST /tags
Endpoint 2: Apply a tag to an entity. Fail if the tag has already been applied to this entity, or if any of the parameter is invalid.
POST /tags/apply
Endpoint 3: Remove a tag from an entity. Only succeed if the tag has been applied to this entity, and all paramters valid.
DELETE /tags/removeFrom/{entity_type}/{entity_token}/{tag_id}
Endpoint 4: Remove a tag from the system. Only succeed if the tag id is valid. This will also removed the tag from any entities that have been applied
DELETE /tags/{tag_id}
Endpoint 5: Get all tags applied to an entity
GET /tags/{entity_type}/{entity_token}
Describe the overall system architecture. Identify the main components needed to solve the problem end-to-end. Use the diagramming tool to create a block diagram.
As shown in the high level diagram, there are following components in the system
client
TagsWrittingService - handling the write operations, such as creating tags / add tag to an item, etc.
TagsReadingService - handling the read operations, typically fetching all tags added to an item
TagStore: consist of primary and (maybe a number of) replicas. The replication is done asynchronously, therefore the data store is eventual consistent. Write is performed on primary and reads are from replicase.
Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.
Storage: The service is reading from replica and writing to primary, and the storage is using an eventual consistent model.
Asynchronous sync: This can be done through eventing