# fbsamples/f8app architecture

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

- Interactive diagram: https://gitdiagram.com/fbsamples/f8app
- Repository: https://github.com/fbsamples/f8app

## Overview

##### Project Type and Purpose
- This is a full-stack, cross-platform mobile application (React Native) used as the official F8 conference app.
- Frontend (js/, android/, ios/) implements UI, navigation, state management (Redux), Relay/GraphQL client, and integrates with device services (push, maps).
- Backend (server/) comprises a GraphQL microservice, a Parse Server with cloud code & jobs, and a MongoDB data store (with initial dump in mongorestore/).

##### File-Structure Analysis
- Top level:
- android/, ios/ — native wrappers for React Native
- js/ — all React Native JavaScript code (UI components, tabs, actions, reducers, Relay environment)
- server/ — three sub-services:
– graphql/ — Node.js GraphQL API
– parse-server/ — Parse Server Cloud Code & triggers
– parse-dashboard/ — admin UI for Parse data
– mongorestore/ — initial MongoDB BSON data dumps
- docker-compose.yml & Dockerfiles — local/dev orchestration
- scripts/ — build, test, and run helpers
- CI config (.circleci/)
- Presence of Relay, GraphQL schemas, Parse cloud functions, and Mongo dumps indicates a micro-service backend with a document store.

a. Main Components
1. Mobile Clients
- iOS (native shell + JS bundle)
- Android (native shell + JS bundle)
- React Native bundle loaded from Metro bundler or embedded
2. Presentation & State Management (on mobile)
- React Components (js/common, js/tabs, js/filter, etc.)
- Redux store (js/store)
- Relay environment (js/relay-environment.js) for GraphQL data fetching
3. Network & API Layer (mobile)
- GraphQL client (Relay)
- REST endpoints (Parse Server REST API for push, login, optional)
4. Backend Services
- GraphQL Service (server/graphql)
- Parse Server (server/parse-server)
- Parse Dashboard (server/parse-dashboard)
- MongoDB (data store)
5. Dev & Ops
- Docker Compose orchestrator
- CI/CD (CircleCI)
- Scripts (build, tests, data import)

b. Relationships & Data Flows
1. Mobile App → GraphQL Service
- Queries & Mutations via Relay over HTTPS
2. GraphQL Service → Parse Server & MongoDB
- Resolves queries by calling Parse SDK or direct Mongo queries
3. Mobile App → Parse Server
- Push notification registration & delivery
- Cloud function invocation (e.g., survey exports)
4. Parse Server → MongoDB
- CRUD operations on conference data, users, schedules
5. Dev Tools
- Docker Compose wires up GraphQL, Parse, Mongo, Dashboard
- CircleCI runs tests (js/__tests__, server tests) and lint/flow checks
6. External Services
- Push (APNs, FCM) via Parse Server
- Analytics (custom F8Analytics.js → remote tracking endpoints)

c. Architectural Patterns & Design Principles
- Frontend: Component-based UI, unidirectional data flow (Redux + Relay).
- Backend: Polyglot microservices (GraphQL + Parse), separation of concerns.
- Shared code: Cloud business logic centralized in Parse Cloud Code.
- DevOps: Infrastructure as code (Dockerfiles, docker-compose.yml), automated pipelines.

