# 26samaahmed/fliq architecture

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

- Interactive diagram: https://gitdiagram.com/26samaahmed/fliq
- Repository: https://github.com/26samaahmed/fliq

## Overview

Fliq is a collaborative photo-booth web app. The documented journey runs from landing and account access through participant/frame setup, a shared capture session, photo selection, background editing, and strip export or profile revisit. The implementation combines SvelteKit route stages, a Socket.IO room server, Supabase-backed account and strip operations, and a Gemini-powered background-edit endpoint. The README documents the overall workflow and integrations; sampled source confirms server events, selection synchronization, profile storage actions, and the AI request path. Several flow pages were not sampled, so their internal calls are not inferred.

Main entry points: [`src/lib/components/chatbot/BackgroundChatbot.svelte`](https://github.com/26samaahmed/fliq/blob/main/src/lib/components/chatbot/BackgroundChatbot.svelte) (Background editor), [`src/routes/(flow)/step4/[[roomID]]/+page.svelte`](https://github.com/26samaahmed/fliq/blob/main/src/routes/(flow)/step4/%5B%5BroomID%5D%5D/%2Bpage.svelte) (Shared capture), [`server.js`](https://github.com/26samaahmed/fliq/blob/main/server.js) (Room coordination), [`src/routes/login/+page.svelte`](https://github.com/26samaahmed/fliq/blob/main/src/routes/login/%2Bpage.svelte) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry and Accounts"]
  node_landing["Landing<br/>[+page.svelte]"]
  node_authentication["Authentication<br/>[+page.svelte]"]
  node_signup["Sign up<br/>[+page.svelte]"]
  node_userstate["User state<br/>[user.ts]"]
  node_profile["Strip profile<br/>[+page.svelte]"]
end

subgraph group_session["Booth Session"]
  node_participant_setup["Participant setup<br/>[+page.svelte]"]
  node_frame_choice["Frame choice<br/>[+page.svelte]"]
  node_frame_design["Frame design"]
  node_capture["Shared capture<br/>[+page.svelte]"]
end

subgraph group_creation["Strip Creation"]
  node_photo_selection["Photo selection<br/>[+page.svelte]"]
  node_background_edit["Background editor"]
  node_final_strip["Final strip<br/>[+page.svelte]"]
  node_export["Save and export<br/>[+page.svelte]"]
end

subgraph group_services["Backend Services"]
  node_room_server["Room coordination<br/>[server.js]"]
  node_background_api["Background API<br/>[+server.ts]"]
  node_supabase_client["Supabase client<br/>[supabase.ts]"]
end

node_visitor(("Visitor"))
node_gemini{{"Gemini AI"}}
node_supabase[("Supabase auth and storage")]

node_visitor -->|"opens"| node_landing
node_landing -->|"continues to"| node_authentication
node_authentication -->|"enters flow"| node_participant_setup
node_signup -->|"enters flow"| node_participant_setup
node_authentication -.->|"authenticates user"| node_userstate
node_participant_setup -->|"chooses participants"| node_frame_choice
node_frame_choice -->|"selects layout"| node_frame_design
node_frame_design -->|"starts session"| node_capture
node_capture -.->|"coordinates room"| node_room_server
node_room_server -->|"synchronizes events"| node_capture
node_capture -->|"previews photos"| node_photo_selection
node_photo_selection -->|"syncs selections"| node_room_server
node_photo_selection -->|"continues editing"| node_background_edit
node_background_edit -->|"posts images"| node_background_api
node_background_api -->|"generates edits"| node_gemini
node_background_edit -.->|"shares chat"| node_room_server
node_background_edit -->|"applies background"| node_final_strip
node_final_strip -->|"prepares strip"| node_export
node_export -.->|"saves strip"| node_supabase_client
node_profile -->|"loads and manages strips"| node_supabase_client
node_supabase_client -->|"accesses auth and storage"| node_supabase
node_export -->|"revisits saved strips"| node_profile

click node_landing "https://github.com/26samaahmed/fliq/blob/main/src/routes/%2Bpage.svelte"
click node_authentication "https://github.com/26samaahmed/fliq/blob/main/src/routes/login/%2Bpage.svelte"
click node_signup "https://github.com/26samaahmed/fliq/blob/main/src/routes/signup/%2Bpage.svelte"
click node_userstate "https://github.com/26samaahmed/fliq/blob/main/src/lib/stores/user.ts"
click node_participant_setup "https://github.com/26samaahmed/fliq/blob/main/src/routes/(flow)/step1/%2Bpage.svelte"
click node_frame_choice "https://github.com/26samaahmed/fliq/blob/main/src/routes/(flow)/step2/%2Bpage.svelte"
click node_frame_design "https://github.com/26samaahmed/fliq/tree/main/src/routes/(flow)/step3"
click node_capture "https://github.com/26samaahmed/fliq/blob/main/src/routes/(flow)/step4/%5B%5BroomID%5D%5D/%2Bpage.svelte"
click node_room_server "https://github.com/26samaahmed/fliq/blob/main/server.js"
click node_photo_selection "https://github.com/26samaahmed/fliq/blob/main/src/routes/(flow)/step5/%2Bpage.svelte"
click node_background_edit "https://github.com/26samaahmed/fliq/blob/main/src/lib/components/chatbot/BackgroundChatbot.svelte"
click node_background_api "https://github.com/26samaahmed/fliq/blob/main/src/routes/api/background-edit/%2Bserver.ts"
click node_final_strip "https://github.com/26samaahmed/fliq/blob/main/src/routes/(flow)/step6/%2Bpage.svelte"
click node_export "https://github.com/26samaahmed/fliq/blob/main/src/routes/(flow)/step7/%2Bpage.svelte"
click node_profile "https://github.com/26samaahmed/fliq/blob/main/src/routes/profile/%2Bpage.svelte"
click node_supabase_client "https://github.com/26samaahmed/fliq/blob/main/src/lib/supabase.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_landing,node_authentication,node_signup,node_userstate,node_profile toneBlue
class node_participant_setup,node_frame_choice,node_frame_design,node_capture,node_supabase toneAmber
class node_photo_selection,node_background_edit,node_final_strip,node_export toneMint
class node_room_server,node_background_api,node_supabase_client toneRose
class node_visitor,node_gemini toneIndigo
```

## Components

### Entry and Accounts

- [Landing](https://github.com/26samaahmed/fliq/blob/main/src/routes/%2Bpage.svelte): `src/routes/+page.svelte`
- [Authentication](https://github.com/26samaahmed/fliq/blob/main/src/routes/login/%2Bpage.svelte): `src/routes/login/+page.svelte`
- [Sign up](https://github.com/26samaahmed/fliq/blob/main/src/routes/signup/%2Bpage.svelte): `src/routes/signup/+page.svelte`
- [User state](https://github.com/26samaahmed/fliq/blob/main/src/lib/stores/user.ts): `src/lib/stores/user.ts`
- [Strip profile](https://github.com/26samaahmed/fliq/blob/main/src/routes/profile/%2Bpage.svelte): `src/routes/profile/+page.svelte`

### Booth Session

- [Participant setup](https://github.com/26samaahmed/fliq/blob/main/src/routes/(flow)/step1/%2Bpage.svelte): `src/routes/(flow)/step1/+page.svelte`
- [Frame choice](https://github.com/26samaahmed/fliq/blob/main/src/routes/(flow)/step2/%2Bpage.svelte): `src/routes/(flow)/step2/+page.svelte`
- [Frame design](https://github.com/26samaahmed/fliq/tree/main/src/routes/(flow)/step3): `src/routes/(flow)/step3`
- [Shared capture](https://github.com/26samaahmed/fliq/blob/main/src/routes/(flow)/step4/%5B%5BroomID%5D%5D/%2Bpage.svelte): `src/routes/(flow)/step4/[[roomID]]/+page.svelte`

### Strip Creation

- [Photo selection](https://github.com/26samaahmed/fliq/blob/main/src/routes/(flow)/step5/%2Bpage.svelte): `src/routes/(flow)/step5/+page.svelte`
- [Background editor](https://github.com/26samaahmed/fliq/blob/main/src/lib/components/chatbot/BackgroundChatbot.svelte): `src/lib/components/chatbot/BackgroundChatbot.svelte`
- [Final strip](https://github.com/26samaahmed/fliq/blob/main/src/routes/(flow)/step6/%2Bpage.svelte): `src/routes/(flow)/step6/+page.svelte`
- [Save and export](https://github.com/26samaahmed/fliq/blob/main/src/routes/(flow)/step7/%2Bpage.svelte): `src/routes/(flow)/step7/+page.svelte`

### Backend Services

- [Room coordination](https://github.com/26samaahmed/fliq/blob/main/server.js): `server.js`
- [Background API](https://github.com/26samaahmed/fliq/blob/main/src/routes/api/background-edit/%2Bserver.ts): `src/routes/api/background-edit/+server.ts`
- [Supabase client](https://github.com/26samaahmed/fliq/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`

### Other components

- **Visitor**
- **Gemini AI**
- **Supabase auth and storage**

## Connections

- Visitor → Landing: opens
- Landing → Authentication: continues to
- Authentication → Participant setup: enters flow
- Sign up → Participant setup: enters flow
- Authentication → User state: authenticates user
- Participant setup → Frame choice: chooses participants
- Frame choice → Frame design: selects layout
- Frame design → Shared capture: starts session
- Shared capture → Room coordination: coordinates room
- Room coordination → Shared capture: synchronizes events (evidence: `server.js`)
- Shared capture → Photo selection: previews photos
- Photo selection → Room coordination: syncs selections (evidence: `src/routes/(flow)/step5/+page.svelte`)
- Photo selection → Background editor: continues editing
- Background editor → Background API: posts images (evidence: `src/lib/components/chatbot/BackgroundChatbot.svelte`)
- Background API → Gemini AI: generates edits (evidence: `src/routes/api/background-edit/+server.ts`)
- Background editor → Room coordination: shares chat
- Background editor → Final strip: applies background
- Final strip → Save and export: prepares strip
- Save and export → Supabase client: saves strip
- Strip profile → Supabase client: loads and manages strips (evidence: `src/routes/profile/+page.svelte`)
- Supabase client → Supabase auth and storage: accesses auth and storage
- Save and export → Strip profile: revisits saved strips
