# osamhack2021/app_gamelike_gamelike architecture

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

- Interactive diagram: https://gitdiagram.com/osamhack2021/app_gamelike_gamelike
- Repository: https://github.com/osamhack2021/app_gamelike_gamelike

## Overview

##### Project Type and Purpose
- From the README, note that “GameLike” is a platform designed to help users (in this case, military personnel) set goals and complete quests in a game-like fashion.
- It is a full-stack application: the backend (using Node.js, Express, and MySQL) manages data, authentication (via Passport strategies), and API endpoints, while the front-end (using React.js/React Native, Redux, and TypeScript) provides interactive mobile (and possibly web) interfaces.
- Docker and docker-compose files indicate a containerized deployment and separation between development and production environments.

##### File Structure
- APP(BE): The backend code contains directories for models (data definitions using a schema-like approach), passport configurations (authentication strategies with local and Kakao integration), and routes (segregating API endpoints for users, quests, posts, authentication, and more). View templates (HTML files for error, join, main, etc.) suggest server-side rendering or error pages.
- APP(FE): The front-end is mainly structured around React Native. There are separate configurations/files for Android and iOS (with separate directories for each), as well as web-specific files (App.web.tsx, index.web.js). In addition, Redux store configuration, components (for Home, Quest, Level, etc.), assets (images and fonts), and configuration files indicate how business logic is segmented within a modern front-end framework.
- CLOUD(BE): This mirrors the backend’s containerization setup, holding its own Dockerfiles and docker-compose files for managing production deployment, likely interacting with infrastructure like a MySQL instance.
- Additional files (like docker-compose.yaml, Dockerfile.dev, ip.ts, webpack.config.js) show integration and build steps to containerize and deploy the application.

##### Main Components and Their Relationships
a. Front-end (APP(FE)):
- Mobile Platform: React Native based components for Android and iOS are provided with navigation, user interactions (screens for login, home, quest operations, etc.), and state management via Redux.
- Web: There are web-specific entry points (e.g., App.web.tsx) indicating a responsive design for browsers.
- Assets: Fonts, images, and styles, along with bundled JavaScript (babel and webpack configs) assist in rendering a cohesive UI.
b. Back-end (APP(BE)):
- API Layer: Express server (app.js) with a clear routing structure (routes folder) handling authentication, user management, quest operations, and page rendering.
- Data Layer: Models (using files like post.js, quest.js, user.js, etc.) map the business logic to the database operations. There is a clear separation of concerns following an MVC-like pattern.
- Authentication: Passport module configuration (including strategies for Kakao and local) manages secure access.
c. Infrastructure and Deployment:
- Dockerization: Dockerfiles (.dockerignore, docker-compose.yaml, docker-entrypoint.sh in both APP(BE) and CLOUD(BE)) denote containerized deployment. This shows that both local development and cloud environments are considered.
- MySQL Database: Although not explicitly seen as a separate folder, the README mentions MySQL – so include a database component that interacts with the back-end models.
- External Services: API calls made by the front-end (using axios) to backend endpoints, and container orchestration between cloud and local deployments.

##### Architectural Patterns and Technologies
- MVC and API-driven Design: The separation between models, views (server-side templates), and routes in the back-end, and the Redux-managed state separation in the front-end.
- Containerization: Use of Docker and docker-compose for deployment.
- Tech Stack Labels: Node.js and Express for the server, React Native (and React.js) for the client, and MySQL as the database.
- The data flow moves from user actions in front-end components that trigger API requests to the backend, interact with models (and MySQL), then return responses that update state (Redux store).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Front-end"
        FE_Mobile["Mobile Client (React Native/Redux)"]:::frontend
        FE_Web["Web Client (React.js)"]:::frontend
        subgraph "Mobile Platforms"
            FE_Android["Android"]:::frontend
            FE_iOS["iOS"]:::frontend
        end
    end

    subgraph "Back-end"
        BE_API["API Server (Node.js/Express)"]:::backend
        BE_Routes["API Routes"]:::backend
        BE_Models["Data Models"]:::backend
        BE_Auth["Authentication"]:::backend
        BE_Views["Server-side Views"]:::backend
    end

    subgraph "Infrastructure"
        subgraph "Local Containerization"
            LC_Dockerfile["Dockerfile.dev"]:::container
            LC_Compose["docker-compose.yaml"]:::container
            LC_Entry["docker-entrypoint.sh"]:::container
        end
        subgraph "Production Containerization"
            PC_Container["Production Deployment (CLOUD(BE))"]:::container
        end
    end

    DB["MySQL Database"]:::database

    %% Front-end to Back-end communication
    FE_Mobile -->|"APIcalls"| BE_API
    FE_Web -->|"APIcalls"| BE_API
    FE_Android -->|"belongsTo"| FE_Mobile
    FE_iOS -->|"belongsTo"| FE_Mobile

    %% Back-end internal interactions
    BE_API -->|"routes"| BE_Routes
    BE_API -->|"uses"| BE_Models
    BE_API -->|"authenticatesVia"| BE_Auth
    BE_API -->|"renders"| BE_Views
    BE_API -->|"CRUDops"| DB

    %% Deployment relationships
    BE_API -->|"deployedWith"| LC_Dockerfile
    BE_API -->|"deployedWith"| LC_Compose
    BE_API -->|"deployedWith"| LC_Entry
    BE_API -->|"deployedWith"| PC_Container

    %% Click Events
    click FE_Android "https://github.com/osamhack2021/app_gamelike_gamelike/tree/master/APP(FE)/android"
    click FE_iOS "https://github.com/osamhack2021/app_gamelike_gamelike/tree/master/APP(FE)/ios"
    click FE_Web "https://github.com/osamhack2021/app_gamelike_gamelike/blob/master/APP(FE)/App.web.tsx"
    click BE_API "https://github.com/osamhack2021/app_gamelike_gamelike/blob/master/APP(BE)/app.js"
    click BE_Models "https://github.com/osamhack2021/app_gamelike_gamelike/tree/master/APP(BE)/models"
    click BE_Routes "https://github.com/osamhack2021/app_gamelike_gamelike/tree/master/APP(BE)/routes"
    click BE_Auth "https://github.com/osamhack2021/app_gamelike_gamelike/tree/master/APP(BE)/passport"
    click BE_Views "https://github.com/osamhack2021/app_gamelike_gamelike/tree/master/APP(BE)/views"
    click LC_Dockerfile "https://github.com/osamhack2021/app_gamelike_gamelike/blob/master/APP(BE)/Dockerfile.dev"
    click LC_Compose "https://github.com/osamhack2021/app_gamelike_gamelike/blob/master/APP(BE)/docker-compose.yaml"
    click LC_Entry "https://github.com/osamhack2021/app_gamelike_gamelike/blob/master/APP(BE)/docker-entrypoint.sh"
    click PC_Container "https://github.com/osamhack2021/app_gamelike_gamelike/tree/master/CLOUD(BE)"

    %% Styling
    classDef frontend fill:#bbdefb,stroke:#0d47a1,stroke-width:2px;
    classDef backend fill:#ffe082,stroke:#ff6f00,stroke-width:2px;
    classDef container fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px;
    classDef database fill:#f8bbd0,stroke:#880e4f,stroke-width:2px;
```
