{"id":2017,"date":"2026-08-06T06:15:46","date_gmt":"2026-08-06T06:15:46","guid":{"rendered":"https:\/\/www.vpascode.com\/vn\/docs\/uncategorized\/d2-syntax-basics\/"},"modified":"2026-08-06T06:15:46","modified_gmt":"2026-08-06T06:15:46","slug":"d2-syntax-basics","status":"publish","type":"ld_docs","link":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/","title":{"rendered":"C\u00e1c kh\u00e1i ni\u1ec7m c\u01a1 b\u1ea3n v\u1ec1 c\u00fa ph\u00e1p D2"},"content":{"rendered":"<p>D2 l\u00e0 m\u1ed9t c\u00f4ng c\u1ee5 hi\u1ec7n \u0111\u1ea1i d\u1ef1a tr\u00ean v\u0103n b\u1ea3n \u0111\u1ec3 t\u1ea1o ra c\u00e1c s\u01a1 \u0111\u1ed3 r\u00f5 r\u00e0ng, d\u1ec5 \u0111\u1ecdc. D2 l\u00e0 vi\u1ebft t\u1eaft c\u1ee7a \u201cS\u01a1 \u0111\u1ed3 khai b\u00e1o\u201d. Trong VPasCode, D2 cho ph\u00e9p c\u00e1c nh\u00e0 ph\u00e1t tri\u1ec3n ph\u1ea7n m\u1ec1m v\u00e0 ki\u1ebfn tr\u00fac s\u01b0 gi\u1ea3i ph\u00e1p chuy\u1ec3n \u0111\u1ed5i v\u0103n b\u1ea3n m\u00e3 \u0111\u01a1n gi\u1ea3n th\u00e0nh c\u00e1c m\u00f4 h\u00ecnh tr\u1ef1c quan s\u1ea1ch s\u1ebd m\u00e0 kh\u00f4ng c\u1ea7n v\u1ebd c\u00e1c h\u00ecnh d\u1ea1ng th\u1ee7 c\u00f4ng.<\/p>\n<div class=\"callout\" style=\"background-color: #f0fdf4; border-left: 4px solid #16a34a; padding: 1rem; border-radius: 4px; margin-bottom: 1.5rem;\"><strong>M\u1eb9o:<\/strong>C\u00fa ph\u00e1p D2 \u0111\u01b0\u1ee3c thi\u1ebft k\u1ebf \u0111\u1ec3 \u0111\u01a1n gi\u1ea3n v\u00e0 d\u1ec5 \u0111\u1ecdc. C\u00e1c h\u00ecnh d\u1ea1ng, k\u1ebft n\u1ed1i, nh\u00e3n v\u00e0 nh\u00f3m \u0111\u1ec1u c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c vi\u1ebft b\u1eb1ng c\u00e1c d\u00f2ng v\u0103n b\u1ea3n c\u01a1 b\u1ea3n m\u00e0 kh\u00f4ng c\u1ea7n c\u1ea5u h\u00ecnh ph\u1ee9c t\u1ea1p.<\/div>\n<h2 style=\"font-size: 1.5rem; font-weight: bold; color: #1f2937; margin-top: 2rem; margin-bottom: 1rem; border-left: 4px solid #4f46e5; padding-left: 0.75rem;\">1. H\u00ecnh d\u1ea1ng c\u01a1 b\u1ea3n v\u00e0 k\u1ebft n\u1ed1i<\/h2>\n<p>\u0110\u1ec3 t\u1ea1o h\u00ecnh d\u1ea1ng, ch\u1ec9 c\u1ea7n g\u00f5 t\u00ean c\u1ee7a ch\u00fang. \u0110\u1ec3 k\u1ebft n\u1ed1i c\u00e1c h\u00ecnh d\u1ea1ng, s\u1eed d\u1ee5ng m\u0169i t\u00ean (<code>-&gt;<\/code> \u0111\u1ec3 m\u1ed9t chi\u1ec1u ho\u1eb7c <code>&lt;-&gt;<\/code> \u0111\u1ec3 hai chi\u1ec1u).<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">D2<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpdjLEKwkAQRPuD+4cFa7EPYhMRS8lFUm\/OgRzEje7tCf69iSCi1TAzj7eikK63EVRPIoiWJvHunKG03lGHngL0Aa3o2LYnanAvyObd91m4PRv3nFHRARaHd\/fus\/6bGlhRmSOX0fKPazujNccBC8WXTafJQOEp8QX5ZzbN\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda D2 trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">D2<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpTVvB+uGt\/iULew90TMxWOTDy2ME8hPfPhrsV5vFx+6cc2PNw9N1Mh5fDOvHQFXTsF38MLKxWSMx7uXq4QnppkpRB5eFWpQvLDXctLFTxCQgJ4uVAVgLQ4H1uoUPxw93yFlIe71yvkZD7c3V5qpeDzcNfSSmQhXi5sCrHZGVIEdJ1C2cPdjQrZYKcXlgIFMKy2AWp1erh7pkIeUGg20GdA83KtFI5MeLh7MtAzSSApkGBvsn56RiYAMDt8Xw==\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-d2\"><code class=\"language-d2\" data-language=\"d2\" class=\"language-d2\"># K\u1ebft n\u1ed1i \u0111\u01a1n gi\u1ea3n\r\nNg\u01b0\u1eddi d\u00f9ng -&gt; M\u00e1y ch\u1ee7 Web: Y\u00eau c\u1ea7u HTTP\r\nM\u00e1y ch\u1ee7 Web -&gt; C\u01a1 s\u1edf d\u1eef li\u1ec7u: L\u1ea5y d\u1eef li\u1ec7u\r\nC\u01a1 s\u1edf d\u1eef li\u1ec7u -&gt; M\u00e1y ch\u1ee7 Web: Tr\u1ea3 v\u1ec1 k\u1ebft qu\u1ea3\r\nM\u00e1y ch\u1ee7 Web &lt;-&gt; B\u1ed9 nh\u1edb \u0111\u1ec7m: \u0110\u1ed3ng b\u1ed9 \u0111\u1ecdc\/ghi<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpTVvB+uGt\/iULew90TMxWOTDy2ME8hPfPhrsV5vFx+6cc2PNw9N1Mh5fDOvHQFXTsF38MLKxWSMx7uXq4QnppkpRB5eFWpQvLDXctLFTxCQgJ4uVAVgLQ4H1uoUPxw93yFlIe71yvkZD7c3V5qpeDzcNfSSmQhXi5sCrHZGVIEdJ1C2cPdjQrZYKcXlgIFMKy2AWp1erh7pkIeUGg20GdA83KtFI5MeLh7MtAzSSApkGBvsn56RiYAMDt8Xw==\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpdjLEKwkAQRPuD+4cFa7EPYhMRS8lFUm\/OgRzEje7tCf69iSCi1TAzj7eikK63EVRPIoiWJvHunKG03lGHngL0Aa3o2LYnanAvyObd91m4PRv3nFHRARaHd\/fus\/6bGlhRmSOX0fKPazujNccBC8WXTafJQOEp8QX5ZzbN\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda D2 trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"fTwbVMr\"><img fetchpriority=\"high\" alt=\"D2 simple connection diagram showing request and response flows between User, Web Server, Database, and Cache - Text to diagram editor - VPasCode\" class=\"alignnone wp-image-1923 size-full\" decoding=\"async\" fetchpriority=\"high\" height=\"642\" sizes=\"(max-width: 535px) 100vw, 535px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527.png 535w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527-250x300.png 250w\" width=\"535\"\/><\/p>\n<h2 style=\"font-size: 1.5rem; font-weight: bold; color: #1f2937; margin-top: 2rem; margin-bottom: 1rem; border-left: 4px solid #4f46e5; padding-left: 0.75rem;\">2. Ki\u1ec3u h\u00ecnh d\u1ea1ng v\u00e0 nh\u00e3n t\u00f9y ch\u1ec9nh<\/h2>\n<p>M\u1eb7c \u0111\u1ecbnh, c\u00e1c h\u00ecnh d\u1ea1ng xu\u1ea5t hi\u1ec7n d\u01b0\u1edbi d\u1ea1ng h\u1ed9p ti\u00eau chu\u1ea9n. B\u1ea1n c\u00f3 th\u1ec3 d\u1ec5 d\u00e0ng thay \u0111\u1ed5i ki\u1ec3u bi\u1ec3u t\u01b0\u1ee3ng c\u1ee7a h\u00ecnh d\u1ea1ng ho\u1eb7c \u0111\u1eb7t nh\u00e3n t\u00f9y ch\u1ec9nh b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng thu\u1ed9c t\u00ednh <code>h\u00ecnh d\u1ea1ng<\/code> thu\u1ed9c t\u00ednh.<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">D2<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpdjkEKwjAQRfeB3OFTN7rwAlm40CwVWuIFpu1YB2JakigU8e4SKELdvv\/g\/Q0s3yRIGODuNDGu88RJq5MXDtngrRWQymIwcUxj0OqjVRHGZw\/H8SUdp7XYlW3xLiQB9vgnzF5Cz7EgTy17g6qO8qA4w1KmlhJjW48pD5Fdc95Vv2q5hf0B634hS+kLMeE\/Sw==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda D2 trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">D2<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpTVog4vDBZ4cjEh7u78zIUsjMf7m4uVcg4vAbISXm4a2FeOi+XdwZQSQZQcEFeupVCNS+XAooCK4W89GMbHu6em8nLVcvLxcvlAjQLqL7s4e6lQIMPL8xVyD28qBKrToQ0VK\/zsYUKxQ93zweq2L1eIQfonPZSheSMw2vzMrAaAOGVFAHtAknmZRxenGeloITHGAWNgPzikvSi1OBAH00lqLXIXlTQtVPA7gWQDB6TASf7kO8=\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-d2\"><code class=\"language-d2\" data-language=\"d2\" class=\"language-d2\"># X\u00e1c \u0111\u1ecbnh ki\u1ec3u h\u00ecnh d\u1ea1ng\r\nKh\u00e1ch h\u00e0ng: {\r\n  h\u00ecnh d\u1ea1ng: ng\u01b0\u1eddi\r\n}\r\n\r\nD\u1ecbch v\u1ee5 \u0111\u00e1m m\u00e2y: {\r\n  h\u00ecnh d\u1ea1ng: \u0111\u00e1m m\u00e2y\r\n}\r\n\r\nC\u01a1 s\u1edf d\u1eef li\u1ec7u ch\u00ednh: {\r\n  h\u00ecnh d\u1ea1ng: h\u00ecnh tr\u1ee5\r\n  nh\u00e3n: \"C\u01a1 s\u1edf d\u1eef li\u1ec7u ch\u00ednh (PostgreSQL)\"\r\n}\r\n\r\nKh\u00e1ch h\u00e0ng -&gt; D\u1ecbch v\u1ee5 \u0111\u00e1m m\u00e2y -&gt; C\u01a1 s\u1edf d\u1eef li\u1ec7u ch\u00ednh<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpTVog4vDBZ4cjEh7u78zIUsjMf7m4uVcg4vAbISXm4a2FeOi+XdwZQSQZQcEFeupVCNS+XAooCK4W89GMbHu6em8nLVcvLxcvlAjQLqL7s4e6lQIMPL8xVyD28qBKrToQ0VK\/zsYUKxQ93zweq2L1eIQfonPZSheSMw2vzMrAaAOGVFAHtAknmZRxenGeloITHGAWNgPzikvSi1OBAH00lqLXIXlTQtVPA7gWQDB6TASf7kO8=\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpdjkEKwjAQRfeB3OFTN7rwAlm40CwVWuIFpu1YB2JakigU8e4SKELdvv\/g\/Q0s3yRIGODuNDGu88RJq5MXDtngrRWQymIwcUxj0OqjVRHGZw\/H8SUdp7XYlW3xLiQB9vgnzF5Cz7EgTy17g6qO8qA4w1KmlhJjW48pD5Fdc95Vv2q5hf0B634hS+kLMeE\/Sw==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda D2 trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"GQAkWLQ\"><img alt=\"D2 custom shapes showing person, cloud, and database cylinder icons linked in sequence - Text to diagram editor - VPasCode\" class=\"alignnone wp-image-1924 size-full\" decoding=\"async\" height=\"670\" sizes=\"(max-width: 470px) 100vw, 470px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d444e3dd.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d444e3dd.png 470w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d444e3dd-210x300.png 210w\" width=\"470\"\/><\/p>\n<h2 style=\"font-size: 1.5rem; font-weight: bold; color: #1f2937; margin-top: 2rem; margin-bottom: 1rem; border-left: 4px solid #4f46e5; padding-left: 0.75rem;\">3. \u0110\u1ecbnh ngh\u0129a l\u1edbp<\/h2>\n<p>D2 h\u1ed7 tr\u1ee3 t\u00edch h\u1ee3p thi\u1ebft k\u1ebf c\u1ea5u tr\u00fac h\u01b0\u1edbng \u0111\u1ed1i t\u01b0\u1ee3ng b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng <code>l\u1edbp<\/code> h\u00ecnh d\u1ea1ng.<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">D2<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpFyTsKgDAMANC90Dtk1Ctkq07OniC0QQP9SFNdxLtLcXB9bz61lcTVeV\/O3BBuawB0p4MRfCRVa7rQ90tAWFuVvHXkRBJdCJVVf+8j6nyTi4cRYSolMmVrnheKDyJB\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda D2 trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">D2<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNoLObwgUyE7I\/\/hrsV53hmHFyZnKGQcXpCXbqVQzculAGSvyctQSHm4ayFIKOfh7tkFvFwgicTk5PzSvBLPFCsF54zSh7unZ4JEU3MTM3McU1KKUouLkSRAUpnFjsklmWWpGppWCk75+TmpiXm8XLUA1+gvqg==\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-d2\"><code class=\"language-d2\" data-language=\"d2\" class=\"language-d2\">T\u00e0i kho\u1ea3nKh\u00e1ch h\u00e0ng: {\r\n  h\u00ecnh d\u1ea1ng: l\u1edbp\r\n\r\n  accountId: Chu\u1ed7i\r\n  emailAddress: Chu\u1ed7i\r\n\r\n  isActive(): Boolean\r\n}<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNoLObwgUyE7I\/\/hrsV53hmHFyZnKGQcXpCXbqVQzculAGSvyctQSHm4ayFIKOfh7tkFvFwgicTk5PzSvBLPFCsF54zSh7unZ4JEU3MTM3McU1KKUouLkSRAUpnFjsklmWWpGppWCk75+TmpiXm8XLUA1+gvqg==\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpFyTsKgDAMANC90Dtk1Ctkq07OniC0QQP9SFNdxLtLcXB9bz61lcTVeV\/O3BBuawB0p4MRfCRVa7rQ90tAWFuVvHXkRBJdCJVVf+8j6nyTi4cRYSolMmVrnheKDyJB\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda D2 trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"xQUTaiD\"><img alt=\"D2 class diagram displaying CustomerAccount properties and isActive method - Text to diagram editor - VPasCode\" class=\"alignnone wp-image-1925 size-full\" decoding=\"async\" height=\"432\" sizes=\"(max-width: 522px) 100vw, 522px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d4d8bc24.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d4d8bc24.png 522w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d4d8bc24-300x248.png 300w\" width=\"522\"\/><\/p>\n<h2 style=\"font-size: 1.5rem; font-weight: bold; color: #1f2937; margin-top: 2rem; margin-bottom: 1rem; border-left: 4px solid #4f46e5; padding-left: 0.75rem;\">4. C\u00e1c container l\u1ed3ng gh\u00e9p (nh\u00f3m)<\/h2>\n<p>D2 gi\u00fap vi\u1ec7c nh\u00f3m c\u00e1c m\u1ee5c l\u1ea1i v\u1edbi nhau b\u00ean trong c\u00e1c container tr\u1edf n\u00ean d\u1ec5 d\u00e0ng b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng d\u1ea5u ngo\u1eb7c nh\u1ecdn chu\u1ea9n (&#8220;<code>{}<\/code>). B\u1ea1n c\u0169ng c\u00f3 th\u1ec3 k\u1ebft n\u1ed1i c\u00e1c ph\u1ea7n t\u1eed gi\u1eefa c\u00e1c nh\u00f3m kh\u00e1c nhau b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng k\u00fd hi\u1ec7u d\u1ea5u ch\u1ea5m.<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">D2<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNptj8EKgkAQhu8L+w4DnvUBOgQmJR6k0HqAYZ1sSWZlXJOI3j03OlR4nOH\/5v8mglzc2FtuYbL+Apljj5ZJBq12Mg\/EDaR931mD3jpewUMrgIrQeDgVEK+h9ugJSmRsSbR6aqXVBs01kAWfBQcvo\/Gj0AdODwXkMzPhPfDpOPeW1ogbSG7W0EJmLw3JX+hdFEE2r4a4DV+AccxkgueyffLjGg4viyZf9SuotvURMuy6FxZ4Y5w=\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda D2 trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">D2<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNqNkLFKA0EQhvuFe4cfUpsHSCFo1CCCaLSwXfaO2yVmAueaRqwtRNDCykIXCdqJaHWDWKzkPeZN3EUhVcRqYOaff\/5vOti18W2MqfCdg4nBwEzIa0dVUyjhZ6pRCs9S2WrSoKKyh7NCAQOnJyid8AVhWGnjsbKK\/VNpHwnH8QO+kTakNW9jcIU6L1Sh+vOAE+F72DSDl\/YpCda1GS1s+8K3qbm2t539NoQvjc3pZpg6jOM7jnJGb4Vfzb\/0X9fzQLDxgerfFB3sSPvpQcI3DnVCeNE\/6JR\/sQS7u4wt3\/0LrLuI2MNA+MphuHlw+A2lsKGj\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-d2\"><code class=\"language-d2\" data-language=\"d2\" class=\"language-d2\"># Nh\u00f3m v\u1edbi c\u00e1c container\r\n\u1ee8ng d\u1ee5ng Frontend: {\r\n  Giao di\u1ec7n React -&gt; Qu\u1ea3n l\u00fd tr\u1ea1ng th\u00e1i\r\n}\r\n\r\nC\u01a1 s\u1edf h\u1ea1 t\u1ea7ng Backend: {\r\n  C\u1ed5ng API -&gt; D\u1ecbch v\u1ee5 vi m\u00f4 X\u00e1c th\u1ef1c\r\n  C\u1ed5ng API -&gt; D\u1ecbch v\u1ee5 vi m\u00f4 \u0110\u01a1n h\u00e0ng\r\n}\r\n\r\n# K\u1ebft n\u1ed1i gi\u1eefa c\u00e1c nh\u00f3m\r\n\u1ee8ng d\u1ee5ng Frontend.Qu\u1ea3n l\u00fd tr\u1ea1ng th\u00e1i -&gt; C\u01a1 s\u1edf h\u1ea1 t\u1ea7ng Backend.C\u1ed5ng API: G\u1ecdi REST<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNqNkLFKA0EQhvuFe4cfUpsHSCFo1CCCaLSwXfaO2yVmAueaRqwtRNDCykIXCdqJaHWDWKzkPeZN3EUhVcRqYOaff\/5vOti18W2MqfCdg4nBwEzIa0dVUyjhZ6pRCs9S2WrSoKKyh7NCAQOnJyid8AVhWGnjsbKK\/VNpHwnH8QO+kTakNW9jcIU6L1Sh+vOAE+F72DSDl\/YpCda1GS1s+8K3qbm2t539NoQvjc3pZpg6jOM7jnJGb4Vfzb\/0X9fzQLDxgerfFB3sSPvpQcI3DnVCeNE\/6JR\/sQS7u4wt3\/0LrLuI2MNA+MphuHlw+A2lsKGj\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNptj8EKgkAQhu8L+w4DnvUBOgQmJR6k0HqAYZ1sSWZlXJOI3j03OlR4nOH\/5v8mglzc2FtuYbL+Apljj5ZJBq12Mg\/EDaR931mD3jpewUMrgIrQeDgVEK+h9ugJSmRsSbR6aqXVBs01kAWfBQcvo\/Gj0AdODwXkMzPhPfDpOPeW1ogbSG7W0EJmLw3JX+hdFEE2r4a4DV+AccxkgueyffLjGg4viyZf9SuotvURMuy6FxZ4Y5w=\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda D2 trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"XvKRcme\"><img loading=\"lazy\" alt=\"D2 nested containers grouping Frontend Application and Backend Infrastructure modules - Text to diagram editor - VPasCode\" class=\"alignnone wp-image-1926 size-full\" decoding=\"async\" height=\"987\" loading=\"lazy\" sizes=\"auto, (max-width: 674px) 100vw, 674px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d5828bfa.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d5828bfa.png 674w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d5828bfa-205x300.png 205w\" width=\"674\"\/><\/p>\n<h2 style=\"font-size: 1.5rem; font-weight: bold; color: #1f2937; margin-top: 2rem; margin-bottom: 1rem; border-left: 4px solid #4f46e5; padding-left: 0.75rem;\">5. \u0110\u1ecbnh d\u1ea1ng &amp; M\u00e0u s\u1eafc<\/h2>\n<p>C\u00e1c m\u00e0u n\u1ec1n t\u00f9y ch\u1ec9nh, m\u00e0u vi\u1ec1n v\u00e0 ki\u1ec3u ch\u1eef c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c t\u00f9y ch\u1ec9nh tr\u1ef1c ti\u1ebfp trong kh\u1ed1i b\u1eb1ng c\u00e1ch s\u1eed d\u1ee5ng t\u1eeb kh\u00f3a<code>style<\/code>t\u1eeb kh\u00f3a.<\/p>\n<div class=\"vpascode-viewer-container vpascode-fancy-active\">\n<div class=\"vpascode-header\">\n<span class=\"vpascode-lang-label\">D2<\/span><br \/>\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNoLTi0qy0xOVXC0Uqjm5VJQKC6pzEmFshUU0jJzcqwUlJRTDVLN09KUIILFJUX52akgYRNjY4vkRKhwUn5RSmqRblFiSmZpsZWCBUi0lpcLiHi5gqG2OOG1JS01zTjZHMOWFEtzcwMzJWzmOSro2ikgGR6cmpei4JtaXJyYngoAKgc5Cw==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 8px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda D2 trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<div class=\"vpascode-code-wrapper\">\n            <div class=\"vpascode-viewer-container vpascode-fancy-active\">\r\n                                <div class=\"vpascode-header\">\r\n                    <span class=\"vpascode-lang-label\">D2<\/span>\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpzebi7OzlDoezh7qUKjlYK1bxcCgrFJZU5qVC2gkJaZk6OlYKScqpBqnlamhJEsLikKD87FSRsYmxskZwIFU7KL0pJLdItSkzJLC22UrAAidbycgERL5cLkk1OeG1KS00zTjbHsCnF0tzcwEwJl5mOCrp2CmiWuD\/cvTZToSQzTyEv4+Gu9XkAgndJng==\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 8px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n                                <div class=\"vpascode-code-wrapper\">\r\n                    <pre class=\"lang-d2\"><code class=\"language-d2\" data-language=\"d2\" class=\"language-d2\">D\u1ecbch v\u1ee5 A: {\r\n  style: {\r\n    fill: \"#e0e7ff\"\r\n    stroke: \"#4338ca\"\r\n    border-radius: 8\r\n  }\r\n}\r\n\r\nD\u1ecbch v\u1ee5 B: {\r\n  style: {\r\n    fill: \"#fef3c7\"\r\n    stroke: \"#d97706\"\r\n  }\r\n}\r\n\r\nD\u1ecbch v\u1ee5 A -&gt; D\u1ecbch v\u1ee5 B: G\u1eedi tin nh\u1eafn<\/code><\/pre>                <\/div>\r\n                <div class=\"vpascode-actions\">\r\n                    <a href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNpzebi7OzlDoezh7qUKjlYK1bxcCgrFJZU5qVC2gkJaZk6OlYKScqpBqnlamhJEsLikKD87FSRsYmxskZwIFU7KL0pJLdItSkzJLC22UrAAidbycgERL5cLkk1OeG1KS00zTjbHsCnF0tzcwEwJl5mOCrp2CmiWuD\/cvTZToSQzTyEv4+Gu9XkAgndJng==\" \r\n                       target=\"_blank\" \r\n                       rel=\"noopener noreferrer\" \r\n                       class=\"vpascode-fancy-btn\">\r\n                        <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" style=\"margin-right: 6px;\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg>\r\n                        <span>Edit D2 in VPasCode<\/span>\r\n                    <\/a>\r\n                <\/div>\r\n            <\/div>\r\n            \n<\/p><\/div>\n<div class=\"vpascode-actions\">\n<a class=\"vpascode-fancy-btn\" href=\"https:\/\/www.vpascode.com\/editor\/#d2:eNoLTi0qy0xOVXC0Uqjm5VJQKC6pzEmFshUU0jJzcqwUlJRTDVLN09KUIILFJUX52akgYRNjY4vkRKhwUn5RSmqRblFiSmZpsZWCBUi0lpcLiHi5gqG2OOG1JS01zTjZHMOWFEtzcwMzJWzmOSro2ikgGR6cmpei4JtaXJyYngoAKgc5Cw==\" rel=\"noopener noreferrer\" target=\"_blank\"><br \/>\n<svg fill=\"none\" height=\"14\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"2.5\" style=\"margin-right: 6px;\" viewbox=\"0 0 24 24\" width=\"14\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"><\/path><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"><\/path><\/svg><br \/>\n<span>Ch\u1ec9nh s\u1eeda D2 trong VPasCode<\/span><br \/>\n<\/a>\n<\/div>\n<\/div>\n<p id=\"ZKCxIsS\"><img loading=\"lazy\" alt=\"D2 styled blocks showing custom background colors and border styles for Service A and Service B - Text to diagram editor - VPasCode\" class=\"alignnone wp-image-1927 size-full\" decoding=\"async\" height=\"455\" loading=\"lazy\" sizes=\"auto, (max-width: 313px) 100vw, 313px\" src=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d6582049.png\" srcset=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d6582049.png 313w, https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d6582049-206x300.png 206w\" width=\"313\"\/><\/p>\n<h2 style=\"font-size: 1.5rem; font-weight: bold; color: #1f2937; margin-top: 2rem; margin-bottom: 1rem; border-left: 4px solid #4f46e5; padding-left: 0.75rem;\">6. B\u1ea3ng ghi nh\u1edb c\u00fa ph\u00e1p nhanh<\/h2>\n<table style=\"width: 100%; border-collapse: collapse; margin-bottom: 1.5rem;\">\n<thead>\n<tr style=\"background-color: #f9fafb;\">\n<th style=\"border: 1px solid #e5e7eb; padding: 0.75rem; text-align: left;\">Kh\u00e1i ni\u1ec7m<\/th>\n<th style=\"border: 1px solid #e5e7eb; padding: 0.75rem; text-align: left;\">V\u00ed d\u1ee5 m\u00e3 code<\/th>\n<th style=\"border: 1px solid #e5e7eb; padding: 0.75rem; text-align: left;\">N\u00f3 l\u00e0m g\u00ec<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><strong>K\u1ebft n\u1ed1i c\u00f3 h\u01b0\u1edbng<\/strong><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><code>A -&gt; B<\/code><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\">V\u1ebd m\u1ed9t m\u0169i t\u00ean ch\u1ec9 t\u1eeb A \u0111\u1ebfn B.<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><strong>Nh\u00e3n \u0111\u01b0\u1eddng n\u1ed1i<\/strong><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><code>A -&gt; B: G\u1eedi d\u1eef li\u1ec7u<\/code><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\">Th\u00eam v\u0103n b\u1ea3n l\u00ean tr\u00ean m\u0169i t\u00ean k\u1ebft n\u1ed1i.<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><strong>M\u0169i t\u00ean hai chi\u1ec1u<\/strong><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><code>A &lt;-&gt; B<\/code><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\">V\u1ebd m\u1ed9t m\u0169i t\u00ean ch\u1ec9 theo c\u1ea3 hai h\u01b0\u1edbng.<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><strong>C\u00e1c container \/ Nh\u00f3m<\/strong><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><code>M\u00e1y ch\u1ee7: { ... }<\/code><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\">Gom nhi\u1ec1u h\u00ecnh d\u1ea1ng th\u00e0nh m\u1ed9t h\u1ed9p duy nh\u1ea5t.<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><strong>Ch\u1ecdn h\u00ecnh d\u1ea1ng<\/strong><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><code>h\u00ecnh d\u1ea1ng: h\u00ecnh tr\u1ee5<\/code><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\">Thay \u0111\u1ed5i h\u1ed9p ti\u00eau chu\u1ea9n th\u00e0nh bi\u1ec3u t\u01b0\u1ee3ng c\u01a1 s\u1edf d\u1eef li\u1ec7u, con ng\u01b0\u1eddi, \u0111\u00e1m m\u00e2y, l\u1edbp, v.v.<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><strong>Ghi ch\u00fa<\/strong><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\"><code># Ghi ch\u00fa c\u1ee7a t\u00f4i<\/code><\/td>\n<td style=\"border: 1px solid #e5e7eb; padding: 0.75rem;\">C\u00e1c ghi ch\u00fa m\u1ed9t d\u00f2ng s\u1ebd b\u1ecb b\u1ecf qua trong qu\u00e1 tr\u00ecnh hi\u1ec3n th\u1ecb.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>D2 l\u00e0 m\u1ed9t c\u00f4ng c\u1ee5 hi\u1ec7n \u0111\u1ea1i d\u1ef1a tr\u00ean v\u0103n b\u1ea3n \u0111\u1ec3 t\u1ea1o ra c\u00e1c s\u01a1 \u0111\u1ed3 r\u00f5 r\u00e0ng, d\u1ec5 \u0111\u1ecdc. D2 l\u00e0 vi\u1ebft t\u1eaft c\u1ee7a \u201cS\u01a1 \u0111\u1ed3 khai b\u00e1o\u201d. Trong VPasCode, D2 cho ph\u00e9p c\u00e1c nh\u00e0 ph\u00e1t tri\u1ec3n ph\u1ea7n&#8230;<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":0,"menu_order":0,"template":"","meta":{"inline_featured_image":false,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}}},"ld_collection":[14],"class_list":["post-2017","ld_docs","type-ld_docs","status-publish","hentry","ld_collection-vpascode-docs"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>D2 Syntax | Text to diagram tool - VPasCode<\/title>\n<meta name=\"description\" content=\"Master D2 declarative diagramming in VPasCode. Easily build cloud architecture diagrams, ERDs, and workflow charts directly from simple code snippets.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"D2 Syntax | Text to diagram tool - VPasCode\" \/>\n<meta property=\"og:description\" content=\"Master D2 declarative diagramming in VPasCode. Easily build cloud architecture diagrams, ERDs, and workflow charts directly from simple code snippets.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/\" \/>\n<meta property=\"og:site_name\" content=\"VPasCode\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 ph\u00fat\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/\",\"name\":\"D2 Syntax | Text to diagram tool - VPasCode\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.vpascode.com\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/img_6a742d37a7527.png\",\"datePublished\":\"2026-08-06T06:15:46+00:00\",\"description\":\"Master D2 declarative diagramming in VPasCode. Easily build cloud architecture diagrams, ERDs, and workflow charts directly from simple code snippets.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/#breadcrumb\"},\"inLanguage\":\"vi\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/img_6a742d37a7527.png\",\"contentUrl\":\"https:\\\/\\\/www.vpascode.com\\\/wp-content\\\/uploads\\\/2026\\\/08\\\/img_6a742d37a7527.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/vpascode-docs\\\/d2-playbook\\\/d2-syntax-basics\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Lean Docs\",\"item\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/docs\\\/%ld_collection%\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"C\u00e1c kh\u00e1i ni\u1ec7m c\u01a1 b\u1ea3n v\u1ec1 c\u00fa ph\u00e1p D2\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/#website\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/\",\"name\":\"VPasCode\",\"description\":\"by Visual Paradigm\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"vi\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/#organization\",\"name\":\"VPasCode\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"vi\",\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/wp-content\\\/uploads\\\/sites\\\/12\\\/2026\\\/06\\\/cropped-vp-online-logo-v1.png\",\"contentUrl\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/wp-content\\\/uploads\\\/sites\\\/12\\\/2026\\\/06\\\/cropped-vp-online-logo-v1.png\",\"width\":128,\"height\":138,\"caption\":\"VPasCode\"},\"image\":{\"@id\":\"https:\\\/\\\/www.vpascode.com\\\/vn\\\/#\\\/schema\\\/logo\\\/image\\\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"D2 Syntax | Text to diagram tool - VPasCode","description":"Master D2 declarative diagramming in VPasCode. Easily build cloud architecture diagrams, ERDs, and workflow charts directly from simple code snippets.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/","og_locale":"vi_VN","og_type":"article","og_title":"D2 Syntax | Text to diagram tool - VPasCode","og_description":"Master D2 declarative diagramming in VPasCode. Easily build cloud architecture diagrams, ERDs, and workflow charts directly from simple code snippets.","og_url":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/","og_site_name":"VPasCode","og_image":[{"url":"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"3 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/","url":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/","name":"D2 Syntax | Text to diagram tool - VPasCode","isPartOf":{"@id":"https:\/\/www.vpascode.com\/vn\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/#primaryimage"},"image":{"@id":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/#primaryimage"},"thumbnailUrl":"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527.png","datePublished":"2026-08-06T06:15:46+00:00","description":"Master D2 declarative diagramming in VPasCode. Easily build cloud architecture diagrams, ERDs, and workflow charts directly from simple code snippets.","breadcrumb":{"@id":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/"]}]},{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/#primaryimage","url":"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527.png","contentUrl":"https:\/\/www.vpascode.com\/wp-content\/uploads\/2026\/08\/img_6a742d37a7527.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.vpascode.com\/vn\/docs\/vpascode-docs\/d2-playbook\/d2-syntax-basics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vpascode.com\/vn\/"},{"@type":"ListItem","position":2,"name":"Lean Docs","item":"https:\/\/www.vpascode.com\/vn\/docs\/%ld_collection%\/"},{"@type":"ListItem","position":3,"name":"C\u00e1c kh\u00e1i ni\u1ec7m c\u01a1 b\u1ea3n v\u1ec1 c\u00fa ph\u00e1p D2"}]},{"@type":"WebSite","@id":"https:\/\/www.vpascode.com\/vn\/#website","url":"https:\/\/www.vpascode.com\/vn\/","name":"VPasCode","description":"by Visual Paradigm","publisher":{"@id":"https:\/\/www.vpascode.com\/vn\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vpascode.com\/vn\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"vi"},{"@type":"Organization","@id":"https:\/\/www.vpascode.com\/vn\/#organization","name":"VPasCode","url":"https:\/\/www.vpascode.com\/vn\/","logo":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/www.vpascode.com\/vn\/#\/schema\/logo\/image\/","url":"https:\/\/www.vpascode.com\/vn\/wp-content\/uploads\/sites\/12\/2026\/06\/cropped-vp-online-logo-v1.png","contentUrl":"https:\/\/www.vpascode.com\/vn\/wp-content\/uploads\/sites\/12\/2026\/06\/cropped-vp-online-logo-v1.png","width":128,"height":138,"caption":"VPasCode"},"image":{"@id":"https:\/\/www.vpascode.com\/vn\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/www.vpascode.com\/vn\/wp-json\/wp\/v2\/ld_docs\/2017","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vpascode.com\/vn\/wp-json\/wp\/v2\/ld_docs"}],"about":[{"href":"https:\/\/www.vpascode.com\/vn\/wp-json\/wp\/v2\/types\/ld_docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.vpascode.com\/vn\/wp-json\/wp\/v2\/users\/3"}],"wp:attachment":[{"href":"https:\/\/www.vpascode.com\/vn\/wp-json\/wp\/v2\/media?parent=2017"}],"wp:term":[{"taxonomy":"ld_collection","embeddable":true,"href":"https:\/\/www.vpascode.com\/vn\/wp-json\/wp\/v2\/ld_collection?post=2017"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}