d. Key Technologies
- React Native, Redux, Relay/GraphQL (frontend)
- Node.js, Express (assumed), Apollo or graphql-js (GraphQL service)
- Parse Server (cloud code, jobs, triggers)
- MongoDB (document DB)
- Docker, Docker Compose, CircleCI

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Mobile Clients"
        subgraph iOS
            iOSNative["ios/"]:::mobile
            iOSEntry["index.ios.js"]:::mobile
        end
        subgraph Android
            AndroidNative["android/"]:::mobile
            AndroidEntry["index.android.js"]:::mobile
        end
    end

    subgraph "React Native App"
        UIComponents["Presentation & UI Components\n(js/)"]:::frontend
        ReduxStore["Redux Store\n(js/store/, js/reducers/)"]:::frontend
        RelayClient["Relay Environment\n(js/relay-environment.js)"]:::frontend
        PushController["Push & Device Services\n(js/PushNotificationsController.js)"]:::frontend
        Analytics["Analytics Tracking\n(js/F8Analytics.js, js/store/analytics.js)"]:::frontend
    end

    subgraph "Backend Services"
        GraphQLService["GraphQL Service\n(server/graphql/)"]:::backend
        ParseServer["Parse Server\n(server/parse-server/)"]:::backend
        ParseDashboard["Parse Dashboard\n(server/parse-dashboard/)"]:::backend
        Mongo["MongoDB\n(server/mongorestore/)"]:::db
    end

    subgraph "External Services"
        PushGateways["Push Gateways\n(APNs, FCM)"]:::external
        AnalyticsEndpoints["Analytics Endpoints"]:::external
    end

    subgraph "DevOps & CI/CD"
        DockerCompose["docker-compose.yml"]:::ops
        Scripts["scripts/"]:::ops
        CICD[".circleci/config.yml"]:::ops
    end

    iOSNative --> iOSEntry
    AndroidNative --> AndroidEntry
    iOSEntry --> UIComponents
    AndroidEntry --> UIComponents
    UIComponents --> ReduxStore
    ReduxStore --> RelayClient
    RelayClient -->|GraphQL Queries/Mutations| GraphQLService
    GraphQLService -->|Resolve via SDK| ParseServer
    ParseServer -->|CRUD| Mongo
    RelayClient -->|Push Registration| ParseServer
    PushController -->|Push APIs| ParseServer
    ParseServer -->|Push Delivery| PushGateways
    Analytics -->|Track Events| AnalyticsEndpoints
    GraphQLService --> ParseServer
    DockerCompose --> GraphQLService
    DockerCompose --> ParseServer
    DockerCompose --> ParseDashboard
    DockerCompose --> Mongo
    CICD --> Scripts
    Scripts --> UIComponents
    Scripts --> GraphQLService
    Scripts --> ParseServer

    classDef mobile fill:#b7e4c7,stroke:#2b7a0b
    classDef frontend fill:#a0c4ff,stroke:#034078
    classDef backend fill:#ffd6a5,stroke:#bb3e03
    classDef db fill:#ffadad,stroke:#730000
    classDef ops fill:#eeeeee,stroke:#555555
    classDef external fill:#d3d3d3,stroke:#666666

    click AndroidNative "https://github.com/fbsamples/f8app/tree/main/android/"
    click iOSNative "https://github.com/fbsamples/f8app/tree/main/ios/"
    click iOSEntry "https://github.com/fbsamples/f8app/blob/main/index.ios.js"
    click AndroidEntry "https://github.com/fbsamples/f8app/blob/main/index.android.js"
    click UIComponents "https://github.com/fbsamples/f8app/tree/main/js/"
    click ReduxStore "https://github.com/fbsamples/f8app/tree/main/js/store/"
    click RelayClient "https://github.com/fbsamples/f8app/blob/main/js/relay-environment.js"
    click PushController "https://github.com/fbsamples/f8app/blob/main/js/PushNotificationsController.js"
    click Analytics "https://github.com/fbsamples/f8app/blob/main/js/F8Analytics.js"
    click AnalyticsEndpoints "https://github.com/fbsamples/f8app/blob/main/js/store/analytics.js"
    click Scripts "https://github.com/fbsamples/f8app/tree/main/scripts/"
    click DockerCompose "https://github.com/fbsamples/f8app/blob/main/docker-compose.yml"
    click CICD "https://github.com/fbsamples/f8app/blob/main/.circleci/config.yml"
    click GraphQLService "https://github.com/fbsamples/f8app/tree/main/server/graphql/"
    click ParseServer "https://github.com/fbsamples/f8app/tree/main/server/parse-server/"
    click ParseDashboard "https://github.com/fbsamples/f8app/tree/main/server/parse-dashboard/"
    click Mongo "https://github.com/fbsamples/f8app/tree/main/server/mongorestore/"
```
