@@ -35,22 +35,69 @@ A modern, full-stack todo application built with Go (Fiber) + React + MongoDB
35
35
36
36
``` mermaid
37
37
graph TD
38
- Client[React Frontend] -->|HTTP Requests| Backend[Go API]
39
- Backend -->|CRUD Operations| Database[(MongoDB)]
40
- Client -->|Static Assets| FrontendBuild[React Build]
41
-
42
- subgraph "Frontend (React)"
43
- Client
44
- FrontendBuild
45
- end
46
-
47
- subgraph "Backend (Go)"
48
- Backend
49
- end
50
-
51
- subgraph "Database"
52
- Database[(MongoDB)]
53
- end
38
+ subgraph Client["Frontend Client"]
39
+ UI[React UI]
40
+ end
41
+
42
+ subgraph Server["Go Fiber Server (main.go)"]
43
+ Main[Main Function]
44
+ ENV[Load Environment]
45
+ DB[MongoDB Connection]
46
+ Router[Fiber Router]
47
+
48
+ subgraph Endpoints["API Endpoints"]
49
+ GET[GET /api/todos]
50
+ POST[POST /api/todos]
51
+ PATCH[PATCH /api/todos/:id]
52
+ DELETE[DELETE /api/todos/:id]
53
+ end
54
+
55
+ subgraph Handlers["Handler Functions"]
56
+ getTodos
57
+ createTodo
58
+ updateTodo
59
+ deleteTodo
60
+ end
61
+ end
62
+
63
+ subgraph Database["MongoDB Atlas"]
64
+ Collection["Collection: todos</br>Database: golang_db"]
65
+ end
66
+
67
+ %% Main Application Flow
68
+ Main --> ENV
69
+ ENV --> DB
70
+ Main --> Router
71
+ Router --> Endpoints
72
+
73
+ %% Connect Endpoints to Handlers
74
+ GET --> getTodos
75
+ POST --> createTodo
76
+ PATCH --> updateTodo
77
+ DELETE --> deleteTodo
78
+
79
+ %% Connect Handlers to Database
80
+ getTodos --> Collection
81
+ createTodo --> Collection
82
+ updateTodo --> Collection
83
+ deleteTodo --> Collection
84
+
85
+ %% Client Interaction
86
+ UI <--> GET
87
+ UI <--> POST
88
+ UI <--> PATCH
89
+ UI <--> DELETE
90
+
91
+ %% Styling
92
+ classDef server fill:#f9f,stroke:#333,stroke-width:2px
93
+ classDef database fill:#b5d8ff,stroke:#333,stroke-width:2px
94
+ classDef client fill:#baffc9,stroke:#333,stroke-width:2px
95
+ classDef endpoint fill:#fff5ba,stroke:#333,stroke-width:2px
96
+
97
+ class Server server
98
+ class Database database
99
+ class Client client
100
+ class GET,POST,PATCH,DELETE endpoint
54
101
```
55
102
56
103
## ✨ Features
0 commit comments