-
Notifications
You must be signed in to change notification settings - Fork 0
docs: improve architecture diagrams readability #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| # Architecture | ||
|
|
||
| Diagrams are stored in `docs/diagrams/` as PlantUML source and exported PNG files. | ||
|
|
||
| ## Context: Event-driven autocomplete pipeline | ||
|
|
||
|  | ||
|
|
||
| Source: `docs/diagrams/context-autocomplete-system.puml` | ||
|
|
||
| ## Sequence: search ingestion and indexing | ||
|
|
||
|  | ||
|
|
||
| Source: `docs/diagrams/sequence-search-ingestion.puml` | ||
|
|
||
| ## Sequence: autocomplete query flow | ||
|
|
||
|  | ||
|
|
||
| Source: `docs/diagrams/sequence-autocomplete-query.puml` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| @startuml | ||
| title Autocomplete System - Context Diagram | ||
|
|
||
| skinparam backgroundColor #FFFFFF | ||
| skinparam packageStyle rectangle | ||
| skinparam shadowing false | ||
| skinparam defaultTextAlignment center | ||
|
|
||
| actor "User" as user | ||
|
|
||
| rectangle "Autocomplete System" as system { | ||
| rectangle "Frontend\n(Angular + Nginx, :4200)" as frontend | ||
| rectangle "Search Service\n(Spring Boot, :8082)" as search | ||
| rectangle "CDC Service\n(Spring Boot, :8084)" as cdc | ||
| rectangle "Autocomplete Service\n(Spring Boot, :8081)" as autocomplete | ||
| } | ||
|
|
||
| queue "Kafka\n(search-events, search-stats,\ndb-changes.public.search_stats)" as kafka | ||
| database "PostgreSQL\n(search_stats)" as postgres | ||
| database "Redis\n(autocomplete:<prefix>)" as redis | ||
| rectangle "Debezium Connect\n(:8083)" as debezium | ||
|
|
||
| user --> frontend : Submit query / request suggestions | ||
| frontend --> search : GET /api/search?q=... | ||
| search --> kafka : Publish search-events | ||
| kafka --> search : Kafka Streams aggregate | ||
| search --> postgres : Upsert query frequency | ||
| search --> kafka : Publish search-stats | ||
| postgres --> debezium : WAL CDC | ||
| debezium --> kafka : Emit db-changes.public.search_stats | ||
| kafka --> cdc : Consume Debezium envelope | ||
| cdc --> redis : Update prefix sorted sets | ||
| frontend --> autocomplete : GET /api/complete?q=...&limit=... | ||
| autocomplete --> redis : Read top suggestions | ||
| autocomplete --> frontend : Ranked suggestions | ||
|
|
||
| @enduml | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| @startuml | ||
| title Autocomplete Query Flow | ||
|
|
||
| actor User | ||
| participant "Frontend\n:4200" as Frontend | ||
| participant "AutocompleteController\nautocomplete-service :8081" as Controller | ||
| participant "AutocompleteQueryService" as QueryService | ||
| database "Redis\nautocomplete:<prefix>" as Redis | ||
|
|
||
| User -> Frontend: Type prefix "ja" | ||
| Frontend -> Controller: GET /api/complete?q=ja&limit=10 | ||
| Controller -> QueryService: getSuggestions("ja", 10) | ||
| QueryService -> QueryService: trim + lowercase validation | ||
| QueryService -> Redis: ZREVRANGE autocomplete:ja 0 9 | ||
| Redis --> QueryService: ["java", "javascript", ...] | ||
| QueryService --> Controller: Suggestion list | ||
| Controller --> Frontend: 200 OK + JSON array | ||
| Frontend --> User: Render ranked suggestions | ||
|
|
||
| @enduml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| @startuml | ||
| title Search Ingestion and Redis Indexing Flow | ||
|
|
||
| actor User | ||
| participant "Frontend\n:4200" as Frontend | ||
| participant "SearchController\nsearch-service :8082" as SearchController | ||
| participant "SearchEventProducer" as Producer | ||
| queue "Kafka topic\nsearch-events" as SearchEvents | ||
| participant "SearchStatsTopology" as Topology | ||
| database "PostgreSQL\nsearch_stats" as Postgres | ||
| participant "Debezium Connect\n:8083" as Debezium | ||
| queue "Kafka topic\ndb-changes.public.search_stats" as DbChanges | ||
| participant "DebeziumConsumer\ncdc-service :8084" as Consumer | ||
| participant "RedisSearchUpdater" as Updater | ||
| database "Redis\nautocomplete:<prefix>" as Redis | ||
|
|
||
| User -> Frontend: Type search query | ||
| Frontend -> SearchController: GET /api/search?q=java | ||
| SearchController -> Producer: sendSearchEvent("java") | ||
| Producer -> SearchEvents: Produce search event | ||
| SearchEvents -> Topology: Consume event | ||
| Topology -> Topology: trim + lowercase + count | ||
| Topology -> Postgres: Upsert query frequency | ||
| Postgres -> Debezium: Capture row change (CDC) | ||
| Debezium -> DbChanges: Publish payload.after event | ||
| DbChanges -> Consumer: Consume CDC record | ||
| Consumer -> Updater: updateFromAfter(query, frequency) | ||
| Updater -> Updater: Generate prefixes (j, ja, jav, java) | ||
| Updater -> Redis: ZADD autocomplete:<prefix> query score | ||
|
|
||
| @enduml |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.