Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/src/03_context_and_scope.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ include::./diagrams/S3_C4_Technical_Context_Diagram.puml[]
The system will be deployed in a single server (using **Docker**) containing all the functionalities separated in different modules:

* **Wichat Application Proxy: **
When interacting with the server, a <TO BE DEFINED> proxy will be tasked with redirecting the queries to the petitions to the Wichat application client, which will also be deployed on a <TO BE DEFINED> web server.
When interacting with the server, a <TO BE DEFINED> proxy will be tasked with redirecting the queries to the petitions to the Wichat application client, which will also be deployed on a Azure web server.

* **Wichat Application Client: **
This client will be served to the user and communicates with the API through HTTPS calls and exchanges information through JSON objects. The client (Front-End of the application) will be developed in React (+ JavaScript), and it is deployed via a <TO BE DEFINED> server.
This client will be served to the user and communicates with the API through HTTPS calls and exchanges information through JSON objects. The client (Front-End of the application) will be developed in React (+ JavaScript), and it is deployed via a Azure server.

* **Wichat REST API:**
The Wichat REST API will be run as a .jar file on the server and connect to a database running on a MongoDB docker container. The connection layer between the <TO BE DEFINED> API and the database will be <TO BE DEFINED>.
Expand Down
11 changes: 9 additions & 2 deletions docs/src/07_deployment_view.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,15 @@ Mapping of Building Blocks to Infrastructure::
|===
| Building Block | Infrastructure Component
| **Client / Frontend** | Contained in the `webapp` subfolder. Docker container hosted on Azure. Serves the user interface and communicates with the backend via the gateway service.
| **APIs / Backend** | Docker container hosted on Azure. Handles game logic, user management and question generation. Communicates with the MongoDB database.
| **Gateway Service** | Contained in the `gatewayservice` subfolder. Docker container hosted on a cloud platform. Acts as a single entry point for all incoming requests, routing them to the appropriate services.
| **LLM Service** | Contained in the `llmservice` subfolder. Configuration and API for the external service hosted by the LLM provider. Accessed via HTTPS from the backend to generate conversational hints.
| **LLM Service** | Contained in the `llmservice` subfolder. Configuration and API for the external service hosted by the LLM provider. Accessed from the backend to generate conversational hints.
| **Game Service** | Contained in the `gameservice` subfolder. Accessed from the backend to store all the relevant information after a game is finished.
| **Question Generator** | A separate component that runs during all the life application. Queries Wikidata using MQL to generate questions and answers, which are then stored in the MongoDB database.
| **Authentication Service** | Contained in the `authservice` subfolder. Accessed from the backend to store the user information.
| **User Service** | Contained in the `userservice` subfolder. Accessed from the backend to store the user information into the database.
| **MongoDB Database** | Containerized instance.
| **Grafana** | Containerized monitoring dashboard hosted alongside backend services.
| **Prometheus** | Containerized metrics collection and alerting tool.
|===

=== Infrastructure Level 2
Expand All @@ -104,6 +108,9 @@ The **frontend** is a single-page application (SPA) that runs in the user's web
==== APIs / Backend
The **backend** is a set of RESTful APIs that provide game logic, user management, and question generation services. It is built using Node.js and Express, and communicates with the MongoDB database. The backend is containerized using Docker and deployed on a cloud platform. The backend is stateless and horizontally scalable, allowing it to handle increased traffic by spinning up additional instances.

==== Proxy (NGINX)
NGINX acts as a reverse proxy and is used primarily to enable HTTPS by handling SSL/TLS termination. It is deployed as a Docker container alongside other services within the infrastructure.

=== Conclusion

The Deployment View provides a detailed overview of how the WiChat application will be deployed across different environments and infrastructure components. It ensures that the system meets the quality goal of scalability while supporting efficient development and deployment processes.
7 changes: 7 additions & 0 deletions docs/src/diagrams/C4_deployment_diagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Deployment_Node(serverNode, "Application Server", "Ubuntu VM (Azure)") {
Container(auth, "User Authentication Service", 8002)
Container(qg, "Question Generator Service", 8004)
Container(llm, "LLM Service", 8003)
Container(game, "Game Service", 8005)
Container(grafana, "Grafana", 9091)
Container(prometheus, "Prometheus", 9090)
ContainerDb(db, "MongoDB", 27017)
}

