English
Checkpoint
What must work
There is no code of your own yet, so there is nothing to commit. Before you go on, stop the reference servers and its database (./Run.ps1 db-stop in D:\Work\Chatex-Reference).
Common mistakes
Table 1.3. Common mistakes when running the reference version
| Symptom | Cause | Fix |
|---|---|---|
./Run.ps1 opens in Notepad or prints a policy error | the script is started from Windows PowerShell 5 or by double-click | start pwsh (PowerShell 7) and run the script from it |
docker compose fails with "cannot connect to the Docker daemon" | Docker Desktop is not running | start Docker Desktop and wait until the engine is running |
Bind for 0.0.0.0:5432 failed: port is already allocated | another PostgreSQL is already listening on port 5432 | stop it (a local PostgreSQL service or another container) |
| the page loads, but signing in or registering fails with an error | the API is not running (the dev server answers /api requests with a proxy error) | start ./Run.ps1 api in a second terminal before ./Run.ps1 web |
| Bob's window does not update | both users are in the same browser session | use a private window or a different browser for the second user |
Self-check questions
- What features does Chatex have? Name at least one feature from each area: accounts, chats, messages, real time, operations.
- How do direct chats, groups and channels differ? Who can post in each of them?
- What does Nginx do in front of Chatex.Api? Which two kinds of requests does it forward to the API?
- Why is the backend split into three layers? What does each layer know, and what must it not know?
- Why can Chatex.Core not call SignalR directly, and how does
IChatNotifiersolve that? - Describe the six steps of sending a message from the endpoint to the response.
- Why does the tutorial build the application from the database up? How do you check your code before the first screen exists?
- How do you find out what is different between your file and the reference file?
Exercises
- Trace a feature. Pick "edit a message" and find in the reference code the endpoint (
Source/Chatex.Api/Endpoints), the service method (Source/Chatex.Core/Messages) and the SignalR event it raises. Draw a sequence diagram like Fig. 1.5 for it. - Explore the API. In Scalar, sign in through
POST /api/auth/login, copy theaccessTokenfrom the response, authorize with it and callGET /api/chats. Compare the JSON with what the chat list shows in the browser. - Map the features. Make a table with the feature areas of What Chatex does as rows and the projects
Chatex.Data,Chatex.Core,Chatex.Api,Chatex.Webas columns, and put a cross where a project has code for that feature. Which project appears in every row, and why?