# bndkt/sharemystack architecture

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

- Interactive diagram: https://gitdiagram.com/bndkt/sharemystack
- Repository: https://github.com/bndkt/sharemystack

## Overview

##### Main Components
- Frontend:
- Mobile App (React Native via Expo + Expo Router)
- Web Landing (Remix app deployed on Cloudflare)
- Sanity Studio (CMS for editorial content)
- Remotion Video Generator (marketing assets)
- Shared Assets & Scripts:
- Static JSON data (assets/data)
- Seed-data GitHub Action (packages/seed-data-action)
- Backend & Infrastructure:
- Supabase (PostgreSQL + Storage + Functions)
- GitHub Actions (CI/CD workflows under .github/workflows)
- External Services: OneSignal (push), Sentry (error tracking), Vexo (analytics)

##### Component Roles & Relationships
- Mobile App
- Offline-first: WatermelonDB local store synchronized via Supabase push/pull functions
- Auth via Supabase; real-time sync, file uploads to Supabase Storage
- Uses OneSignal, Sentry, analytics hooks
- Web Landing (Remix)
- Reads public data from Supabase via REST/JS SDK
- Hosts marketing site, generates OG images, QRCodes
- Sanity Studio
- CMS for editorial content (tools, tutorials)
- Deploys to a CDN or Vercel (not in repo, but typical)
- Remotion Video
- Pulls static data (from assets/data or Supabase)
- Renders marketing videos offline
- Seed-Data Action
- GitHub Action that reads assets/data, writes into Supabase tables via its SDK
- Run on schedule or manually to seed / update static data
- Supabase
- PostgreSQL database with tables: profiles, tools, stacks, picks, stars, categorization, etc.
- RPC functions: push, pull, create/update profiles, manage slugs, sync views

##### Important Architectural Patterns & Principles
- Monorepo managed by Turbo/Turborepo (turbo.json)
- Full-stack separation: each app in apps/*; shared logic in packages/* or assets/*
- Offline-First Sync: local DB + remote push/pull via SQL functions
- CI/CD via GitHub Actions: separate workflows for building mobile, web preview, production, seed data
- CMS as a decoupled editorial service (Sanity)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Monorepo Structure
    subgraph "Monorepo"
        direction TB

        subgraph "apps"
            direction TB
            MobileApp["Mobile App<br/>(React Native, Expo Router,<br/>Tamagui, WatermelonDB, Supabase-JS)"]:::frontend
            WebApp["Web Landing<br/>(Remix, Tailwind, Supabase-JS)"]:::frontend
            CMS["Sanity Studio<br/>(Sanity Studio, React)"]:::frontend
            VideoGen["Remotion Video Gen<br/>(Remotion, Tailwind CSS)"]:::frontend
        end

        subgraph "packages"
            direction TB
            SeedAction["Seed-Data Action<br/>(GitHub Action)"]:::ci
        end

        subgraph "assets"
            direction TB
            StaticData["Static JSON Data"]:::shared
        end

        subgraph "supabase"
            direction TB
            SupabaseDB["Supabase DB<br/>(PostgreSQL)"]:::backend
            SupabaseStorage["Storage Bucket"]:::backend
            SupabaseFunctions["RPC Functions<br/>(push, pull, auth, slug)"]:::backend
            SupabaseConfig["Config & Scripts"]:::backend
        end
    end

    %% CI/CD outside apps
    GitHubWorkflows["GitHub Actions<br/>(Workflows)"]:::ci

    %% External Services
    OneSignal("OneSignal"):::external
    Sentry("Sentry"):::external
    Vexo("Vexo Analytics"):::external
    CDN("Cloudflare CDN"):::external

    %% Connections: Frontends -> Supabase
    MobileApp -->|"Auth, Data Sync"| SupabaseFunctions
    MobileApp -->|"File Upload"| SupabaseStorage
    MobileApp -->|"Real-time Sync"| SupabaseDB

    WebApp -->|"Read Data"| SupabaseFunctions

    CMS -->|"Editorial Content Deploy"| CDN
    CDN -->|"Fetch Content"| MobileApp
    CDN -->|"Fetch Content"| WebApp

    VideoGen -->|"Read Static Data"| StaticData

    %% Seed Data Action -> Supabase
    SeedAction -.->|"Writes Data"| SupabaseFunctions

    %% GitHub Workflows
    GitHubWorkflows -->|"Build & Deploy"| MobileApp
    GitHubWorkflows -->|"Deploy Remix"| WebApp
    GitHubWorkflows -->|"Schedule Seed"| SeedAction

    %% Mobile external integrations
    MobileApp -->|"Push Notifications"| OneSignal
    MobileApp -->|"Error Tracking"| Sentry
    MobileApp -->|"Analytics"| Vexo

    %% Classes
    classDef frontend fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef backend fill:#90EE90,stroke:#333,stroke-width:1px
    classDef ci fill:#FFA500,stroke:#333,stroke-width:1px
    classDef shared fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke-dasharray: 5 5,stroke:#333,stroke-width:1px

    %% Click Events
    click MobileApp "https://github.com/bndkt/sharemystack/tree/main/apps/app"
    click WebApp "https://github.com/bndkt/sharemystack/tree/main/apps/web"
    click CMS "https://github.com/bndkt/sharemystack/tree/main/apps/content"
    click VideoGen "https://github.com/bndkt/sharemystack/tree/main/apps/video"
    click StaticData "https://github.com/bndkt/sharemystack/tree/main/assets/data"
    click SeedAction "https://github.com/bndkt/sharemystack/tree/main/packages/seed-data-action"
    click SupabaseDB "https://github.com/bndkt/sharemystack/tree/main/supabase/migrations"
    click SupabaseFunctions "https://github.com/bndkt/sharemystack/tree/main/supabase/functions"
    click SupabaseConfig "https://github.com/bndkt/sharemystack/blob/main/supabase/config.toml"
    click GitHubWorkflows "https://github.com/bndkt/sharemystack/tree/main/.github/workflows"
```