Expand All @@ -18,8 +21,12 @@ Rel(gateway, auth, "")
Rel(gateway, users, "")
Rel(gateway, qg, "")
Rel(gateway, llm, "")
Rel(gateway, game, "")
Rel(gateway, grafana, "")
Rel(gateway, prometheus, "")
BiRel(auth, db, "")
BiRel(users, db, "")
BiRel(game, db, "")
Rel(qg, db, "")

@enduml
18 changes: 10 additions & 8 deletions docs/src/diagrams/S3_C4_Business_Context_Diagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,28 @@ top to bottom direction
Person(user, "User")
System_Boundary(quizGame, "WiChat Application") {
System(wichat, "WiChat Main API", "Main system / interface to provide the quiz game service")
System(game, "WiChat Game Module", "Game service layer that provides the game logic and stands as a façade for the rest of the modules", "Internal system")
System(gateway, "WiChat Gateway Module", "Stands as a façade for the rest of the modules", "Internal system")
Container(llmChat, "LLM AI Chat", "Empathy", "Application service that works as an interface with the LLM API", "Internal system")
Container(auth, "Authentication Module", "", "Application module to manage the sessions and authentications", "Internal system")
Container(gameService, "Game Module", "Application module that provides the game logic", "Internal system")
Container(questionGen, "Question Generator", "", "Application module that generates the questions of the game using information from Wikidata", "Internal system")
Container(authAPI, "Auth API", "Resource that provides session verification")
SystemDb(mongodb, "MongoDB Database", "Database to store the game questions and possible answers")
SystemDb(sqldb, "SQLite Database", "Database to store the user data, rankings and other statistics")
SystemDb(mongodb, "MongoDB Database", "Database to store the game questions, possible answers, the user data, rankings and other statistics")
}
System_Ext(wikidata, "WikiData API", "External resource to provide data for the questions and images")
System_Ext(llm, "LLM API", "External resource to provide hints")

Rel(user, wichat, "Uses")
Rel(wichat, game, "Uses")
Rel(game, llmChat, "Provides")
Rel(game, auth, "Provides")
Rel(game, questionGen, "Provides")
Rel(wichat, gateway, "Uses")
Rel(gateway, llmChat, "Provides")
Rel(gateway, auth, "Provides")
Rel(gateway, questionGen, "Provides")
Rel(gateway, gameService, "Provides")
Rel(llmChat, llm, "Connects to")
Rel(auth, authAPI, "Connects to")
Rel(authAPI, sqldb, "Stores data in")
Rel(authAPI, mongodb, "Stores data in")
Rel(questionGen, mongodb, "Stores data in")
Rel(gameService, mongodb, "Stores data in")
Rel(questionGen, wikidata, "Collects data from")

@enduml
6 changes: 4 additions & 2 deletions docs/src/diagrams/S3_C4_Technical_Context_Diagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,21 @@ System_Boundary(quizGame, "Quiz Game System") {
System(frontend, "Frontend", "React + JavaScript", "GUI for playing the game")
System(backend, "Backend", "Node.js", "Handles authentication, quiz logic, and API communication")
}
SystemDb(database, "Database", "MongoDB", "Stores users, quiz data and other information")
SystemDb(database, "Database", "MongoDB", "Stores users, quiz data and game information")
System_Ext(authAPI, "Authentication API", "Validates user authentication")
System_Ext(wikidata, "Wikidata API", "Provides quiz questions and answers")
System_Ext(llm, "LLM Chat API", "Provides hints based on quiz questions")
System_Ext(game, "Game API", "Provides users scores and statistics")

' User interactions
user --> frontend : "Plays the quiz"
frontend --> backend : "Requests quiz questions & hints"
backend --> database : "Stores user progress"
backend --> database : "Stores application progress"

' External API calls
backend --> authAPI : "Validates login/register"
backend --> wikidata : "Fetches quiz questions"
backend --> llm : "Requests hint"
backend --> game : "Stores user progress"

@enduml