# x2ydevs/web2droid-x2y-api architecture

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

- Interactive diagram: https://gitdiagram.com/x2ydevs/web2droid-x2y-api
- Repository: https://github.com/x2ydevs/web2droid-x2y-api

## Overview

Web2Droid x2y is a Node.js API for turning a website into a downloadable Android APK. The documented workflow accepts a generation request, fetches and analyzes the site, prepares a customized WebView app, builds it with Gradle, and exposes the APK for download. The README also describes customization, permissions, offline/PWA support, notifications, and background services. The source excerpt confirms the server listener and Gradle build helper; other implementation details are documented but not visible in the excerpt.

Main entry points: [`index.js`](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js) (Build job)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and jobs"]
  node_server["HTTP server<br/>[index.js]"]
  node_request["Generation request<br/>[index.js]"]
  node_validation["Input validation<br/>[index.js]"]
  node_job["Build job<br/>[index.js]"]
end

subgraph group_site["Site and app setup"]
  node_site_fetch["Site fetch and analysis<br/>[index.js]"]
  node_metadata["Metadata and favicon<br/>[index.js]"]
  node_customization["App customization<br/>[index.js]"]
  node_webview["WebView configuration<br/>[index.js]"]
  node_permissions["Permission handling<br/>[index.js]"]
  node_offline_pwa["Offline and PWA<br/>[index.js]"]
  node_notifications["Push notifications<br/>[index.js]"]
  node_background["Background services<br/>[index.js]"]
end

subgraph group_build["Build and delivery"]
  node_project_files["Android project files<br/>[index.js]"]
  node_gradle_build["Gradle build<br/>[index.js]"]
  node_apk["Generated APK<br/>[index.js]"]
  node_download["APK download endpoint<br/>[index.js]"]
end

node_client(("API client"))
node_website["Target website"]
node_sdk["Android build tools"]
node_user(("APK user"))

node_client -->|"sends request"| node_server
node_server -->|"accepts"| node_request
node_request -.->|"validates"| node_validation
node_validation -.->|"starts"| node_job
node_job -->|"fetches site"| node_site_fetch
node_site_fetch -->|"requests content"| node_website
node_site_fetch -->|"analyzes"| node_metadata
node_job -->|"applies options"| node_customization
node_job -->|"configures"| node_webview
node_job -->|"handles permissions"| node_permissions
node_job -->|"adds support"| node_offline_pwa
node_job -.->|"optionally enables"| node_notifications
node_job -.->|"supports"| node_background
node_job -->|"generates"| node_project_files
node_job -->|"runs build"| node_gradle_build
node_gradle_build -->|"uses"| node_sdk
node_gradle_build -->|"produces"| node_apk
node_client -->|"requests APK"| node_download
node_download -->|"serves"| node_apk
node_user -.->|"installs"| node_apk

click node_server "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_request "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_validation "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_job "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_site_fetch "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_metadata "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_customization "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_webview "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_permissions "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_offline_pwa "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_notifications "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_background "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_project_files "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_gradle_build "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_apk "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js"
click node_download "https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.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_server,node_request,node_validation,node_job,node_client,node_user toneBlue
class node_site_fetch,node_metadata,node_customization,node_webview,node_permissions,node_offline_pwa,node_notifications,node_background toneAmber
class node_project_files,node_gradle_build,node_apk,node_download toneMint
class node_website,node_sdk toneIndigo
```

## Components

### API and jobs

- [HTTP server](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`
- [Generation request](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`
- [Input validation](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`
- [Build job](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`

### Site and app setup

- [Site fetch and analysis](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`
- [Metadata and favicon](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`
- [App customization](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`
- [WebView configuration](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`
- [Permission handling](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`
- [Offline and PWA](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`
- [Push notifications](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`
- [Background services](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`

### Build and delivery

- [Android project files](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`
- [Gradle build](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`
- [Generated APK](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`
- [APK download endpoint](https://github.com/x2ydevs/web2droid-x2y-api/blob/main/index.js): `index.js`

### Other components

- **API client**
- **Target website**
- **Android build tools**
- **APK user**

## Connections

- API client → HTTP server: sends request (evidence: `README.md`)
- HTTP server → Generation request: accepts (evidence: `README.md`)
- Generation request → Input validation: validates (evidence: `index.js`)
- Input validation → Build job: starts (evidence: `index.js`)
- Build job → Site fetch and analysis: fetches site (evidence: `README.md`)
- Site fetch and analysis → Target website: requests content (evidence: `README.md`)
- Site fetch and analysis → Metadata and favicon: analyzes (evidence: `README.md`)
- Build job → App customization: applies options (evidence: `README.md`)
- Build job → WebView configuration: configures (evidence: `README.md`)
- Build job → Permission handling: handles permissions (evidence: `README.md`)
- Build job → Offline and PWA: adds support (evidence: `README.md`)
- Build job → Push notifications: optionally enables (evidence: `README.md`)
- Build job → Background services: supports (evidence: `README.md`)
- Build job → Android project files: generates (evidence: `README.md`)
- Build job → Gradle build: runs build (evidence: `index.js`)
- Gradle build → Android build tools: uses (evidence: `README.md`)
- Gradle build → Generated APK: produces (evidence: `index.js`)
- API client → APK download endpoint: requests APK (evidence: `README.md`)
- APK download endpoint → Generated APK: serves (evidence: `README.md`)
- APK user → Generated APK: installs
