topfans/docs/backend-architecture.drawio
2026-04-07 22:28:50 +08:00

252 lines
17 KiB
Plaintext

<mxGraphModel dx="1422" dy="800" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="1400" pageHeight="1000" math="0" shadow="0" defaultFontFamily="Noto Sans JP" defaultFontSize="14">
<root>
<mxCell id="0" />
<mxCell id="1" parent="0" />
<!-- Title -->
<mxCell id="title" value="TopFans Backend Microservice Architecture" style="text;html=1;fontSize=24;fontFamily=Noto Sans JP;fontStyle=1" vertex="1" parent="1">
<mxGeometry x="400" width="600" y="20" height="40" as="geometry" />
</mxCell>
<!-- ==================== Gateway Layer ==================== -->
<mxCell id="gateway_box" value="" style="rounded=1;strokeWidth=3;fillColor=#dae8fc;strokeColor=#6c8ebf;" vertex="1" parent="1">
<mxGeometry x="40" y="80" width="280" height="200" as="geometry" />
</mxCell>
<mxCell id="gateway_label" value="API Gateway Layer" style="text;html=1;fontSize=18;fontFamily=Noto Sans JP;fontStyle=1" vertex="1" parent="1">
<mxGeometry x="100" y="90" width="160" height="30" as="geometry" />
</mxCell>
<mxCell id="gateway" value="Gin HTTP Server" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="60" y="130" width="140" height="50" as="geometry" />
</mxCell>
<mxCell id="gateway_port" value="Port: 8080" style="text;html=1;fontSize=14;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="60" y="190" width="140" height="25" as="geometry" />
</mxCell>
<mxCell id="gateway_func" value="• HTTP Request/Response&#xa;• JWT Authentication&#xa;• Request Routing&#xa;• Swagger Docs" style="text;html=1;align=left;verticalAlign=top;spacingLeft=10;fontSize=12;fontFamily=Noto Sans JP;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="210" y="130" width="100" height="130" as="geometry" />
</mxCell>
<!-- ==================== Services Layer ==================== -->
<mxCell id="services_box" value="" style="rounded=1;strokeWidth=3;fillColor=#d5e8d4;strokeColor=#82b366;" vertex="1" parent="1">
<mxGeometry x="380" y="80" width="920" height="200" as="geometry" />
</mxCell>
<mxCell id="services_label" value="Microservices Layer (Dubbo-go)" style="text;html=1;fontSize=18;fontFamily=Noto Sans JP;fontStyle=1" vertex="1" parent="1">
<mxGeometry x="600" y="90" width="280" height="30" as="geometry" />
</mxCell>
<!-- User Service -->
<mxCell id="user_service" value="User Service" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="400" y="130" width="130" height="60" as="geometry" />
</mxCell>
<mxCell id="user_port" value=":20000" style="text;html=1;fontSize=12;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="400" y="195" width="60" height="20" as="geometry" />
</mxCell>
<mxCell id="user_func" value="• Register/Login&#xa;• User Info&#xa;• Fan Identity&#xa;• Password" style="text;html=1;align=left;verticalAlign=top;spacingLeft=5;fontSize=11;fontFamily=Noto Sans JP;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="540" y="135" width="90" height="70" as="geometry" />
</mxCell>
<!-- Gallery Service -->
<mxCell id="gallery_service" value="Gallery Service" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="650" y="130" width="130" height="60" as="geometry" />
</mxCell>
<mxCell id="gallery_port" value=":20001" style="text;html=1;fontSize=12;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="650" y="195" width="60" height="20" as="geometry" />
</mxCell>
<mxCell id="gallery_func" value="• My Gallery&#xa;• Booth Slots&#xa;• Exhibitions&#xa;• Visit Friend" style="text;html=1;align=left;verticalAlign=top;spacingLeft=5;fontSize=11;fontFamily=Noto Sans JP;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="790" y="135" width="100" height="70" as="geometry" />
</mxCell>
<!-- Social Service -->
<mxCell id="social_service" value="Social Service" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="910" y="130" width="130" height="60" as="geometry" />
</mxCell>
<mxCell id="social_port" value=":20002" style="text;html=1;fontSize=12;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="910" y="195" width="60" height="20" as="geometry" />
</mxCell>
<mxCell id="social_func" value="• Friends&#xa;• Friend Request&#xa;• User Search&#xa;• Likes" style="text;html=1;align=left;verticalAlign=top;spacingLeft=5;fontSize=11;fontFamily=Noto Sans JP;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="1050" y="135" width="90" height="70" as="geometry" />
</mxCell>
<!-- Asset Service -->
<mxCell id="asset_service" value="Asset Service" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="1160" y="130" width="130" height="60" as="geometry" />
</mxCell>
<mxCell id="asset_port" value=":20003" style="text;html=1;fontSize=12;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="1160" y="195" width="60" height="20" as="geometry" />
</mxCell>
<mxCell id="asset_func" value="• Minting&#xa;• Assets&#xa;• OSS Upload&#xa;• Likes" style="text;html=1;align=left;verticalAlign=top;spacingLeft=5;fontSize=11;fontFamily=Noto Sans JP;whiteSpace=wrap;" vertex="1" parent="1">
<mxGeometry x="1020" y="215" width="90" height="60" as="geometry" />
</mxCell>
<!-- ==================== Common Layer ==================== -->
<mxCell id="common_box" value="" style="rounded=1;strokeWidth=3;fillColor=#f8cecc;strokeColor=#b85450;" vertex="1" parent="1">
<mxGeometry x="380" y="320" width="920" height="140" as="geometry" />
</mxCell>
<mxCell id="common_label" value="Common Layer" style="text;html=1;fontSize=18;fontFamily=Noto Sans JP;fontStyle=1" vertex="1" parent="1">
<mxGeometry x="620" y="330" width="140" height="30" as="geometry" />
</mxCell>
<!-- Database -->
<mxCell id="database" value="PostgreSQL" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=10;fillColor=#fff2cc;strokeColor=#d6b656;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="420" y="360" width="100" height="80" as="geometry" />
</mxCell>
<!-- JWT -->
<mxCell id="jwt" value="JWT Auth" style="shape=process;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="560" y="375" width="90" height="50" as="geometry" />
</mxCell>
<!-- Logger -->
<mxCell id="logger" value="Uber Zap&#xa;Logger" style="shape=process;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="690" y="375" width="90" height="50" as="geometry" />
</mxCell>
<!-- GORM -->
<mxCell id="gorm" value="GORM&#xa;ORM" style="shape=process;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="820" y="375" width="90" height="50" as="geometry" />
</mxCell>
<!-- Dubbo -->
<mxCell id="dubbo" value="Dubbo Triple&#xa;Protocol" style="shape=process;whiteSpace=wrap;html=1;fillColor=#f8cecc;strokeColor=#b85450;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="950" y="375" width="100" height="50" as="geometry" />
</mxCell>
<!-- Swagger -->
<mxCell id="swagger" value="Swagger&#xa;API Docs" style="shape=process;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="1090" y="375" width="90" height="50" as="geometry" />
</mxCell>
<!-- ==================== Data Models ==================== -->
<mxCell id="models_box" value="" style="rounded=1;strokeWidth=3;fillColor=#ffe6cc;strokeColor=#d79b00;" vertex="1" parent="1">
<mxGeometry x="40" y="320" width="280" height="140" as="geometry" />
</mxCell>
<mxCell id="models_label" value="Data Models" style="text;html=1;fontSize=18;fontFamily=Noto Sans JP;fontStyle=1" vertex="1" parent="1">
<mxGeometry x="110" y="330" width="140" height="30" as="geometry" />
</mxCell>
<mxCell id="model_user" value="User" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Noto Sans JP;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="60" y="370" width="80" height="30" as="geometry" />
</mxCell>
<mxCell id="model_fan" value="FanProfile" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Noto Sans JP;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="150" y="370" width="80" height="30" as="geometry" />
</mxCell>
<mxCell id="model_star" value="Star" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Noto Sans JP;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="240" y="370" width="60" height="30" as="geometry" />
</mxCell>
<mxCell id="model_booth" value="BoothSlot" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontFamily=Noto Sans JP;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="60" y="410" width="80" height="30" as="geometry" />
</mxCell>
<mxCell id="model_exhibition" value="Exhibition" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#d5e8d4;strokeColor=#82b366;fontFamily=Noto Sans JP;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="150" y="410" width="80" height="30" as="geometry" />
</mxCell>
<mxCell id="model_friend" value="Friendship" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e1d5e7;strokeColor=#9673a6;fontFamily=Noto Sans JP;fontSize=12;" vertex="1" parent="1">
<mxGeometry x="240" y="410" width="60" height="30" as="geometry" />
</mxCell>
<!-- ==================== External Clients ==================== -->
<mxCell id="client_box" value="" style="rounded=1;strokeWidth=3;fillColor=#e6e6e6;strokeColor=#666666;" vertex="1" parent="1">
<mxGeometry x="40" y="500" width="280" height="100" as="geometry" />
</mxCell>
<mxCell id="client_label" value="External Clients" style="text;html=1;fontSize=18;fontFamily=Noto Sans JP;fontStyle=1" vertex="1" parent="1">
<mxGeometry x="100" y="510" width="160" height="30" as="geometry" />
</mxCell>
<mxCell id="mobile_client" value="Mobile App" style="shape=mobile;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="60" y="550" width="80" height="40" as="geometry" />
</mxCell>
<mxCell id="web_client" value="Web App" style="shape=rx;whiteSpace=wrap;html=1;fillColor=#fff2cc;strokeColor=#d6b656;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="160" y="550" width="80" height="40" as="geometry" />
</mxCell>
<!-- ==================== OSS ==================== -->
<mxCell id="oss_box" value="" style="rounded=1;strokeWidth=3;fillColor=#e6e6e6;strokeColor=#666666;" vertex="1" parent="1">
<mxGeometry x="380" y="500" width="200" height="100" as="geometry" />
</mxCell>
<mxCell id="oss_label" value="External Services" style="text;html=1;fontSize=18;fontFamily=Noto Sans JP;fontStyle=1" vertex="1" parent="1">
<mxGeometry x="420" y="510" width="160" height="30" as="geometry" />
</mxCell>
<mxCell id="oss" value="OSS (Aliyun)" style="shape=cylinder3;whiteSpace=wrap;html=1;boundedLbl=1;backgroundOutline=1;size=10;fillColor=#dae8fc;strokeColor=#6c8ebf;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="420" y="545" width="100" height="45" as="geometry" />
</mxCell>
<!-- ==================== Arrows ==================== -->
<!-- Client to Gateway -->
<mxCell id="arrow1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;strokeColor=#333333;" edge="1" parent="1" source="mobile_client" target="gateway">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="arrow1_label" value="HTTP" style="text;html=1;align=center;verticalAlign=bottom;spacingLeft=-10;fontSize=11;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="170" y="340" width="40" height="20" as="geometry" />
</mxCell>
<!-- Gateway to Services -->
<mxCell id="arrow2" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;strokeColor=#333333;dashed=1;" edge="1" parent="1" source="gateway" target="user_service">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="arrow2_label" value="Dubbo RPC" style="text;html=1;align=center;verticalAlign=bottom;spacingLeft=-10;fontSize=11;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="270" y="115" width="80" height="20" as="geometry" />
</mxCell>
<!-- Services to Common Layer -->
<mxCell id="arrow3" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;strokeColor=#333333;" edge="1" parent="1" source="user_service" target="database">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="arrow3_label" value="SQL" style="text;html=1;align=center;verticalAlign=bottom;spacingLeft=-10;fontSize=11;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="350" y="300" width="30" height="20" as="geometry" />
</mxCell>
<!-- Service to OSS -->
<mxCell id="arrow4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;strokeColor=#333333;dashed=1;" edge="1" parent="1" source="asset_service" target="oss">
<mxGeometry relative="1" as="geometry" />
</mxCell>
<mxCell id="arrow4_label" value="Upload" style="text;html=1;align=center;verticalAlign=bottom;spacingLeft=-10;fontSize=11;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="580" y="520" width="50" height="20" as="geometry" />
</mxCell>
<!-- Service Communication Arrows -->
<mxCell id="arrow5" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;strokeColor=#9673a6;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="530" y="160" as="sourcePoint"/>
<mxPoint x="650" y="160" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="arrow5_label" value="RPC" style="text;html=1;align=center;verticalAlign=bottom;spacingLeft=-10;fontSize=10;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="575" y="140" width="30" height="20" as="geometry" />
</mxCell>
<mxCell id="arrow6" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;strokeColor=#9673a6;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="780" y="160" as="sourcePoint"/>
<mxPoint x="910" y="160" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="arrow6_label" value="RPC" style="text;html=1;align=center;verticalAlign=bottom;spacingLeft=-10;fontSize=10;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="830" y="140" width="30" height="20" as="geometry" />
</mxCell>
<mxCell id="arrow7" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;strokeWidth=2;strokeColor=#9673a6;" edge="1" parent="1">
<mxGeometry relative="1" as="geometry">
<mxPoint x="1040" y="160" as="sourcePoint"/>
<mxPoint x="1160" y="160" as="targetPoint"/>
</mxGeometry>
</mxCell>
<mxCell id="arrow7_label" value="RPC" style="text;html=1;align=center;verticalAlign=bottom;spacingLeft=-10;fontSize=10;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="1090" y="140" width="30" height="20" as="geometry" />
</mxCell>
<!-- Legend -->
<mxCell id="legend_box" value="" style="rounded=1;strokeWidth=1;fillColor=#ffffff;strokeColor=#999999;dashed=1;" vertex="1" parent="1">
<mxGeometry x="650" y="500" width="180" height="90" as="geometry" />
</mxCell>
<mxCell id="legend_title" value="Legend" style="text;html=1;fontSize=14;fontFamily=Noto Sans JP;fontStyle=1" vertex="1" parent="1">
<mxGeometry x="710" y="510" width="60" height="20" as="geometry" />
</mxCell>
<mxCell id="legend1" value="── HTTP/RPC" style="text;html=1;fontSize=11;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="660" y="535" width="80" height="20" as="geometry" />
</mxCell>
<mxCell id="legend2" value="-- - External" style="text;html=1;fontSize=11;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="660" y="555" width="80" height="20" as="geometry" />
</mxCell>
<mxCell id="legend3" value="─── Inter-service" style="text;html=1;fontSize=11;fontFamily=Noto Sans JP;" vertex="1" parent="1">
<mxGeometry x="740" y="535" width="80" height="20" as="geometry" />
</mxCell>
</root>
</mxGraphModel>