# guanlili/samespace architecture

> Architecture diagram of the GitHub repository guanlili/samespace, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/guanlili/samespace
- Repository: https://github.com/guanlili/samespace

## Overview

##### Project type and purpose
- This is a WeChat Mini-Program (“依氧空间”) whose sole codebase is the front-end (app.js, app.json, pages/*.wxml|.wxss|.js|.json).
- Its purpose is to help young people find compatible roommates and rentals: users set personal habits/interests, filter listings, contact roommates, view third-party listings, rate roommates, and participate in social activities.

##### File structure
- Top-level files:
- app.js / app.json / app.wxss – global app configuration and styling
- pages/ – five major tabs (home, publish, welfare, communication, my) each with .js (logic), .wxml (markup), .wxss (styles), .json (route config)
- project.config.json, sitemap.json – WeChat IDE and routing config
- No back-end code present here – it relies on remote services (e.g., your own API server or WeChat Cloud Functions plus third-party real estate providers).

##### README for additional insights
- Five main feature areas:
1. Home (browse and filter listings + roommate tags)
2. Publish (post housing or roommate requests across four sub-flows)
3. Welfare (events + secondhand market)
4. Communication (IM, system messages, groups, discussion posts)
5. My (user profile, auth, settings, orders, favorites, evaluations, customer service)
- Integrates third-party real-estate data (链家, 自如).
- Requires real-name authentication, rating, review systems.

##### Elements
- Labels: “Mini-Program Client”, “API Gateway”, “User Service”, etc.
- Blue rectangles for front-end components (pages/modules)
- Green rectangles for back-end services
- Red clouds for external services (real-estate APIs, WeChat IM)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Front-End Client
    subgraph "WeChat Mini-Program Client"
        MP["Mini-Program Client"]:::frontend
        Home["Home Module"]:::frontend
        Issue["Publish Module"]:::frontend
        Welfare["Welfare Module"]:::frontend
        Comm["Communication Module"]:::frontend
        Info["My Module"]:::frontend
        ProjectConfig["project.config.json"]:::frontend
        Sitemap["sitemap.json"]:::frontend
    end

    %% API Layer
    APIGW["API Gateway / Cloud Functions"]:::backend

    %% Back-End Services
    subgraph "Back-End Services"
        UserSvc["User Service"]:::service
        ListingSvc["Listing Service"]:::service
        PublishSvc["Publish Service"]:::service
        SocialSvc["Social Service"]:::service
        CommSvc["Communication Service"]:::service
        RatingSvc["Rating Service"]:::service
    end

    %% Databases
    subgraph "Databases"
        UserDB["User DB"]:::db
        ListingDB["Listing DB"]:::db
        SocialDB["Social DB"]:::db
        ChatDB["Chat DB / MQ"]:::db
        ReviewDB["Review DB"]:::db
    end

    %% External Integrations
    subgraph "External Services"
        ThirdParty["Third-Party Real-Estate APIs"]:::external
        ObjectStore["CDN / Object Storage"]:::external
        WeChatIM["WeChat IM Platform"]:::external
    end

    %% Connections
    MP -->|"HTTPS Calls"| APIGW
    Home --> APIGW
    Issue --> APIGW
    Welfare --> APIGW
    Comm --> APIGW
    Info --> APIGW

    APIGW -->|"Auth/Profile"| UserSvc
    APIGW -->|"Listings"| ListingSvc
    APIGW -->|"Publish Flows"| PublishSvc
    APIGW -->|"Events/Market"| SocialSvc
    APIGW -->|"Chat/Messages"| CommSvc
    APIGW -->|"Reviews"| RatingSvc

    UserSvc --> UserDB
    ListingSvc --> ListingDB
    PublishSvc --> ListingDB
    SocialSvc --> SocialDB
    CommSvc --> ChatDB
    RatingSvc --> ReviewDB
    RatingSvc --> UserDB

    ListingSvc -->|"Fetch Data"| ThirdParty
    SocialSvc -->|"Media Upload/Download"| ObjectStore
    CommSvc -->|"Deliver Messages"| WeChatIM

    %% Click Events
    click MP "https://github.com/guanlili/samespace/blob/master/app.js"
    click MP "https://github.com/guanlili/samespace/blob/master/app.json"
    click MP "https://github.com/guanlili/samespace/blob/master/app.wxss"
    click Home "https://github.com/guanlili/samespace/tree/master//pages/home/"
    click Issue "https://github.com/guanlili/samespace/tree/master//pages/issue/"
    click Welfare "https://github.com/guanlili/samespace/tree/master//pages/welfare/"
    click Comm "https://github.com/guanlili/samespace/tree/master//pages/communication/"
    click Info "https://github.com/guanlili/samespace/tree/master//pages/information/"
    click ProjectConfig "https://github.com/guanlili/samespace/blob/master/project.config.json"
    click Sitemap "https://github.com/guanlili/samespace/blob/master/sitemap.json"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#0066cc,color:#000;
    classDef backend fill:#d4edda,stroke:#28a745,color:#000;
    classDef service fill:#e2f0d9,stroke:#218838,color:#000;
    classDef db fill:#fff3cd,stroke:#ffcd39,color:#000;
    classDef external fill:#f8d7da,stroke:#dc3545,color:#000;
```
