# amit0119/timepass architecture

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

- Interactive diagram: https://gitdiagram.com/amit0119/timepass
- Repository: https://github.com/amit0119/timepass

## Overview

Mini-World is a browser-based private 1-on-1 chat application with real-time messaging, WebRTC calling, social features, games, media, and push notifications. The main workflow is users chatting through the browser, with the server relaying real-time activity between them. The server also handles account and media routes and uses database queries for persistent media. The excerpts show the client registering a service worker and the worker displaying push notifications. Several feature-specific server handlers are unsampled, so those links are marked unverified or omitted.

Main entry points: [`public/script.js`](https://github.com/amit0119/timepass/blob/main/public/script.js) (Chat client), [`server.js`](https://github.com/amit0119/timepass/blob/main/server.js) (Realtime server), [`public/sw.js`](https://github.com/amit0119/timepass/blob/main/public/sw.js) (Push worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser experience"]
  node_browser["Chat client<br/>[script.js]"]
  node_worker["Push worker<br/>[sw.js]"]
end

subgraph group_realtime["Realtime features"]
  node_socket["Realtime server<br/>[server.js]"]
  node_games["Shared games<br/>[server.js]"]
  node_calling["WebRTC calling<br/>[server.js]"]
end

subgraph group_server["Server services"]
  node_social["Accounts and social<br/>[server.js]"]
  node_messaging["Messages and media<br/>[server.js]"]
  node_push["Push routes<br/>[server.js]"]
end

subgraph group_integrations["External services"]
  node_database[("PostgreSQL")]
  node_push_service["Web Push service"]
end

node_user(("User"))
node_peer(("Chat partner"))

node_user -->|"uses"| node_browser
node_browser -->|"sends chat"| node_socket
node_socket -->|"relays messages"| node_peer
node_socket -->|"queries media"| node_database
node_browser -.->|"sends game events"| node_games
node_browser -.->|"starts calls"| node_calling
node_browser -->|"registers"| node_worker
node_worker -->|"shows notifications"| node_user
node_push -.->|"sends notifications"| node_push_service

click node_browser "https://github.com/amit0119/timepass/blob/main/public/script.js"
click node_worker "https://github.com/amit0119/timepass/blob/main/public/sw.js"
click node_socket "https://github.com/amit0119/timepass/blob/main/server.js"
click node_social "https://github.com/amit0119/timepass/blob/main/server.js"
click node_messaging "https://github.com/amit0119/timepass/blob/main/server.js"
click node_games "https://github.com/amit0119/timepass/blob/main/server.js"
click node_calling "https://github.com/amit0119/timepass/blob/main/server.js"
click node_push "https://github.com/amit0119/timepass/blob/main/server.js"

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_browser,node_worker,node_user toneBlue
class node_socket,node_games,node_calling toneAmber
class node_social,node_messaging,node_push toneMint
class node_database,node_push_service toneRose
class node_peer toneIndigo
```

## Components

### Browser experience

- [Chat client](https://github.com/amit0119/timepass/blob/main/public/script.js): `public/script.js`
- [Push worker](https://github.com/amit0119/timepass/blob/main/public/sw.js): `public/sw.js`

### Realtime features

- [Realtime server](https://github.com/amit0119/timepass/blob/main/server.js): `server.js`
- [Shared games](https://github.com/amit0119/timepass/blob/main/server.js): `server.js`
- [WebRTC calling](https://github.com/amit0119/timepass/blob/main/server.js): `server.js`

### Server services

- [Accounts and social](https://github.com/amit0119/timepass/blob/main/server.js): `server.js`
- [Messages and media](https://github.com/amit0119/timepass/blob/main/server.js): `server.js`
- [Push routes](https://github.com/amit0119/timepass/blob/main/server.js): `server.js`

### External services

- **PostgreSQL**
- **Web Push service**

### Other components

- **User**
- **Chat partner**

## Connections

- User → Chat client: uses (evidence: `README.md`)
- Chat client → Realtime server: sends chat (evidence: `README.md`)
- Realtime server → Chat partner: relays messages (evidence: `README.md`)
- Realtime server → PostgreSQL: queries media (evidence: `server.js`)
- Chat client → Shared games: sends game events
- Chat client → WebRTC calling: starts calls
- Chat client → Push worker: registers (evidence: `public/script.js`)
- Push worker → User: shows notifications (evidence: `public/sw.js`)
- Push routes → Web Push service: sends notifications
