# Social Crawl documentation > Social Crawl saves social media posts, articles and videos to a server you run yourself. These pages cover installing it, using every feature, and changing how it works. --- # What is Social Crawl > What Social Crawl does, what it can save, and what you need before you start. Read this first if you have never used it. Source: https://crawl-docs.pdhq.win/guide/what-is-social-crawl/ Last updated: 2026-12-02 Social Crawl keeps your own copy of things you find online: a social media post, a blog article, a video, a film's page, a code repository. It runs on a server that you control, so what you save stays yours even if the original is deleted or the site changes. ## How it works in one minute There are three parts. You will set up the first two and use all three. | Part | What it is | Where you meet it | | --- | --- | --- | | The server | Stores everything you save, and runs the web app | You install it once, on a server of your own | | The web app | Your library: search, filter, read, play, share and download what you saved | You open it in any browser and sign in with your password | | The browser extension | Saves the page you are looking at | A button in your browser's toolbar, on any page | You find something, click the extension's button, and it appears in your library a moment later. > [!NOTE] > Social Crawl has one owner and one password. It is not a service with accounts for many people. Anything shared with other people goes through a temporary link, see [Shares and downloads](https://crawl-docs.pdhq.win/guide/shares-and-downloads.md). ## What you can save The extension reads each of these sites with a reader made for it. Any other web page is saved as an **article**. | What | Where from | | --- | --- | | Posts | Facebook, Instagram, X (and X's long "Articles"), Pinterest, LinkedIn | | Videos | YouTube videos, shorts and live streams | | YouTube playlists | The playlist's own page, saved as a page (the videos in it are not downloaded) | | Films and shows | A title page on IMDb or Rotten Tomatoes | | Code | A GitHub repository's home page, with its README | | Articles and anything else | Any other web page: a blog, a news story, a guide | Separately, you can paste a link to a **Bluesky** post into the web app and save it without the extension. No other site works from a pasted link, because their posts cannot be fetched from outside a signed-in browser. > [!NOT-TESTED] > The Facebook, Instagram, X, Pinterest and LinkedIn readers were built from saved copies of real pages and from test pages, never against the live sites. See [What is not tested](https://crawl-docs.pdhq.win/guide/what-is-not-tested.md) before you rely on them. ## What a saved post is Each post is stored as a small **bundle**: a folder with a page you can open without a network, the data it was made from, the plain text, the pictures and the videos. You can download any post as a ZIP and open `index.html` by double-clicking it, long after the server is gone. ## What you need - A server that can run Docker, with a web address (a domain name) pointing at it. The guide uses [Dokploy](https://docs.dokploy.com), a free tool that runs and updates Docker applications for you. - A computer with Chrome, Edge or Brave for the extension. A Firefox version does not exist yet, see [Install the extension](https://crawl-docs.pdhq.win/guide/install-the-extension.md). - About half an hour for the first install. ## Where to go next 1. [Install the server](https://crawl-docs.pdhq.win/guide/install-the-server.md) 2. [Sign in for the first time](https://crawl-docs.pdhq.win/guide/first-sign-in.md) 3. [Install the browser extension](https://crawl-docs.pdhq.win/guide/install-the-extension.md) 4. [Save your first post](https://crawl-docs.pdhq.win/guide/save-your-first-post.md) If you want to change how Social Crawl works, the **Advanced** section starts with [Architecture](https://crawl-docs.pdhq.win/advanced/architecture.md). --- # Install the server > Set up the Social Crawl server with Dokploy, step by step, with every command and what you should see after each step. Source: https://crawl-docs.pdhq.win/guide/install-the-server/ Last updated: 2026-12-02 This page puts the server on a machine of your own, using [Dokploy](https://docs.dokploy.com). Dokploy builds Social Crawl from its code, runs it, gives it a web address with HTTPS, and updates it when the code changes. > [!NOT-TESTED] > The deploy steps below follow the repository's `docker-compose.yml` and the README. The whole stack was not started in containers while these pages were written (there was no Docker engine in the build environment), so a step may differ slightly on your machine. If one does, [Troubleshooting](https://crawl-docs.pdhq.win/guide/troubleshooting.md) covers the failures that were seen on a real Dokploy host. ## What you need before you start - A server with Docker, where you can run Dokploy. Install Dokploy first by following its own instructions at [docs.dokploy.com](https://docs.dokploy.com). - Two web addresses that point at that server, for example `app.example.com` (the web app) and `api.example.com` (the extension talks to this one directly). - The Social Crawl code in a Git repository that Dokploy can reach (your copy of the repository). - A computer with a terminal and [Node.js](https://nodejs.org) 20 or newer, to make your password's hash in step 2. Any recent Mac, Linux or Windows (with WSL or Git Bash) will do. ## Step 1: Choose your secrets You need three values. Make them now and keep them in a password manager. **The database password.** Letters and numbers only, because it is placed inside an address. ```bash openssl rand -hex 24 ``` You should see one line of 48 letters and digits, for example `9f2c…`. This is `POSTGRES_PASSWORD`. **The signing secret.** It signs your login and also encrypts the WebDAV password you may save later. ```bash openssl rand -base64 48 ``` You should see one line of 64 characters. This is `JWT_SECRET`. It must be at least 32 characters. > [!WARNING] > Keep `JWT_SECRET` the same for the life of the install. If you change it, every login stops working and a saved WebDAV password can no longer be read, so you would have to type it again in Settings. ## Step 2: Make your password's hash The server never stores your password. It stores a hash of it. This command makes the hash from a password you choose (at least 12 characters) without writing the password to a file: ```bash printf '%s' 'your password here' | node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>{const c=require('crypto'),salt=c.randomBytes(16);c.scrypt(s.replace(/\r?\n\$/,''),salt,64,{N:32768,r:8,p:1,maxmem:67108864},(e,k)=>{if(e)throw e;console.log('scrypt:'+salt.toString('base64')+':'+k.toString('base64'))})})" ``` You should see one line that starts with `scrypt:` and is exactly 120 characters long. This is `ADMIN_PASSWORD_HASH`. Copy the whole line. > [!TIP] > If you have the code checked out, the project's own command makes the same hash: `printf '%s' 'your password' | yarn workspace @social-crawl/api hash-password`. ## Step 3: Create the Compose service in Dokploy 1. In Dokploy, create a project, then add a **Compose** service. 2. Set the provider to **GitHub** (or the Git provider you use), pick your Social Crawl repository and the `main` branch. 3. Set the compose path to `./docker-compose.yml`. ## Step 4: Set the environment Open the service's **Environment** tab and paste these three lines, with your own values: ```text POSTGRES_PASSWORD=the-48-letter-value-from-step-1 JWT_SECRET=the-64-character-value-from-step-1 ADMIN_PASSWORD_HASH=scrypt:...the whole 120-character line from step 2 ``` The stack refuses to start without `JWT_SECRET` and `ADMIN_PASSWORD_HASH`. Every other setting has a default, and [Environment variables](https://crawl-docs.pdhq.win/advanced/environment-variables.md) lists them all. ## Step 5: Add the two domains On the **Domains** tab add: | Service | Port | Example address | | --- | --- | --- | | `web` | 3000 | `app.example.com` | | `api` | 4000 | `api.example.com` | Turn on HTTPS for both. Turn on **Auto Deploy**, so every change to the branch is built and started by itself. ## Step 6: Deploy Press **Deploy**. Dokploy builds two images (the first build takes several minutes) and starts three containers: `db` (the database), `api` and `web`. **What you should see:** the service's status turns to running, and the three containers are listed as healthy or running. ## Step 7: Check that it works Open `https://api.example.com/health` in a browser. You should see: ```json {"status":"ok"} ``` Then open `https://app.example.com`. You should see the sign-in page: the name **Social Crawl**, the line "Your saved posts, offline and in one place.", and a single **Password** box. > [!SCREEN] The sign-in page: a centred card on the app's soft background with the Social Crawl name and logo, the line "Your saved posts, offline and in one place.", one Password field and a sign-in button. Go on to [Sign in for the first time](https://crawl-docs.pdhq.win/guide/first-sign-in.md). ## Using plain Docker without Dokploy The compose file was written for Dokploy. It joins an external network named `dokploy-network` and publishes no ports, because Dokploy's proxy reaches the containers by name. To run it without Dokploy you would: 1. Create the network once: `docker network create dokploy-network`. 2. Put the three values in a `.env` file next to `docker-compose.yml`. 3. Run `docker compose up -d --build`. 4. Put a reverse proxy of your own in front, sending your web address to the `web` container (port 3000) and your API address to the `api` container (port 4000), with HTTPS. > [!NOT-TESTED] > This plain Docker route was not run. Use Dokploy if you can. ## Optional next steps - Keep files in Cloudflare R2 instead of on the server's disk: [Storage: WebDAV and R2](https://crawl-docs.pdhq.win/guide/storage-webdav-and-r2.md). - Use another PostgreSQL such as Neon: [Copy the database](https://crawl-docs.pdhq.win/guide/database-copy.md). - Make captions from the sound of videos: [Captions and transcripts](https://crawl-docs.pdhq.win/guide/captions-and-transcripts.md). - Back up the two Docker volumes: `bundles` holds your saved files and `pgdata` holds the database. --- # Sign in for the first time > Open the web app, sign in with your password, and see what an empty library and the Settings page look like. Source: https://crawl-docs.pdhq.win/guide/first-sign-in/ Last updated: 2026-12-02 Your server is running. This page signs you in and shows you around the empty app. ## Sign in 1. Open your web address, for example `https://app.example.com`. 2. Type the password you chose in [Install the server](https://crawl-docs.pdhq.win/guide/install-the-server.md#step-2-make-your-password-s-hash). The cursor is already in the box. 3. Press **Sign in**. **What you should see:** the library, empty, with a floating bar at the top. The bar holds the logo, the two places **Library** and **Settings**, a search box, the queue icon, **Add post**, the theme switch and **Sign out**. > [!SCREEN] The empty library: a rounded frosted-glass bar floats at the top with the logo, Library and Settings, the search box, the queue icon, the Add post button, the theme switch and a Sign out button. Below it is a page with no posts yet. ### If sign-in does not work | Message | What it means | What to do | | --- | --- | --- | | Wrong password. | The password does not match the hash the server was started with. | Type it again. If you are sure, make a new hash and replace `ADMIN_PASSWORD_HASH`, then redeploy. | | Too many attempts. Try again in a minute. | Five wrong tries from the same address in one minute. | Wait one minute. | | The server is unreachable. | The web app cannot reach the API. | See [Troubleshooting](https://crawl-docs.pdhq.win/guide/troubleshooting.md). | You stay signed in for 7 days. **Sign out** in the top bar ends it sooner. ## Look around The floating bar at the top is the same on every page. These are the places you will use: | Where | What it is | | --- | --- | | **Library** (the home page) | Everything you saved. See [Library and filters](https://crawl-docs.pdhq.win/guide/library-and-filters.md). | | **Add post** | Paste a link to a Bluesky post to save it without the extension. | | The queue icon | Everything the server is working on, such as a video being converted. See [The queue](https://crawl-docs.pdhq.win/guide/the-queue.md). | | **Settings** | The extension's token, storage, layouts, database and the theme. See [Settings](https://crawl-docs.pdhq.win/guide/settings.md). | ## Pick a theme In **Settings → Appearance** choose light, dark, or the same as your device. It is remembered on this device only. ## Next Install the extension: [Install the browser extension](https://crawl-docs.pdhq.win/guide/install-the-extension.md). --- # Install the browser extension > Get the Social Crawl extension from your own server, load it into Chrome, Edge or Brave, and connect it with a token. Firefox is not available yet. Source: https://crawl-docs.pdhq.win/guide/install-the-extension/ Last updated: 2026-12-02 The extension is the part that saves the page you are looking at. It is built by your server, so you download it from your own web app, not from a store. ## Which browsers work | Browser | Status | | --- | --- | | Chrome (version 111 or newer) | Works. This is the browser it was built and tested in. | | Edge, Brave | The app's own instructions name them. They load the same unpacked extension. They were not tested separately. | | Firefox (desktop) | Not available. A Firefox version is planned and not built. | | Android and phones | Not available. See [What is not tested](https://crawl-docs.pdhq.win/guide/what-is-not-tested.md). | > [!IMPORTANT] > On a phone or tablet there is no way to save a page with the extension today. You can still **read** your library on a phone: the web app works there. ## Step 1: Download it 1. Sign in to the web app and open **Settings**. 2. In the **Browser extension** section, find the card **Get the extension** and press **Download the extension**. **What you should see:** a ZIP file is downloaded. ## Step 2: Unzip it Unzip the file. You get one folder named `social-crawl-extension`. Put it somewhere permanent, such as your Documents folder: the browser reads the extension from that folder every time it starts, so do not delete it. ## Step 3: Load it into the browser 1. Open `chrome://extensions` in the address bar (in Edge: `edge://extensions`). 2. Turn on **Developer mode** (a switch, top right). 3. Press **Load unpacked** and choose the `social-crawl-extension` folder. **What you should see:** a card named **Social Crawl Capture** appears in the list. Pin its icon with the puzzle-piece menu in the toolbar, so it is always one click away. > [!SCREEN] The browser's extensions page with Developer mode switched on, and a card named Social Crawl Capture with version 0.0.1 and a reload button, in the list of extensions. ## Step 4: Create a token The extension needs two things to talk to your server: its address and a token that proves it is yours. 1. In the web app, open **Settings** and press **Create token** in the card **Extension token**. 2. Press **Copy token**. It is shown **once**, so copy it now. The token can only save posts. It cannot read or delete anything in your library. It is valid for 180 days: after that, create a new one and paste it in the same place. ## Step 5: Connect the extension 1. Open the extension's settings: click its icon on any page and then the gear, or open the extension's options page from the extensions list. 2. Under **Connection**, set **API address** to your API address, for example `https://api.example.com` (the address you gave the `api` service, not the web app's). 3. Paste the token into **Capture token**. 4. Press **Save settings**. The browser asks for permission to talk to that one address: allow it. **What you should see:** the word **Saved.** under the form. Next time you open the extension on a page it will not say "Not connected yet". ## Step 6 (optional): Set the web app address In the same settings, **Web app address** is where your library lives, for example `https://app.example.com`. It is used for the **Open in library** button, and so the web app's **Download video** button can ask this extension to fetch a video. Leave it empty and the extension uses the website of your API address. ## Updating the extension After your server is updated, download the extension again from **Settings**, replace the files in your folder with the new ones, then press the reload button on the extension's card in `chrome://extensions`. ## Next [Save your first post](https://crawl-docs.pdhq.win/guide/save-your-first-post.md). --- # Save your first post > Save a page with the extension, read what its panel tells you, add tags, and find the result in your library. Source: https://crawl-docs.pdhq.win/guide/save-your-first-post/ Last updated: 2026-12-02 With the server running and the extension connected, saving is two clicks. ## Save a page 1. Open a page you want to keep, in the browser where the extension is installed. An article or a blog post is a good first try. 2. Click the Social Crawl icon in the toolbar, or press **Alt+Shift+S**. A small panel opens on top of the page and reads it. The text at the top says **Reading the page…**, then **Ready to save**. > [!SCREEN] A small floating panel over the web page. Its header says Social Crawl and the site name with the word article or post, with a gear, a minus and a close button. Below the header is a card with the page's picture, its title and a line such as "Author · 4 min read · 3 pictures". At the bottom is a box with the hint "Tags: AI, travel" and a blue Save post button. 3. Optional: type tags in the **Tags** box, separated by commas, for example `travel, recipes`. See [Tags](https://crawl-docs.pdhq.win/guide/tags.md). 4. Press **Save post**. While it saves, the panel shows a progress bar and the line "You can keep browsing or close this: it goes on, and the icon shows the progress." You can close the panel or go on browsing. **What you should see when it is done:** a green check and **Saved to your library.** with two buttons: **Open in library** and **Save again**. ## What the panel can show | You see | What it means | | --- | --- | | **Not connected yet** and an **Open Settings** button | The extension has no address or token yet. See [Install the browser extension](https://crawl-docs.pdhq.win/guide/install-the-extension.md). | | **Already in your library**, with the date | You saved this page before. Saving again replaces the saved copy (your tags and note stay; videos you kept with it are removed unless you pick them again). | | **Videos to save** with a list | The page plays videos. Tick the ones you want, with their sizes shown. See [Video player](https://crawl-docs.pdhq.win/guide/video-player.md) and [Big videos and converting](https://crawl-docs.pdhq.win/guide/big-videos-and-converting.md). | | **Choose the article area** and **Save anyway** | The reader could not tell what the article is. See [Site rules in the extension](https://crawl-docs.pdhq.win/guide/site-rules-in-the-extension.md). | | A red message and **Try again** | The save failed. The message says why. See [Troubleshooting](https://crawl-docs.pdhq.win/guide/troubleshooting.md). | You can make the panel small (the minus button) and it stays on the page as a pill showing the state. Drag its top to move it. Press **Esc** to make it small. ## Find it in your library Press **Open in library**, or open the web app: your post is the first card. Click it to read it. See [The post page](https://crawl-docs.pdhq.win/guide/post-page.md). ## Save a post by link (Bluesky only) You do not need the extension for a Bluesky post: 1. In the web app press **Add post**. 2. Paste the link of the post under **Post link** and preview it. 3. Save it. Links from Facebook, Instagram, X, Pinterest and LinkedIn are refused with the message that those posts must be saved with the browser extension. Other web addresses are refused too, with the same advice: open the page in your browser and save it with the extension. ## Next See what the library can do: [Library and filters](https://crawl-docs.pdhq.win/guide/library-and-filters.md). --- # Library and filters > Find anything you saved: search by words, filter by site, account or tag, sort by date or size, and see what each group takes on disk. Source: https://crawl-docs.pdhq.win/guide/library-and-filters/ Last updated: 2026-12-02 The library is the home page of the web app. Every post you save is a card in it, newest first. > [!SCREEN] The library: a floating bar at the top, then a column of filters on the left (Platforms, Sites or accounts, Tags) and a grid of post cards on the right. Each card shows the post's picture or first words, who wrote it, which site it came from and its tags. A Sort button and a Share these posts button sit above the cards. ## Search The search box in the top bar looks at the author, the post's text or title, its tags, your note, the site and the platform. Type one or more words: a post must contain **every** word, in any order. Letter case does not matter. You can start a word with `#` to look for a tag, for example `#travel`. ## Filters Open **Filters** (a button on a phone) to narrow the cards. A line of **Active filters** shows what is on, with **Clear all**. | Filter | What it does | | --- | --- | | **Platforms** | The platforms your posts come from, such as Facebook, Instagram, X, YouTube or Web (every other website), each with a count. Picking several shows posts from any of them. | | **Sites** | Under **Web**: the websites your articles came from. Picking a site narrows Web to that site. | | **Accounts, pages or channels** | Under a platform: the people or channels behind your posts (YouTube has channels, Facebook has pages, the others accounts). Picking one narrows that platform to it. | | **Tags** | Tick tags. A post must have **all** the ticked tags. A tag in a different letter case counts as the same tag. | The lists of sites and tags show the biggest ones first, with a box to find one and **Show all** to see the rest. Each entry shows how many posts it holds and what they take on disk together. The count line **What these posts take together** adds up the size of the cards shown right now, and splits it by where the files are kept (the main storage and WebDAV). A full WebDAV copy counts on both sides. ## Sort The **Sort** button orders the cards: **Newest first**, **Oldest first**, **Largest first** or **Smallest first**. Equal sizes and dates keep the newest on top. **Largest first** is the quick way to find what fills your disk. ## Share these posts **Share these posts**, next to Sort, makes one temporary link to the cards shown at that moment, up to 50. See [Shares and downloads](https://crawl-docs.pdhq.win/guide/shares-and-downloads.md). ## An empty result If nothing matches, the library says **Nothing matches** and offers **Clear filters**. An empty library offers **Add a post** and **Get the extension**. ## Related - [Tags](https://crawl-docs.pdhq.win/guide/tags.md) for adding and changing tags. - [The post page](https://crawl-docs.pdhq.win/guide/post-page.md) for what you can do with one post. - [Restricted posts](https://crawl-docs.pdhq.win/guide/restricted-posts.md) for posts kept out of this view. --- # Tags > Add tags when you save a post or later, the rules a tag must follow, and how to find posts by tag in the library. Source: https://crawl-docs.pdhq.win/guide/tags/ Last updated: 2026-12-02 A tag is a short label you put on a post, such as `travel` or `machine learning`. Tags and your notes are only visible to you: they are never part of a shared link. ## Add tags when you save In the extension's panel, type tags in the **Tags** box, separated by commas: ```text AI, travel, machine learning ``` If a tag is not allowed, a message under the box says which one and why, and **Save post** waits until you fix it. ## Add or change tags later Open a post (see [The post page](https://crawl-docs.pdhq.win/guide/post-page.md)) and open its **Notes** window. It holds the post's **Tags** and a **Note** that only you can see. Add new tags and remove ones you no longer want. While you type, suggestions from the tags you already use appear. Press **Save changes** to keep them. **Escape** in the Notes window first closes the suggestions and then the window: two presses, on purpose. ## The rules for a tag - Letters (from any language), numbers, hyphens and spaces only. - At most 40 characters per tag, at most 30 tags per post. - It cannot start or end with a hyphen. - A `#` at the front is dropped, so `#travel` is saved as `travel`. - `Travel` and `travel` are the same tag; the first spelling you typed is kept. - Not allowed: `_`, `.`, `+`, emoji and other symbols. Commas separate tags, so a comma cannot be part of one. > [!NOTE] > A post that already has a tag that would not pass today's rules (for example `C++`) keeps it. It only stops you from adding new ones like it. ## Find posts by tag **In the library:** open **Filters**. The **Tags** list shows every tag with the number of posts and the space they take. Tick tags to narrow the library: a post must have **all** the ticked tags. See [Library and filters](https://crawl-docs.pdhq.win/guide/library-and-filters.md). **From a post:** the tags button in the post's toolbar shows how many tags it has. Open it, tick any of them and press **Search**. The library opens with exactly those tags on. **Clear** unticks them. A tag chip alone does not jump to the library: you tick, then search. **With the search box:** type `#travel`, or just the word. The search also looks in your notes. --- # The post page > Open a saved post and see how each kind is shown, then learn every button in its toolbar: notes, Markdown, share, download, WebDAV, original and delete. Source: https://crawl-docs.pdhq.win/guide/post-page/ Last updated: 2026-12-02 Click a card in the library to open the post. Social Crawl draws each kind of page in the way that suits it, from what was saved, with no network needed. | Kind | How it is shown | | --- | --- | | Social post | A card like the platform's own: the author, the text, a carousel for several pictures and videos, and cards for links in the text. | | Article (any web page) | A reading page with the title, author, date and the body: headings, paragraphs, lists, tables, quotes, code, pictures and videos in place, and files the page offered for download. | | Video (YouTube) | The player, with the description, chapters, transcript, captions and the first comments as they were. | | YouTube playlist | The playlist's card and its list of videos, as they were. The videos themselves are not downloaded. | | Film or show (IMDb, Rotten Tomatoes) | The poster, plot, scores, people, details and the strips of lists the page showed. | | GitHub repository | The README, plus the repository's sidebar: description, topics, numbers, licence, languages, releases and contributors. | > [!SCREEN] A post page on a wide screen. A bar under the top bar holds a Library button on the left, a tags button with a count, and a row of round icon buttons on the right. Under the bar is the post itself, drawn like the original page. ## The toolbar On a wide screen the buttons are icons in a bar under the top bar (hover for the name). On a phone the same actions are in a sheet that you open from a button in the top bar, with the tags at the top. | Button | What it does | | --- | --- | | **Library** | Back to the library. | | **Tags** | Opens the post's tags. Tick some and press **Search** to open the library on those tags. Shown only when the post has tags. | | **Notes** | Opens the **Your notes** window: the post's tags and a note, "Why did you save this?". A dot shows there is something in it. | | **Markdown** | On an article, switches the page into its rendered Markdown, with **Show source**, **Copy** and **Download .md**. On other posts, opens a dialog with the Markdown version, a **Copy** button and **Download .md**. | | **Saved size** | Not a button: it shows how much disk the post takes. | | **Share** | Makes a temporary link. See [Shares and downloads](https://crawl-docs.pdhq.win/guide/shares-and-downloads.md). | | **Download** | The post as a ZIP and other forms. See [Shares and downloads](https://crawl-docs.pdhq.win/guide/shares-and-downloads.md). | | **Storage** (named after where the post is) | Move a post between the main storage and WebDAV, or save a full copy to WebDAV. See [Storage, WebDAV and R2](https://crawl-docs.pdhq.win/guide/storage-webdav-and-r2.md). | | **Open the original** | Opens the post's address on the web, in a new tab. | | **Add to restricted** | Only shown while the restricted part is open. See [Restricted posts](https://crawl-docs.pdhq.win/guide/restricted-posts.md). | | **Delete post** | Deletes the post and its saved files. | ## The Markdown version Every saved post has a Markdown version for every platform and for articles. In the dialog, a switch chooses where links point: - **Saved files:** links point to the saved files (`images/0.jpg`), as in the download. Use it with the unzipped folder. - **Original links:** links point to the original online addresses, so the text works wherever you paste it. ## Deleting a post **Delete post** asks first (**Delete this post?**). When you confirm, the post disappears from the library at once and you get a few seconds to press **Undo**. When the countdown ends the post and all its files are deleted for good, on every storage it was kept on. > [!WARNING] > After the Undo countdown there is no way back. Download a ZIP first if you might want the post later. ## Saving a post again If you save a page that is already in the library, the saved copy is replaced whole. Your tags and note stay. Videos, subtitles and transcripts kept with it are removed unless you pick the videos again. The extension's panel says this before you press **Save again**. --- # Restricted posts > Keep some posts out of sight behind a second password, move them in by hand or by site and account rules, and open the restricted part when you need it. Source: https://crawl-docs.pdhq.win/guide/restricted-posts/ Last updated: 2026-12-02 The restricted part is a second, hidden library. Posts in it do not show in the normal library, its filters or its search, and nothing in the app tells that the restricted part exists until you open it. It is **off** until you give the server a second password. ## Turn it on Make a hash for the second password the same way as for your main one (see [Install the server](https://crawl-docs.pdhq.win/guide/install-the-server.md#step-2-make-your-password-s-hash)) and set it as `RESTRICTED_PASSWORD_HASH` in the service's environment, then redeploy. Without it nothing can be opened, and the app answers as if the part did not exist. ## Open it 1. Click the library's search box and type exactly `/restricted`. 2. Choose the suggestion that appears, the restricted part. 3. Enter the second password in the **Password** box and press **Continue**. **What you should see:** two tabs, **Library** and **Restricted**, and a button to close the restricted part. The unlock lasts as long as the browser is open, and at most 12 hours. ## Move posts in and out While the part is open: - On a post, press **Add to restricted** to move it in, and **Unrestrict** to move it back. - In **Settings**, a **Restricted** card lists rules: websites and accounts whose saves go to the restricted part by themselves. ### Rules Type a website or an account into **Website or account** and add it, for example: | You type | What it catches | | --- | --- | | `example.com` | That website and its subdomains. | | `example.com/blog` | Only that part of the website. | | `x.com/someone` | One account on a social site. | | `youtube.com/@channel` | One YouTube channel. | | `reddit.com/r/sub` | One subreddit. | A social site as a whole cannot be a rule, because everyone's posts there would disappear. It must name an account. `x.com` and `twitter.com` count as one site. When you add a rule, posts you already saved from it are moved in, and the card tells you how many. New saves from it go straight to the restricted part. ## Sharing a restricted post A restricted post can only be put into a shared link while the restricted part is open. Once it is in a link it is shared like any other: you chose to share it. > [!NOTE] > The restricted part is hidden, not encrypted. Its files sit in the same storage as the others. Anyone with access to your server's storage or database can see them. --- # Video player > Play saved videos, change speed and size, repeat a part, cut a clip, save a frame, and use every keyboard shortcut of the Social Crawl player. Source: https://crawl-docs.pdhq.win/guide/video-player/ Last updated: 2026-12-02 A video you saved plays in the app's own player, straight from your server. No outside site is contacted. > [!SCREEN] The video player: the picture fills the area, with a control bar along the bottom. On the left are play, back 10 seconds and forward 10 seconds, and the volume. In the middle is the seek bar, with the chapters marked on it when the video has them. On the right are the buttons for the transcript, subtitles, settings, picture in picture and full screen. ## The controls | Control | What it does | | --- | --- | | Play and pause, **Seek** bar | Click the picture or the button, and drag the bar. The player remembers where you stopped on this device (the last 200 videos). | | **Back 10 seconds**, **Forward 10 seconds** | Jump by ten seconds. | | **Volume** | Slider and mute. | | **In this video** and **Transcript** | Open the side panel with chapters and the transcript. You can search inside them, and the transcript can follow the video's time. | | **Subtitles** | Pick a subtitle file or turn them off. | | **Settings** | Speed, quality, subtitles, repeat and the clip tools. | | **Picture in picture** | Float the video above other windows. | | **Full screen** | Fill the screen. | ## Keyboard shortcuts Click the player first, so it has the keyboard. | Key | Does | | --- | --- | | Space or `K` | Play or pause | | `J`, `L` | Back or forward 10 seconds | | Left, Right arrow | Back or forward 5 seconds | | Up, Down arrow | Volume up or down | | `M` | Mute | | `F` | Full screen | | `C` | Cycle the subtitles | | `T` | Open the chapters and transcript | | `I` | Picture in picture | | `<` and `>` | Slower or faster (0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75, 2) | | `,` and `.` | One frame back or forward, while paused | | `Home`, `End` | Start or end | | `R` | Repeat the whole video | | `[` and `]` | Set the start and the end of a part to repeat | | `\` | Clear the repeat | | `Esc` | Close a menu | ## Settings menu **Speed** from 0.25 to 2. **Subtitles** lists the files saved with the video. **Repeat** repeats the video, or an A to B part you set with `[` and `]`. ### Quality The first line is the video as it was saved. Below it are the standard sizes that are smaller than the saved one: 1080p, 720p, 480p, 360p, 240p, 144p. A size that has not been made yet says so. **The server makes a smaller size the first time you pick it**, with ffmpeg. It takes a moment, a progress line shows in the queue, and the copy is kept next to the video for next time. You can delete a copy you do not want from the same menu. A smaller size is for slow connections. It is not added to the post's ZIP unless you choose **Bundle + all video sizes** when you download. See [Shares and downloads](https://crawl-docs.pdhq.win/guide/shares-and-downloads.md). ### Clip a part **Clip a part…** lets you choose a **Start** and an **End**, then: - **Play it** plays that part again and again, to check it. - **Copy a link to this part** makes a link to this page that opens the video at the start and stops at the end. - **Bundle with the post (ZIP)** downloads the post with this clip in place of the whole video. - **Exact cut (slower)** is off by default: it is instant, but the clip can start a few seconds early. The cut is made when you download. Nothing is added to the post. ### Other items - **Copy link to this moment** copies a link that opens the video at the current time. - **Save this picture** downloads the frame you are looking at to your computer as a PNG. It is not added to the post. - **Add a subtitle file…** adds a WebVTT file to the video. **Remove this subtitle file** deletes one. - **Make captions from the sound…** appears only if the server has speech recognition. See [Captions and transcripts](https://crawl-docs.pdhq.win/guide/captions-and-transcripts.md). ## If a video will not play - A size the browser cannot play is marked as blocked in the Quality menu. Pick another. - A video that was too big for the server to keep is a **big video**: see [Big videos and converting](https://crawl-docs.pdhq.win/guide/big-videos-and-converting.md). - A video saved as a link only (a stream the server could not join into one file) shows its picture and says it is online-only. --- # Big videos and converting > How videos larger than your server's limit are saved to WebDAV in parts, played and downloaded, and how to make a smaller copy and remove the raw video. Source: https://crawl-docs.pdhq.win/guide/big-videos-and-converting/ Last updated: 2026-12-02 A normal saved video lives in the post's own storage. A **big video** is one that is over your server's size limit. It is sent to your **WebDAV** storage in parts and treated like any other video afterwards. > [!IMPORTANT] > Big videos need WebDAV. Set it up first: [Storage: WebDAV and R2](https://crawl-docs.pdhq.win/guide/storage-webdav-and-r2.md). Without it, a video over the limit cannot be ticked in the extension's list and says why. ## The size limit The limit is the **Largest video (MB)** setting in **Settings → Storage → Videos**. Until you set it there, the server's own value is used (`MAX_VIDEO_MB`, 4096 MB by default, never more than 5000). It applies to the next video you save. **Reset** goes back to the server's value. ## Save a big video 1. Open the page in the browser and open the extension's panel. 2. In **Videos to save**, tick the video. A video over the limit is marked **Big**. 3. Press **Save post + video**. The panel says: your post is saved first, then a window opens and **has to stay open until the video is stored**. It can take a long time. 4. Leave the window open. It sends the video to your WebDAV in parts and shows progress. The extension's settings list big videos under **Big videos** until you forget them. > [!WARNING] > Closing the transfer window stops the sending. What the server already has stays. Open the transfer again and press **Resume**: it carries on where the server has it and sends only what is missing. The sending uses this computer's internet connection, and for a YouTube video the page must be open in this browser. ## What the post page shows On the post, a big video has its own panel. Depending on its state you can: - **Play it here** and **Download** the video. Parts are joined as they are read. A download of the parts can resume if it breaks. - **Make one file on my WebDAV**: join the parts into a single file, which makes playing and downloading simpler. **Remove the one-file copy** deletes only that copy. - **Check parts** to compare what is stored with what was sent. - **Remove this video from your WebDAV** to delete it. This asks first. A big video counts toward the post's size in the library, so **Largest first** puts it where it belongs. ## Make a smaller copy A big video can be converted into a much smaller file on your server. It never touches the original. 1. Press **Make a smaller copy** and pick **How small**: | Choice | What it does | | --- | --- | | **Smaller, quality kept** | AV1, 10-bit. The picture keeps its size and looks the same, at a fraction of the file size. | | **Much smaller** | AV1, 10-bit, stronger squeeze. Fine detail may soften. | | **1080p, small**, **720p**, **480p**, **360p**, **240p**, **144p** | AV1, 10-bit, no taller than that many lines. A size that would not be smaller than the video is greyed out with the reason. | 2. The server converts a **30-second sample** from the middle of the video and tells you how big the whole copy would be and about how long it would take. 3. Press **Convert** (or **Not now**). Nothing long-running starts before you press it. 4. The conversion runs in the background, **one at a time**, at low priority, with at most two processor threads, so the server stays usable. Several requests wait in a line. The queue icon shows them: see [The queue](https://crawl-docs.pdhq.win/guide/the-queue.md). **Stop** takes a job out. Sound is copied as it is, so surround and object sound (Atmos, DTS and others) stay untouched. **What it refuses:** - A picture taller than about 2200 lines (4K) is not converted at its own size, because it would take days. **1080p, small** makes the picture smaller first and can run. - A **Dolby Vision** video is not converted unless you choose **Convert anyway**. The message says: converting keeps its HDR10 colours but loses the Dolby Vision layer. HDR10+ extras were not specially handled and not tested. **HDR10 is kept:** the colour information is kept, and so are HDR10's **mastering numbers** (the display the video was graded on and its light levels). The server reads them from the first frame and gives them to the encoder. If the video has none, it is converted without them, and the sample's note says which. **Checks before it says Done:** the copy is smaller than the original, has the same length and the same sound tracks, decodes all the way through, and when read back from WebDAV has the same SHA-256 as what was sent. A copy under 9.5 GiB is stored as one file, a bigger one as parts of 256 MB. When it is done you can **Play it**, **Download it**, or **Remove this copy**. ### Watch while it converts **Watch while it converts** plays the video as far as it has been converted while the job runs. There is no seeking, because its length is not known yet. A size picked from the player's quality menu starts its conversion straight away, with no question. Once that size is **3%** along, its row says **Preparing 45% · watch it now** (with its own percent), and picking it swaps the player for this live preview. Before 3%, while waiting, or when finished, it behaves as before: a finished one is a normal pick and plays with seeking. The converted video is still stored on WebDAV **when it is done**, as one file (or parts, when over 9.5 GiB), because WebDAV refuses an upload with no length. So it streams while it converts and saves when it finishes. The live copy is removed at the end, and it needs room on the server's disk beside the result. ## Attach a file you converted yourself For a video the server cannot convert at its own size (an 8K video, for example), convert it on your own computer and attach the result. 1. On the big video's panel, press **Attach a file you converted yourself**. 2. Under **This file is the size**, pick which size the file stands for. Any size with no copy yet will do, and the server's own limits for 8K do not apply to a file you made. 3. Drop the converted file in the box, or press **Choose the converted file**. It is sent with progress. **Cancel** stops it, and the server throws the half file away. 4. The file joins the same one-at-a-time line as a server-made copy, and gets the same kind of checks. **What is checked:** your file must be **smaller** than the raw video (refused at once if not), **have a picture**, be the **same length** (within 1.5 seconds), have the **same number of sound tracks**, and **play all the way through** (decoded with ffmpeg). It is then stored on WebDAV (one file, or parts when over 9.5 GiB) and read back with the same fingerprint. If the original is HDR10 and your file is not, a note says so, but it does not stop the file: it is said, not judged. The server also needs about 1.1 times the file's size free on its disk while it checks it. It refuses when the original was already removed, when that size already has a copy (remove it first), or when a copy of that size is already being made. The copy shows as **Made by you**, and the queue says **checking your file** while it is checked. **Remove the raw video** then works on it exactly as on a server-made copy. The app never removes the raw video by itself. An attached file keeps the container it came in. It is stored as `video.mp4` and served as `video/mp4`, so a `.mkv` may not play in the browser. The checks only prove that ffmpeg can read it. ## Remove the raw video When a smaller copy has finished and passed every check, **Remove the raw video** deletes the original parts to free space. - It asks for **your password**, because it removes files for good. - It checks again, just before deleting, that the smaller copy is whole on WebDAV, and refuses otherwise. - The post then says the original was removed and only the smaller copy is kept. - **Social Crawl never does this by itself.** Only you can press it, and a failed or stopped conversion never removes anything. > [!WARNING] > Afterwards the raw video can no longer be downloaded, joined, checked or converted again. If the video is still online, you can save it again from its page. ## What has not been tried > [!NOT-TESTED] > Conversion was tested with real ffmpeg against a stand-in WebDAV server. It has not been run on a real server with a real long video, and the SVT-AV1 encoder was not tried on the server's own ffmpeg. HDR10 mastering numbers were tested on a synthetic file, not on a real HDR10 video through a whole conversion. "Watch while it converts" plays about as fast as the server converts, so a heavy video (8K, for example) is not real time and its preview runs behind and stalls. **Attach a file you converted yourself** was tested with real ffmpeg, but its dialog was not tried in a browser, and neither was a real 8K file or one over 10 GiB on a real WebDAV. --- # Captions and transcripts > Add subtitle files to a saved video, and optionally turn on speech recognition so your own server writes a transcript from the sound. Nothing leaves your server. Source: https://crawl-docs.pdhq.win/guide/captions-and-transcripts/ Last updated: 2026-12-02 A saved video can have two kinds of words with it. | Kind | What it is | Where it comes from | | --- | --- | --- | | **Subtitle files** | WebVTT files kept next to the video. | The site (YouTube's own captions, saved with the post), or a file you add yourself. | | **A transcript** | The words found by speech recognition, kept as its own small file. | Your server, only when you ask, and only if you turned the feature on. | The player's **Subtitles** menu and the **Transcript** panel use whichever exists. A transcript is kept apart from the subtitle files, and you can delete it any time. ## Use subtitle files 1. Open a video post and press **Settings** (the gear) in the player, then **Subtitles**. 2. Choose a file from the list, or **Off**. The `C` key cycles through them. 3. To add your own, choose **Add a subtitle file…** and pick a `.vtt` file. To remove one, choose **Remove this subtitle file**. For YouTube videos, the extension saves the uploader's captions, the automatic captions, and one automatic translation into the language you set in the extension's **YouTube** settings. **Save all subtitles** saves every track YouTube offers, which can be over a hundred files. ## Make a transcript from the sound This needs the speech recognition feature on your server. When it is off, the menu entry **Make captions from the sound…** is not shown at all. 1. In the player, open **Settings → Subtitles → Make captions from the sound…**. 2. The server listens to the video in pieces of 10 minutes and writes the words. The job shows in [The queue](https://crawl-docs.pdhq.win/guide/the-queue.md). 3. When it is done, the captions (CC) and the transcript panel use it. **It runs on your server.** Nothing is sent anywhere. It runs one video at a time, after the smaller copies waiting in the queue, and uses the processor threads you gave it while it works. **Delete it:** the X beside it in the Subtitles menu removes the file. Nothing else made from a video is saved with the post. A transcript is also included in the post's Markdown file and in a share link's Markdown, so an AI tool can read what is said in the video. ## Turn on speech recognition > [!NOTE] > This is optional and adds a large download. Skip it if you do not need transcripts. **With Docker or Dokploy:** set `API_TARGET=runtime-speech` in the service's environment (and `SPEECH_THREADS=2` on a server with 2 processors), then redeploy. That builds a second API image on Debian with CPU-only PyTorch, OpenAI's `openai-whisper` and its `base` model. | Thing | Value | | --- | --- | | Size | About 3 GB for the image. The first build downloads that much. | | Model | `base` (145 MB) by default. `SPEECH_MODEL_NAME=small` (484 MB) is about three times slower and better for accents, noise and other languages. | | Speed, measured | On 2 threads, `base` listened to a 162-second clip in 20 seconds and to a 40-minute sound in 254 seconds, using about 1.1 GB of memory. A slower or shared processor takes longer. | | Longest sound | `SPEECH_MAX_MINUTES`, 240 by default. | | Language | `SPEECH_LANGUAGE`: `auto` or a code such as `en`. | To switch it off, remove `API_TARGET` and redeploy. **Hosts the build must reach** (a firewall that limits outgoing traffic must allow them): `deb.debian.org`, `pypi.org`, `files.pythonhosted.org`, `download.pytorch.org`, `download-r2.pytorch.org` and `openaipublic.azureedge.net` (the model). When it runs, nothing is downloaded. **Your own program:** the server calls any program that takes whisper.cpp's `whisper-cli` options. Put it and a model file inside the API container and set `SPEECH_COMMAND` and `SPEECH_MODEL`. Both are needed; if either is missing or the file is not there, the feature stays off and the API's log says which one. See [Environment variables](https://crawl-docs.pdhq.win/advanced/environment-variables.md) for every speech setting. --- # The queue > The queue icon in the top bar lists everything the server is working on, with progress, and lets you stop a job or approve a conversion. Source: https://crawl-docs.pdhq.win/guide/the-queue/ Last updated: 2026-12-02 Some jobs take a while: making a smaller size of a video, converting a big video, sending a video to WebDAV, making captions, copying the database. The **queue** is where you see them all. ## Open it Click the queue icon in the top bar. The panel is titled **Queue** and says "Everything the server is working on, with how far each job is." A line below it reminds you that one video is converted at a time, at low priority. > [!SCREEN] A panel under the queue icon. Each row names a post, says what is being done in a few words (for example "720p copy" or "Sending to your WebDAV"), and shows a progress bar and a percent. A row that is waiting shows its place in the line. Each row has a Stop button. The icon shows a ring and a badge while there is something in the queue. ## What it lists | Group | Examples | | --- | --- | | Conversion | A smaller copy of a big video: measuring (the 30-second sample), waiting for you, converting, or **checking your file** (a file you converted yourself and attached). | | Video | Work around a saved video: finding its size, making a smaller size for the quality menu, making a transcript. | | Upload | A big video being sent to WebDAV, and one-file copies being made. | | Database | A copy to another database. | | YouTube | Saves made by the experimental link-saving feature. | ## The states - **Working:** the server is on it, with a percent when it is known. - **Waiting:** it is in the line. The number shows its place. - **Needs you:** a conversion has measured its sample and waits for your **Convert**. Open the post to decide. ## Stop a job Press **Stop** on a row. Each kind of job is stopped in its own way. A job that cannot be stopped from here has no button. Stopping a conversion never touches the original video. ## It runs on the server Closing the browser does not stop a job. Come back later and it is still there, or done. The queue refreshes by itself, and a live connection keeps it up to date; if your proxy blocks live connections, see [Troubleshooting](https://crawl-docs.pdhq.win/guide/troubleshooting.md). --- # Attachments > Attach another saved post, a file from your computer, or a link to a post, to keep related things together. Only you can see them. Source: https://crawl-docs.pdhq.win/guide/attachments/ Last updated: 2026-12-02 An attachment is something you hang on a saved post afterwards: another post of your library, a file from your computer, or a web link. Use it to keep a recipe with its photo, a paper with its source code, or a video with the notes about it. Attachments are **yours alone**. They are not part of the saved post, its ZIP or its shared page. ## Open the attachments On a post page, find the **Attachments** section. When there are none it says **Nothing attached yet**, and offers to attach another saved post, a file from this device, or a link. Press **Attach** and choose what. > [!SCREEN] The Attachments section of a post page. A heading "Attachments" with an Attach button. Below it a list of rows, each with an icon for its kind (a saved post, a file, a link), a title, and Open or Download and Remove buttons. ## Attach a saved post 1. Choose **Attach a saved post**. 2. Type in **Search your library** and pick the posts. The posts you pick are **linked**, not copied. If you later delete one, the attachment says **This post is no longer saved** and offers **Take it off**. **Open this post** goes to it. ## Attach files 1. Choose **Attach files**, then **Choose files** (or drop files into the box that says **Drop files here**). 2. Each file shows its progress. You can cancel an upload, or remove one from the list. **Where a file goes follows your storage settings** (**Settings → Storage**), the same rule as for every other large file. The dialog states the rule that applies to you: | Your WebDAV | What happens | | --- | --- | | Set up, and **Store large files on WebDAV** is on | A file of at least the size set there (25 MB by default) goes to WebDAV. Smaller files stay on your server. | | Set up, but moving large files is off | Files stay on your server, up to 100 MB. A bigger file is refused, and the message says to turn on moving large files in **Settings → Storage**. | | Not set up | Files stay on your server, up to 100 MB. A bigger file is refused, and the message says to set up WebDAV in Settings first. | A file that goes to WebDAV can be 10 GB at most. The 100 MB limit on your server is a safety cap. See [Storage, WebDAV and R2](https://crawl-docs.pdhq.win/guide/storage-webdav-and-r2.md). A file that does not arrive whole is removed, and uploads carry on if you close the window. ## Attach a link 1. Choose **Attach a link** and paste the **Address**. 2. The page title is found for you. You can change it in **Title**. 3. Press **Attach the link**. Nothing is downloaded: only the link and its title are kept. ## Limits A post can have at most **200** attachments. ## Remove an attachment Press **Remove** on the row. Removing a file deletes its stored copy. Removing a post attachment only takes off the link. --- # Shares and downloads > Download a post as a ZIP, Markdown or with video frames, and make temporary links, for one post or for up to 50, that people and AI tools can open without signing in. Source: https://crawl-docs.pdhq.win/guide/shares-and-downloads/ Last updated: 2026-12-02 ## Download a post On a post, open **Download**. The menu asks **How do you want this post?** | Choice | What you get | | --- | --- | | **Bundle (ZIP)** | The post with its images and video, exactly as saved. Unzip it and open `index.html`. | | **Bundle + all video sizes** | The same, plus the smaller sizes the player made for its quality menu. Shown once the post has any. | | **Markdown file (for chat apps)** | One text file: the post's text, the original addresses of its pictures, and what its videos say (subtitles or transcript written out as text). | | **Light ZIP (no videos)** | Pictures and text only, small enough for a chat app. The pages are redrawn so nothing points at a file that is not there. | | **Bundle + a frame per second** | The bundle plus a picture for every second of each saved video. | | **Bundle + every frame** | The bundle plus every frame. Large. | The frames are cut out **while the file downloads** and are never stored, so saved posts stay small. They go under `frames//` in the ZIP, next to a `README.txt` with the frame rate. A progress window shows how far it is (the live progress needs the event stream to work through your proxy). To cancel, cancel the download in your browser. > [!NOTE] > The plain bundle is the post as it was saved. The smaller video sizes the server made for the player are not in it unless you choose **Bundle + all video sizes**. ### What is inside a bundle ```text bluesky/3kabc/ ├── index.html works offline: no scripts, no network ├── post.json the source of truth: the post and a SHA-256 of every file ├── post.md the Markdown version ├── text/post.txt the plain text ├── images/ 0.jpg, avatar.jpg, poster-0.jpg ... └── videos/ 0.mp4 ... ``` ## Share a post with a temporary link Some people and some AI tools cannot sign in. **Share** makes a link that works for a time you choose. 1. Open the post and press **Share**. 2. Pick how long it lasts under **Works until**: 1 hour, 1 day, 7 days, 30 days, or a date. You can add a label so you remember who it was for. 3. Press **Make the link**. Copy the address you want (the page, the Markdown, the data or the ZIP) with its Copy button. You can extend a link later (for example **+1 hour**) or remove it. The link looks like `https:///s/`. Whoever has it can read **that one post** and download it. Your notes and tags are never shared. You can extend or remove the link at any time. | Address | What it is | | --- | --- | | `/s/` | The post as a page, made on the server so a tool that does not run scripts can read it. | | `/s//md` | Markdown with full picture and file addresses and the words of videos that have a transcript or subtitle file. **This is what to give an AI.** | | `/s//json` | The post as data. | | `/s//zip` | Everything saved with it, as a ZIP. | | `/s//md?download=1` | The same Markdown saved as a file, for a chat app's upload button. | | `/s//zip?light=1` | The ZIP without videos. | The dialog also offers an AI-friendly ZIP with a frame per second, or every frame (no video file). **Time and counts.** A removed or unknown link answers 404. One whose time is up answers 410 ("expired"). Each fetch is counted with who made it (the `User-Agent`), and the Share dialog shows it, so you can tell whether an AI tool really opened the link. The secret is 32 random bytes and the database keeps only its SHA-256, which is why it can be shown only once. > [!IMPORTANT] > For an AI tool to reach a link, Social Crawl must be reachable from the internet, and whatever sits in front of it (a firewall, Cloudflare's bot or AI-crawler blocking) must let `/s/` through. The dialog's **Check that it opens from the internet** button tries it once from the server. You can start the video at a part (**Start at**, **End at**) so a link to a video post opens at a moment. ## One link to several posts The library's **Share these posts** button, next to the sort button, makes **one** link to the posts the library shows at that moment, after the filters, the search and the sort. At most **50**: if more are shown, the first 50 are used and the dialog says so before you make the link. It is a snapshot: posts you save later are not in it, and a post you delete later drops out while the others keep their numbers. | Address | What it is | | --- | --- | | `/s/` | A page that lists the posts (author, start of the text, size) with each one's own links and the forms of everything at once. | | `/s//md` | All the posts as one Markdown text, each after ``. `?download=1` saves it as a file. | | `/s//json` | `{ "posts": [{ "n": 1, "post": { ... } }, ...] }` | | `/s//zip` | One **light** ZIP of all of them (pictures and text, no videos), one folder each starting with its number such as `03-x-123/`. | | `/s//p/`, `/p//md`, `/p//json`, `/p//zip` | Post number `n` alone (`?light=1` leaves out the videos). | An unknown number, or a post that was deleted, answers 404. A restricted post can only be put in while the restricted part is open: see [Restricted posts](https://crawl-docs.pdhq.win/guide/restricted-posts.md). --- # Layouts > Change how saved web pages from one site are shown, with a small template and a live preview, without changing what was saved. Source: https://crawl-docs.pdhq.win/guide/layouts/ Last updated: 2026-12-02 A **layout** decides where the parts of a saved web article go on the page: title, author, date, the body, and so on. It is set **per website**. A site with no layout is shown the normal way. A layout only changes how a saved web **article** is shown. It never changes what was saved, and no scripts or raw HTML can get in: the template's text is escaped. ## Where a layout is used | Place | Uses the layout? | | --- | --- | | The saved page (`index.html`) of a post, and every ZIP of an article | Yes. A ZIP of a post saved before the layout existed holds the layout page too. | | A page drawn on demand at `bookmarks//files/layout.html` | Yes. This is what the editor's preview shows. | | The post page in the web app | **Not yet.** The app shows an article with its own view. | | The live view of a shared page for an old post | **Not yet.** The stored `index.html` of an old post is only redrawn when the post is saved again. | A page whose layout cannot be read falls back to the normal page. ## Where **Settings → Layouts** lists **Your sites**: the layout each site uses. It starts empty ("No site has a layout yet"). Under **Starting points** there are five to copy and change (**Copy it to edit**): Article, Docs, Product, Recipe and Thread. ## Make a layout 1. Press **Add a site**, or **Edit** on an existing one. 2. Fill in **Name** and **Site** (for example `recipes.example`). A site also covers its subdomains, and the most specific site wins: a layout for `docs.example.com` beats one for `example.com`. 3. Write the **Template**. Under **Parts you can use**, click one to put it where your cursor is. 4. Choose **Preview on** one of your saved pages of that site (it says **No saved page of this site** if you have none yet) and look at **Preview of the layout**. Errors are shown with their line number. 5. Save. At most 100 layouts can exist, one per site. > [!SCREEN] The layout editor. On the left a box for the template with a list of parts above it that you can click. On the right the live preview of a saved page of that site, drawn with the template. Errors show under the box with their line numbers. ## The template language Square brackets mark a part. Everything else is plain text, shown as a paragraph. | Write | Gives | | --- | --- | | `[title]` `[author]` `[avatar]` `[date]` `[site]` `[reading]` `[original]` `[saved]` | One fact of the post. It is left out when the post has no such data. | | `[body]` | Every part of the article that no `[part]` placed. | | `[part "Ingredients"]` | The heading with that name and everything under it, up to the next heading of the same or higher level. | | `[rule]` | A divider line. | | `[columns 2]` ... `[next]` ... `[/columns]` | Two or three columns. On a phone they stack. | | `[box tone=info]` ... `[/box]` | A framed note. The tone is `info`, `warn` or `note`. | A small example for a recipe site: ```text [title] [author] [date] [columns 2] [part "Ingredients"] [next] [part "Method"] [/columns] [box tone=info] Saved copy of the recipe. [/box] [body] ``` A layout is at most 20,000 characters. Columns and boxes can sit inside each other up to a few levels. It has no scripts and no HTML: text is escaped, and the result is drawn with fixed classes. See [The layout language](https://crawl-docs.pdhq.win/advanced/layout-language.md) for the exact rules. --- # Site rules in the extension > When the extension saves the wrong part of a page, point at the right part with the mouse. It makes a rule for that site that you can edit, export and share. Source: https://crawl-docs.pdhq.win/guide/site-rules-in-the-extension/ Last updated: 2026-12-02 For most pages the extension finds the article by itself. When it gets a site wrong (nothing found, the wrong part, a page built only from plain boxes) you can teach it that one site. The lesson is a **site rule**, kept in the extension itself. ## Choose the article area 1. Open the page and click the extension's icon. 2. If the reader could not decide, the panel offers **Choose the article area**. For an article it is always there, under the save button. 3. Move the mouse over the page. The part under the pointer is outlined. Click the part you want to save. 4. Make the choice bigger or smaller with the **Up** and **Down** arrow keys or the toolbar. **Enter** confirms, **Esc** cancels. 5. The rule is saved for that site. Click the icon again and save the page. > [!SCREEN] A web page with one part outlined in blue under the mouse pointer, and a small bar at the top of the page with the buttons for bigger, smaller, confirm and cancel, and a short line of help. The panel says when a rule is used for the page. **Forget it** removes the rule. If a rule stopped working because the site changed, the button reads **Fix the rule**. ## A page with very little text A page with very little text offers **Save anyway**. A short post with a picture is saved without asking. ## Edit, export and import rules Open the extension's settings, **Site rules**: - **Add or edit a rule (JSON)** lets you write a rule by hand, then **Save rule**. - **Export my rules** and **Import rules** move your rules to another browser or share them. - **Built-in rules** lists the ones that come with the extension. Your own rule for a site always wins over a built-in one. A rule is only a set of CSS selectors and a few switches. It never runs code. The fields are described in [Site rules](https://crawl-docs.pdhq.win/advanced/site-rules.md). ## What works without any rule These work on every page already: - Plain `
` boxes and ARIA accordions are opened while reading. - Pages built from many blocks (Notion and similar) are scrolled once and every block is kept, even those the page throws away when they leave the screen. - A file card (a button holding a file name and size) is saved as a file. - Links inside the article that download with one click are saved with it, of any type: documents, archives, programs, data, audio, video, design files. The extension recognises them by their file ending, by the `download` attribute, or by a download hint in the address (such as `?dl=1`). Links to pages stay links. The server keeps up to **20 files of at most 50 MB per post**. A link that answers with a web page stays online-only. ## Built-in rules The extension ships rules for a few well-known sites. X Articles (the long pieces at `x.com//article/`), GitHub repositories (the README) and Notion pages are among them. **Built-in rules** in the extension's settings lists them all. They were checked against the sites' markup as known, not on the live pages. A Notion page was checked against real saved copies; Notion toggles were not on that page and are untested. > [!NOT-TESTED] > The readers for Facebook, Instagram, X posts, Pinterest and LinkedIn are separate from site rules and were not tested on the live sites. See [What is not tested](https://crawl-docs.pdhq.win/guide/what-is-not-tested.md). --- # Settings > A tour of the Settings page in the web app: appearance, the browser extension, storage, layouts, the database and the restricted part. Source: https://crawl-docs.pdhq.win/guide/settings/ Last updated: 2026-12-02 Open **Settings** from the top bar. The page is one column of sections, from top to bottom: | Section | What it is for | | --- | --- | | **Appearance** | Light, dark, or the same as this device. Remembered on this device only. | | **Browser extension** | **Download the extension** and create the **Extension token**. See [Install the browser extension](https://crawl-docs.pdhq.win/guide/install-the-extension.md). | | **Storage** | Where saved posts keep their files: **WebDAV storage** and **Videos** (the largest video). See below. | | **Layouts** | How saved web pages of one site are shown. See [Layouts](https://crawl-docs.pdhq.win/guide/layouts.md). | | **Database** | Copy your library to another PostgreSQL, and later delete the old one. See [Copy the database](https://crawl-docs.pdhq.win/guide/database-copy.md). | | **Restricted** | Only shown while the restricted part is open: rules for sites and accounts. See [Restricted posts](https://crawl-docs.pdhq.win/guide/restricted-posts.md). | > [!SCREEN] The Settings page as one centred column. Each section has a large heading, a short grey line under it, and one or more rounded cards with fields and buttons. The sections follow one another: Appearance, Browser extension (with its steps, the download card and the token card), Storage, Layouts, Database. ## Storage **WebDAV storage** keeps big files off your main storage. It has its own page: [Storage: WebDAV and R2](https://crawl-docs.pdhq.win/guide/storage-webdav-and-r2.md). **Videos** has one setting, **Largest video (MB)**: the biggest video the server accepts, whether the extension sends it or the server downloads it. A video over the limit is a [big video](https://crawl-docs.pdhq.win/guide/big-videos-and-converting.md). The value you save here applies to the next video, and **Reset** goes back to the server's own value (`MAX_VIDEO_MB`, 4096 by default). ## Who can use Settings Only the web login can see or change Settings. The extension's token cannot: it can only save posts. ## Sign out **Sign out** is in the top bar of every page. A sign-in lasts 7 days. --- # Storage, WebDAV and R2 > Where saved files live, how to keep them in Cloudflare R2, and how to offload large files and whole copies to your own WebDAV storage. Source: https://crawl-docs.pdhq.win/guide/storage-webdav-and-r2/ Last updated: 2026-12-02 Your saved files (pictures, videos, ZIP pages) live in one of three places. Posts and tags are in the database, not here. | Place | When | How to set it up | | --- | --- | --- | | **The server's disk** | The default. Files sit in the `bundles` volume. | Nothing to do. | | **Cloudflare R2** (or any S3-compatible bucket) | You want the files off the server. | Environment variables, below. | | **Your WebDAV storage** | You want large files or full copies kept elsewhere, next to the main storage. | **Settings → Storage → WebDAV storage**. | The main storage is the disk or R2. WebDAV is always an addition to it. ## Use Cloudflare R2 R2 offers 10 GB free. Create a bucket and an access key limited to that bucket, then set these in Dokploy's Environment and redeploy: ```text STORAGE_DRIVER=s3 S3_ENDPOINT=https://.r2.cloudflarestorage.com S3_BUCKET=social-crawl-media S3_REGION=auto S3_ACCESS_KEY_ID=... S3_SECRET_ACCESS_KEY=... ``` All four of `S3_ENDPOINT`, `S3_BUCKET`, `S3_ACCESS_KEY_ID` and `S3_SECRET_ACCESS_KEY` are needed once the driver is `s3`, and the endpoint must start with `https://`, or the server refuses to start and says which is missing. The bucket stays **private**. The server streams files out of it, with range support for video seeking, so your login still protects everything. **Posts already on the disk** are copied once with this command, run with the S3 settings in place: ```bash docker exec node apps/api/dist/scripts/migrate-storage.js ``` It can be run again and leaves the disk files untouched. Remove `STORAGE_DRIVER` to go back to the disk. > [!NOT-TESTED] > The R2 path was only tried against a local S3-compatible server, never against real Cloudflare R2. ## Use WebDAV WebDAV is a protocol many cloud storages speak (Nextcloud, ownCloud and others). Social Crawl uses it for large files, and to keep a full copy of a post. ### Set it up 1. Open **Settings → Storage → WebDAV storage**. 2. Fill in **WebDAV folder address** (it must start with `https://`; `http://` is accepted only for localhost, and the address must not contain a user name or password), **User name** and **Password**. 3. Press **Test connection**. It lists the folder, creates a `social-crawl` folder, writes a small file, reads it back and deletes it, and tells you which step failed. A message such as "wrong user name or password?" means a 401, and "is the address the WebDAV folder?" means the address was not found. 4. Turn on **Store large files on WebDAV** and set **Large file size (MB)** (25 by default). ### What goes there With the switch on, new **videos and sound files, and any file from the size limit up**, are written to `/social-crawl///` instead of the main storage. Files already saved stay where they are. Each bundle keeps a small `.webdav.json` on the main storage that says which of its files are on WebDAV. Playing a video (with seeking), the ZIP download and frame export read a file from whichever side it is on, and deleting a post deletes its files on both sides. If an upload to WebDAV fails while a post is saved, that file goes to the main storage instead, and the server log says so. ### Per post A post has a storage menu in its toolbar. Its name says where the post is (for example "On WebDAV"), or just **Storage**. At the top it counts the files and bytes on each side, for example "WebDAV: 3 files (1.2 GB)", and adds "plus a full copy on WebDAV" when there is one. It offers four actions: | Action | What it does | | --- | --- | | **Keep only on WebDAV** | Moves everything to WebDAV, then deletes it from the main storage. Off until WebDAV is set up. | | **Keep only on the main storage** | Brings everything back from WebDAV, then deletes it from WebDAV. | | **Save a copy to WebDAV** | A full copy of every file, kept on both sides, for safekeeping. Deleting the post deletes the copy too, and saving the post again replaces it. | | **Move large files to WebDAV** | Videos and big files leave the main storage. For posts saved before WebDAV was set up. | The two "Keep only" actions ask you to confirm first. All four run on the server and report progress, and closing the window does not stop them. With WebDAV not set up the actions are greyed out and the menu offers **Open Settings**. ### The password The password is stored **encrypted** (AES-256-GCM, with a key made from `JWT_SECRET`) and is never sent back to the browser. If `JWT_SECRET` changes, the saved password can no longer be read: enter it again in Settings. Until then, files on WebDAV cannot be read. ### Playing from WebDAV Playing or jumping about in a large video asks WebDAV only for the parts you watch. The server keeps those parts on its own disk (`VIDEO_CACHE_MB`, 2048 by default; `0` turns it off) and removes the least recently used ones when it is over, and parts nobody used for a day. A part that is playing is never removed. > [!NOT-TESTED] > The read cache was tried against a local WebDAV server, not a real one. A clip, and the bundle with a clip, of a video that is on WebDAV was not tried either. ## Back up Back up the two Docker volumes: `bundles` (saved files) and `pgdata` (the database). If you use R2 or WebDAV, back those up in their own way. --- # Copy the database > Move your library's posts, tags and share links to another PostgreSQL such as Neon, check the copy, switch over, and later delete the old data. Source: https://crawl-docs.pdhq.win/guide/database-copy/ Last updated: 2026-12-02 Your posts, tags, notes, share links and settings are kept in a PostgreSQL database. Your saved **files** (pictures, videos) are not in it: they stay on the disk, in R2 or on WebDAV, and moving the database does not touch them. By default the database is the `db` service of your stack. If you would rather use a hosted one, such as [Neon](https://neon.com), Social Crawl can copy everything over from **Settings → Database**. There are two cards for two separate steps. In both, the **old database** is the one you are leaving and the **new database** is the one you are moving to. > [!WARNING] > Do not save posts while the copy runs: a post saved during the copy is not included. Switch right after it finishes. ## Step 1: Copy to a new database Card: **Copy to a new database**. 1. In Dokploy's **Environment**, add `MIGRATE_TO_DATABASE_URL` with the address of the new database, and restart the server: ```text MIGRATE_TO_DATABASE_URL=postgres://user:password@host/database?sslmode=require ``` Use the **direct** address (for Neon: the one without `-pooler` in it) and keep `?sslmode=require`, so the data is encrypted on its way. 2. Open **Settings → Database** and press **Check**. It only looks at both databases and changes nothing. If something is marked with a red cross, fix it and press **Check** again. The new database must be **empty** and have the `uuid-ossp` add-on. 3. Press **Copy now**. The page shows the progress, the speed (MB/s) and the time left. **Cancel** stops it. 4. When it says **Done**: in Dokploy set `DATABASE_URL` to the new address, remove `MIGRATE_TO_DATABASE_URL`, and redeploy. The card says "What to do next" and shows these two steps. The app now uses the new database. Until you set `DATABASE_URL`, the app uses the `db` service of this stack. **Safety:** the copy only reads the old database, so nothing in it is changed. If anything goes wrong, or you press **Cancel**, the new database is left empty. The copy is kept only if every table in the new database matches the original. Nothing in the new database is overwritten. ### After the switch Once `DATABASE_URL` is set you can remove `POSTGRES_PASSWORD`, `POSTGRES_USER` and `POSTGRES_DB`. The stack still starts its own `db` service with your old data in it (the volume `pgdata`), so the old database stays available as a backup, and Step 2 can reach it. > [!IMPORTANT] > A brand-new install that has never run this stack's own database needs `POSTGRES_PASSWORD` (any value) even with `DATABASE_URL` set, because that database has to be created once. If neither `DATABASE_URL` nor `POSTGRES_PASSWORD` is set, the deploy goes through but the API does not start. Its log says: `DATABASE_URL: points to the database in this stack (sc-db) but has no password: set POSTGRES_PASSWORD ... or set DATABASE_URL to another database`. ## Step 2: Delete the old database's data Card: **Delete the old database**. Do this **later**, only when the app already runs on the new database and everything works. 1. In Dokploy's **Environment**, add `OLD_DATABASE_URL` with the address of the old database, and restart the server. 2. Open **Settings → Database** and press **Compare old and new**. It reads both databases, row by row, and changes nothing. 3. If they match, **Delete old data…** is switched on. If they do not match, it stays off and the page shows what is different, table by table: rows only in the old database (what deleting would lose), rows only in the new database, and rows that changed (it names the columns, never the values). Some difference is normal if you have used the new database since you switched. If you accept it, tick **Delete anyway. I have looked at what is different.** 4. Press **Delete old data…** and enter your password. It always asks again. **Safety:** it never deletes the database the app is using, also when the old address is only another way to reach it. It removes only this app's own tables, all together or not at all, and leaves everything else in that database. The empty database and its user stay. Afterwards remove `OLD_DATABASE_URL`. If the old database was this stack's own `db` service, its container keeps running and its disk stays in use. To stop it for good, remove the `db` service from `docker-compose.yml` (the file lives in the repository, not in Dokploy), and delete the `pgdata` volume in Dokploy to free the disk. ## Tables are made by the server The tables are created by TypeORM `synchronize` (`DB_SYNCHRONIZE`, on in the compose file). There are no migrations yet. See [Data model](https://crawl-docs.pdhq.win/advanced/data-model.md) for what that means for you. --- # Troubleshooting > Real problems seen with Social Crawl, the message you see for each, what it means and what to do. Start with the part that matches where it goes wrong. Source: https://crawl-docs.pdhq.win/guide/troubleshooting/ Last updated: 2026-12-02 Find the part that matches where it goes wrong. Each problem has the words you will actually see. ## The server does not start or deploy ### The deploy stops: "set JWT_SECRET (32+ chars)" or "set ADMIN_PASSWORD_HASH" Docker Compose refuses to start the stack without them. Add both in Dokploy's **Environment** and redeploy. See [Install the server](https://crawl-docs.pdhq.win/guide/install-the-server.md). ### The API starts and stops at once: "Invalid environment: …" The API checks its settings at start and says which is wrong. The common ones: | Message contains | What is wrong | Fix | | --- | --- | --- | | `JWT_SECRET: must be at least 32 characters` | The signing secret is too short. | Use `openssl rand -base64 48`. | | `ADMIN_PASSWORD_HASH: must look like scrypt::` followed by a reason | The hash was pasted wrong. The reason says how: it does not start with `scrypt:`, has a line break, contains `$` (the old format), or "is only N characters (a real hash is 120; it may be cut off)". | Make the hash again and paste the whole line on one line. Quotes and spaces around it are removed for you. | | `DATABASE_URL: points to the database in this stack (sc-db) but has no password` | `POSTGRES_PASSWORD` is empty and `DATABASE_URL` is not set. | Set `POSTGRES_PASSWORD` in Dokploy's Environment, or set `DATABASE_URL` to another database. | | `S3_ENDPOINT: is required when STORAGE_DRIVER=s3` (or another `S3_` name) | R2 is switched on without all of its settings. | Set all four, or remove `STORAGE_DRIVER`. | | `S3_ENDPOINT: must start with https://` | The address has no `https://`. | Add it. | ### The API's log says `getaddrinfo EAI_AGAIN sc-db` The database container is not running or is not on the stack's network. Open the `db` service in Dokploy's **Logs** tab. The compose file puts every service on a private `backend` network and on Dokploy's `dokploy-network`, and the services reach each other as `sc-db` and `sc-api`. ### The deploy is fine but the API does not start, with no `DATABASE_URL` or `POSTGRES_PASSWORD` The API's log says `DATABASE_URL: points to the database in this stack (sc-db) but has no password`. Set `POSTGRES_PASSWORD` (any value on a brand-new install, because the database has to be created once). > [!NOT-TESTED] > Deploying with `DATABASE_URL` set and `POSTGRES_PASSWORD` removed failed on a real Dokploy host more than once and has been fixed. It was checked by resolving the compose file with a newer Compose and by reading an older Compose's source, but not run again on the real host. If it fails for you, the API's log says why. ## Signing in | You see | What it means | What to do | | --- | --- | --- | | **Wrong password.** | The password does not match the stored hash. | Try again, or make a new hash and replace `ADMIN_PASSWORD_HASH`. | | **Too many attempts. Try again in a minute.** | Five wrong tries in one minute from the same address. | Wait a minute. | | **The server is unreachable.** | The web app cannot reach the API. | Check the `api` service is running, and that `API_URL` of the web service is `http://sc-api:4000`. | | You are sent back to the sign-in page | Your 7-day sign-in ended. | Sign in again. | ## The extension | You see | What it means | What to do | | --- | --- | --- | | **Not connected yet: add your server's address and token in Settings first.** | No address or token saved. | See [Install the browser extension](https://crawl-docs.pdhq.win/guide/install-the-extension.md). | | **The server rejected the token. Create a new one in the web app.** | The token is wrong, or older than 180 days. | In the web app, **Settings → Create token**, and paste the new one. | | **Could not reach the server. Check the internet connection and the address…** | The API address is wrong, or the server is down. | Use the **API address** (the `api` domain), with `https://` and no path. | | It saved the wrong part of a page | The automatic reader guessed wrong. | [Site rules in the extension](https://crawl-docs.pdhq.win/guide/site-rules-in-the-extension.md). | | Nothing is found on Facebook, Instagram, X, Pinterest or LinkedIn | Those readers are best-effort and were never tested on the live sites. | Save the page with Ctrl+S ("Webpage, complete") and send it to whoever maintains your copy: a real saved page is the most reliable way to adjust the reader. | On a phone you cannot use the extension at all. See [Install the browser extension](https://crawl-docs.pdhq.win/guide/install-the-extension.md). ## Videos | You see | What it means | What to do | | --- | --- | --- | | A video over the size is not tickable and says **Over your server's … limit: needs a WebDAV** | It is a big video and WebDAV is not set up. | [Storage, WebDAV and R2](https://crawl-docs.pdhq.win/guide/storage-webdav-and-r2.md). | | **A smaller size may play: open the settings, then Quality.** | Your browser cannot play the saved format. | Pick a smaller size in the player's Quality menu. | | YouTube video is not in the list or cannot be saved on the server | YouTube refuses servers. | In the extension's **Videos** settings, choose **Download it through this browser**. | | A video stays online-only | It was a stream that could not be joined into one file (not public, encrypted, or over 200 MB), or a type that is not handled (DASH `.mpd`). | The picture and frames are still saved. | | The transfer window of a big video stopped | It was closed or the connection broke. | Open it again and press **Resume**: it sends only what is missing. | | The server's temp disk fills up while saving | While a post is saved the server needs about **twice** the video's size free on its temp disk. | Free space, or set `UPLOAD_DIR` to a bigger disk, or lower `MAX_VIDEO_MB`. | | No frames in a ZIP download | ffmpeg is needed. It is in the API's Docker image. | In local development install it (`apt install ffmpeg`). | ## Live progress does not move Progress windows (frame downloads, WebDAV copies, the queue) use a live connection (server-sent events). If a proxy in front of Social Crawl blocks or buffers it, the progress stays still while the work goes on. Let the path `/api/events` through without buffering. The library's live updates use the same connection. ## Share links | You see | What it means | | --- | --- | | The link answers **404** | It was removed, or the address is wrong. | | The link answers **410** ("expired") | Its time is up. Extend it, or make a new one. | | An AI tool says it cannot open it | Social Crawl must be reachable from the internet, and whatever is in front of it (a firewall, Cloudflare's bot or AI-crawler blocking) must let `/s/` through. Use the dialog's **Check that it opens from the internet** button. | ## WebDAV **Test connection** says which step failed. A `401` adds "(wrong user name or password?)". A `404` on listing adds "(is the address the WebDAV folder?)". If you changed `JWT_SECRET`, the saved password cannot be read: enter it again in Settings. ## Captions "Make captions from the sound…" is missing from the player's menu when speech recognition is off. If you set `SPEECH_COMMAND` and `SPEECH_MODEL` and it is still missing, the API's log says which program or model file is not there. See [Captions and transcripts](https://crawl-docs.pdhq.win/guide/captions-and-transcripts.md). ## Database copy **Check** marks problems with a red cross. The usual ones: the new database is not empty, it lacks the `uuid-ossp` add-on, or the address is the pooled one (use the direct one for Neon). See [Copy the database](https://crawl-docs.pdhq.win/guide/database-copy.md). ## It is still wrong Look at the API's log in Dokploy first: it names the cause of almost every failure above. Then check [What is not tested](https://crawl-docs.pdhq.win/guide/what-is-not-tested.md), because the thing may simply never have been tried. --- # What is not tested > An honest list of what has never been tried on the real thing, what is known not to work yet, and the limits of Social Crawl, so nothing surprises you. Source: https://crawl-docs.pdhq.win/guide/what-is-not-tested/ Last updated: 2026-12-02 Social Crawl was built and tested mostly in a sandbox, with fakes standing in for sites and servers that need a login or a real account. This page says exactly where that matters. Nothing here is hidden elsewhere. ## Known not to work yet | What | Detail | | --- | --- | | **Firefox** | There is no Firefox version of the extension. It is planned: a Mozilla-signed file you install yourself. | | **Phones and tablets** | The extension cannot run there. You can read your library on a phone. A Firefox build for Android is the planned route. | | **Saving by pasted link** | Only **Bluesky** works. Facebook, Instagram, X, Pinterest and LinkedIn posts cannot be fetched from a link, and other sites are not supported by link. Use the extension. | | **Mastodon, Reddit and YouTube by pasted link** | Not written. The extension reads YouTube pages with its own reader, and saves a Reddit or Mastodon page as an ordinary article. A link pasted into the web app does not work for them. | | **Layouts in the app's own post page** | The app's article view does not use a layout yet. Layouts are used in the saved page and ZIPs. | | **DASH streams** (`.mpd`) | Not handled. Such a video stays online-only. | | **HLS videos on YouTube and Bluesky** | A stream that cannot be joined into one file is stored as an online-only placeholder with a thumbnail. | | **Database migrations** | There are none: tables are created by `synchronize`. Add migrations before you rely on this for data you cannot lose. | ## Never tried on the real thing **Social sites** - **Facebook, Instagram, X, Pinterest, LinkedIn.** The readers were written against real saved pages for four layouts (Facebook's photo viewer, X's photo viewer, a Pinterest pin, LinkedIn's picture window over the feed) and tested against test pages built the same way for the others. The live sites need a login and are blocked where this was built. Facebook and X draw the author's name and picture late, so the extension waits a few seconds for them. - **Streamed videos** on Facebook, X, Pinterest and LinkedIn were checked against real network lists of a Pinterest video, an X video, a Facebook reel and a LinkedIn video, not on the live sites. - **Live YouTube.** Saving a YouTube video from a link on the server (the experimental `yt-link` feature) was only tested against local fakes of YouTube. **Storage and servers** - **Cloudflare R2.** Only tried against a local S3-compatible server. - **A real WebDAV server** for the read cache. Only tried against a local one. - **The whole Docker stack.** The Docker images build on GitHub's runners. The speech image was also built in full and run. The rest of the compose stack and the normal image were not run in containers by the author. The pieces they depend on were each booted separately. - **Deploying on a real Dokploy host** with `DATABASE_URL` set and `POSTGRES_PASSWORD` removed. It failed there before and was fixed. - **Plain Docker without Dokploy** is described in [Install the server](https://crawl-docs.pdhq.win/guide/install-the-server.md) but was not run. **Videos** - **Converting.** Tested with real ffmpeg against a stand-in WebDAV. Not run on a real server, with a real long video, with a real HDR10 or Dolby Vision file through a whole conversion (the HDR10 mastering numbers were tested on a synthetic file), or with SVT-AV1 on the server's own ffmpeg. "Watch while it converts" plays about as fast as the server converts and can stall on a heavy video, and the live size in the quality menu was written and linted but not tried in a browser. - **Attach a file you converted yourself.** Tested with real ffmpeg (a good file, and every refusal), but its dialog was never tried in a browser, nor a real 8K file, nor a file over 10 GiB on a real WebDAV. A `.mkv` may not play in the browser. - **Attachments:** the dialog and the new size rule (it follows Settings → Storage) were not looked at in a browser. - **Videos of hours or in 4K with frames.** The test video is 90 seconds. - **A clip, and a bundle with a clip,** of a video that is on WebDAV. A post with several videos in a browser. - **A very big video:** the library size of a 44 GB video after the first start, and the quality menu while a real conversion runs. **Browsers and devices** - **Safari and Firefox** for some details of the web app: text wrapping, the drawer, the tooltips. - **A screen reader** on the toolbar, the drawer, the tags list and the theme switch. - **A real phone:** the post page's bar after scrolling, a touch swipe on the drawer, the drawer's safe-area padding. The web app was checked in a phone-sized Chromium. - **The unlock dialog's focus** in the restricted part. **The extension** - **Notion toggles** (they were not on the page the Notion rule was checked against). - **Saving real posts** from Instagram, Facebook and X: what each reader fills in as handle, id and address decides how the library groups pages. A reader that sends none falls back to the display name. ## Limits of the design - **One owner, one password.** There are no accounts. - **Links that are not web links** are kept in saved pages (`magnet:`, `ftp:`, `sftp:`, `mailto:`, `tel:`), but the server does not download them. - **A saved page is replaced as a whole** when you save the same page again. - **The restricted part is hidden, not encrypted.** - **Files per post:** up to 20 downloadable files of at most 50 MB each from an article. - **Frames from a video** are made when you download and are never stored. Nothing else made from a video is saved with a post except an optional transcript and the smaller copies you ask for. If you find something that does not match a page here, the page is wrong: see [Maintain these docs](https://crawl-docs.pdhq.win/advanced/maintain-these-docs.md). --- # Architecture > How Social Crawl is put together: the four apps and packages, how a post travels from a page to the library, where files and data live, and how the parts talk. Source: https://crawl-docs.pdhq.win/advanced/architecture/ Last updated: 2026-12-02 Social Crawl is a Yarn monorepo. One owner signs in with one password, and everything is built around that. ## The parts | Path | What it is | Runs where | | --- | --- | --- | | `apps/api` | NestJS 12 API with PostgreSQL (TypeORM). Writes bundles, serves files and ZIPs, runs the background jobs. | A container, port 4000 | | `apps/web` | Next.js 16 app: the library UI. It is also a **backend for the frontend**: the login token never reaches browser JavaScript. | A container, port 3000 | | `apps/extension` | Browser extension (Chrome, Manifest V3) written in plain TypeScript. Reads the page you are on and uploads it. | The browser | | `apps/docs` | These docs: a Next.js static export built from Markdown. | Static files | | `packages/schema` | The shared `zod` schemas: `Post`, the bundle manifest, the capture request, tags, restricted-site rules. | Imported by all | | `packages/render` | Dependency-free renderer that turns a post into `index.html`, `post.txt` and Markdown, and the layout language. | Imported by api, web, extension tests | | `deploy/` | The Dockerfiles. `docker-compose.yml` at the repository root is what Dokploy runs. | | ## The picture ```text browser extension ──(Bearer capture token)──▶ api :4000 ──▶ PostgreSQL (posts, tags, shares, settings) │ │ ▲ │ │ └── events (server-sent) ──┐ │ ▼ │ │ bundle storage: server disk │ S3/R2 │ + WebDAV tier │ ▲ you in a browser ─▶ web :3000 (cookie ─ Bearer web token) ─ /api/... allowlisted proxy ─┘ └─ /s/ pages ─▶ api public routes /share/... (no token) ``` ## How a post gets in 1. **Read.** In the extension, a service worker runs a reader function in the page you clicked on (`chrome.scripting.executeScript`). It returns a `Post` (see [The Post schema](https://crawl-docs.pdhq.win/advanced/post-schema.md)) and a list of videos found. A small panel (the "island") is drawn on the page to show it. 2. **Send.** The extension calls `POST /capture` with its **capture** token. Videos go first through `POST /capture/uploads` in 16 MB pieces, or for videos over the limit through the big-upload routes, and the post refers to them by upload id. 3. **Validate.** The API checks the body against the shared `zod` schema. Every URL the server fetches itself goes through `fetchPublic`, which refuses private addresses. 4. **Write.** `BundleService` downloads the pictures and files, joins streamed videos with ffmpeg, renders `index.html`, `post.txt` and `post.md`, and writes `post.json` with the SHA-256 of every file. The bundle is stored under the key `/` in the **bundle storage**. 5. **Index.** A `bookmarks` row is written with the card data (cover, counts, size, author key, tags). If the post's site or account matches a restricted-part rule it is marked restricted. 6. **Announce.** An event goes out on `GET /events` (server-sent events), so every open library updates by itself. ## Storage layers `BundleStorage` is an abstract class with three pieces behind it: - **Local**: a folder on disk (`STORAGE_DIR`, the `bundles` volume). - **S3-compatible**: Cloudflare R2 or any bucket (`STORAGE_DRIVER=s3`). - **Tiered**: wraps either of them and puts large files on **WebDAV** when you set it up. A small `.webdav.json` in each bundle says which files are there. Reads (with `Range`) are served from whichever side holds the file, and a read cache keeps watched parts on disk. Posts, tags, notes, share links, settings, big-upload state and layouts live in PostgreSQL. See [Data model](https://crawl-docs.pdhq.win/advanced/data-model.md). ## The web app is a proxy The browser never sees the API token. - On sign-in, `POST /api/session` sends your password to the API and stores the returned **web** token in an `httpOnly`, `sameSite=lax` cookie (`secure` in production), for 7 days. - Every other call goes through `/api/[...path]`, a route handler that checks the request against an **allowlist** of method and path patterns (`apps/web/src/lib/proxy-allowlist.ts`), requires the cookie, adds the `Authorization` header, and forwards the response with the range headers a video needs. - Anything that changes data must pass a same-origin check: the `Origin` header must match the host. - `proxy.ts` redirects visitors without the cookie to `/login`, except for `/s/` (the share links, where the secret is the key). - The restricted part has its own cookie, `sc_r`, kept only for the browser session, and sent to the API as `x-restricted-token`. ## Background work The API runs long jobs itself, in the same process: | Job | Where | Limits | | --- | --- | --- | | Smaller sizes for the player and facts about a video (`MediaJobsService`) | `bookmarks/media-jobs.ts` | A few at a time, the rest wait. | | Conversion of big videos (`ConvertService`) | `big-uploads/` | One at a time, at low priority, at most 2 encoder threads. | | Speech recognition | `bundles/speech-tools.ts` | One video at a time. | | WebDAV copy and move | `webdav/` | Reports progress by events. | | Database copy and delete | `migration/` | One at a time. | | Recount of big-video sizes | `big-uploads/big-sizes.ts` | At start and every 10 minutes. | `GET /jobs` lists them all for the queue in the top bar. ## Where to read next - [Data model](https://crawl-docs.pdhq.win/advanced/data-model.md) for the tables. - [API routes and scopes](https://crawl-docs.pdhq.win/advanced/api-routes.md) for every route. - [Security notes](https://crawl-docs.pdhq.win/advanced/security.md). - [Build, test and extend](https://crawl-docs.pdhq.win/advanced/build-test-extend.md) to change the code. --- # Data model > The ten PostgreSQL tables, what each holds, how a saved post's files relate to its row, and what to know about tables made by synchronize instead of migrations. Source: https://crawl-docs.pdhq.win/advanced/data-model/ Last updated: 2026-12-02 The database holds **metadata and state**. The saved **files** of a post (pictures, videos, the offline page) are in the bundle storage, not here. See [Architecture](https://crawl-docs.pdhq.win/advanced/architecture.md). All tables are listed in `apps/api/src/entities.ts`. TypeORM creates and alters them at start while `DB_SYNCHRONIZE` is on (it is in the compose file). ## Tables | Table | Holds | | --- | --- | | `bookmarks` | One row per saved post. The card data the library needs (see below). | | `restrict_rules` | The site and account rules that send saves to the restricted part (`host`, `path`; unique together). | | `post_shares` | Temporary links to one post: label, `expiresAt`, SHA-256 of the secret, open and download counts, who fetched it last. | | `collection_shares` | Temporary links to several posts: the post ids (a snapshot, up to 50) and the same counters. | | `big_uploads` | A big video's tracks sent to WebDAV in parts: platform, post, track (`video` or `audio`), total bytes, part size, the finished parts with fingerprints, and the state of the one-file copy (`joinState`). | | `big_conversions` | A smaller copy of a big video, one row per post and size: state, stage (`sample`, `full`, or `own` for a file you converted yourself and attached), percent, estimates, output size, layout (`file` or `parts`) and the checks. | | `attachments` | What you attached to a post: `kind` is `post`, `file` or `link`, with its target, title, address, file name, size and where the bytes are. | | `layouts` | A layout template per site: `domain` and `source`. | | `app_settings` | One row (id 1): settings changed in the web app instead of the environment. Today: `maxVideoMb`. | | `webdav_settings` | One row (id 1): the WebDAV address, user name, the password **sealed** with AES-256-GCM, the offload switch and the large-file threshold in MB. | ## The `bookmarks` table | Column | Meaning | | --- | --- | | `id` | The UUID used in the web app's addresses (`/bookmarks/`). | | `platform`, `postId` | The post's platform and its id there. Unique together: saving the same post again replaces the row. | | `url`, `authorName`, `preview` | The address, the author, and the start of the text for search and cards. | | `bundleKey` | Where the files are: `/`, for example `bluesky/3kabc`. | | `tags` | The tags, as an array of text. | | `note` | Your note. | | `restricted` | True when the post is in the restricted part. | | `sizeBytes`, `webdavBytes`, `bigBytes` | What the post takes: in total, how much of that is on WebDAV, and what its big-video tracks and copies take (they are not in the bundle, so they are kept apart and added back when the bundle is counted again). | | Card columns | `coverPath`, `coverWidth`, `coverHeight`, `mediaCount`, `imageCount`, `videoCount`, `fileCount`, `avatarPath`, `siteName`, `siteLogoPath`, `coverVideoPath`, `hasSavedVideo`, `hasMadeSizes`, `hasOnlineOnlyMedia`. Computed from the saved post so the library does not read every bundle. | | `authorKey`, `authorHandle` | The page or account the post comes from, in lower case, to group the library by. Older posts are filled in at start. | | `metaVersion` | A post whose version is below the code's `META_VERSION` (11) has its card data computed again at start. | | `createdAt`, `updatedAt` | Dates. | ## Bundles A bundle is the folder `/` in the bundle storage: ```text index.html the offline page (no scripts, a strict CSP) post.json the BundleManifest: version, the Post, and { path, bytes, sha256 } for every file post.md the Markdown version text/post.txt the plain text images/ videos/ files/ transcripts/ ... .webdav.json only when some files are on WebDAV: which ones ``` `post.json` is the source of truth. `index.html` is rendered from it by `packages/render`, which is why a layout or a fix to the renderer can redraw old posts. See [The Post schema](https://crawl-docs.pdhq.win/advanced/post-schema.md). ## Tables are made by synchronize There are **no migrations**. With `DB_SYNCHRONIZE=true`, TypeORM compares the entities to the database at start and changes the tables to match. That is convenient and also risky: a renamed column can be dropped and made again empty. For data you cannot lose: - Take a backup of `pgdata` (or your hosted database) before each update. - Use Settings → Database to copy to another database first if you want a second copy: see [Copy the database](https://crawl-docs.pdhq.win/guide/database-copy.md). - If you add a column, `synchronize` adds it. If you turn `DB_SYNCHRONIZE` off, you must add columns by hand. For example the `bookmarks` columns `authorKey` and `authorHandle` were added this way. ## Moving the database The database copy tool makes the new database's tables from the entity list, copies every table, and compares them. It needs the `uuid-ossp` add-on in the new database. --- # Security notes > What protects a Social Crawl install, how sign-in and tokens work, what saved pages cannot do, and what is not protected, so you can judge it for yourself. Source: https://crawl-docs.pdhq.win/advanced/security/ Last updated: 2026-12-02 ## Who can do what Social Crawl has **one owner**. There are three kinds of credential: | Credential | Made from | Can do | | --- | --- | --- | | The web login (`web` token) | Your password. Stored by the web app in an `httpOnly` cookie, valid 7 days. | Everything in the web app. | | The extension token (`capture` scope) | Made in Settings. Valid 180 days. | Save posts, look up a page, upload videos. It cannot read your library, delete anything or change settings. | | A share link | A random secret in the address, valid for the time you chose. | Read and download one post (or up to 50), nothing else. Notes and tags are never in it. | Optionally a **second password** opens the restricted part (see [Restricted posts](https://crawl-docs.pdhq.win/guide/restricted-posts.md)). It is hidden, not encrypted. ## Passwords and tokens - The password is stored only as a **scrypt** hash (`N=32768, r=8, p=1`, a random 16-byte salt, a 64-byte key) in `ADMIN_PASSWORD_HASH`. It must be at least 12 characters to make one with the supplied tool. - Tokens are **HS256 JWTs** signed with `JWT_SECRET` (32 characters or more). Changing the secret ends every login. - Failed logins are limited to **5 per minute** per client address (`LoginThrottle`, in memory). The web app passes the real client address on. - Dangerous actions ask for the password again: deleting the old database's data, and removing a raw video. The same throttle applies. - A hash pasted wrong is described without being revealed (its start, length, line breaks, forbidden characters). ## The web app - The token never reaches browser JavaScript. The cookie is `httpOnly`, `sameSite=lax`, and `secure` in production. - Only an **allowlist** of API routes is reachable through `/api/...`. Everything else answers 404. - Anything that is not a `GET` must carry an `Origin` that matches the host (a CSRF guard). - Responses carry `X-Content-Type-Options: nosniff`, `Referrer-Policy: same-origin` and `X-Frame-Options: SAMEORIGIN`. ## What the server fetches Every address the server fetches on its own (pictures, videos, link previews, layouts' pictures) goes through `fetchPublic` in `apps/api/src/common/net.ts`: - Only `http` and `https`. - Private, loopback, link-local and cloud-metadata addresses are refused **at connect time**, so a hostname that changes its answer (DNS rebinding) cannot sneak in. IPv4 addresses written as IPv6 are caught too. - Limits on size, time and redirects. ## Saved pages cannot run code - Saved pages are static HTML with a strict `Content-Security-Policy` (`default-src 'none'`, no scripts). - All text is escaped. Links are limited to `http(s)`, `ftp(s)`, `sftp`, `magnet`, `mailto` and `tel`. - Media paths are checked to be inside the bundle. - The web app shows them in a sandboxed iframe. - Article bodies are plain data blocks, never HTML. A site rule or a layout holds selectors and tags only, and never runs code. ## Secrets at rest - The WebDAV password is encrypted with AES-256-GCM, with a key derived from `JWT_SECRET` (HKDF-SHA256). It is never sent back to the browser. - A share link's secret is 32 random bytes. The database keeps only its SHA-256, so it cannot be shown again. - Environment values such as `JWT_SECRET` and the S3 keys are in your deploy tool's environment. Treat that as a secret store. ## The extension - It reads a page when you click it. It can only talk to the one API origin you allow. - Its permissions: `activeTab`, `scripting`, `storage`, `webRequest`, `declarativeNetRequestWithHostAccess` and `power`, plus **optional** access to `https://*/*` and to localhost, which the browser asks for. - **Video finding** is off until you turn it on. It then notes the video files and playlists the pages you open load, and needs permission to see every site. Nothing is sent until you save. - Its token is `capture` only, so a stolen extension token cannot read your library. ## Supply chain - Only official, first-party packages are used, each checked before it is added. - `yarn npm audit --all --recursive` runs in CI and fails on any advisory. - No polyfills anywhere. - The speech packages are pinned in `deploy/speech/requirements.txt` and installed with `--no-deps`. The CI audit does not see them: after changing a version run `python3 deploy/speech/pypi-audit.py`. (The README also says the model is checked against a SHA-256 and loaded with `weights_only=True`. That is done by the `openai-whisper` package and was not verified in this repository.) ## Not protected - Anyone who can open your server's storage or database sees everything, including the restricted part. - A share link works for anyone who has it until it ends. Treat it like a password. - The lab (`LAB_ENABLED`) can write up to 12 GB per test to your WebDAV. Leave it off. --- # Environment variables > Every setting the Social Crawl API, the web app, Docker Compose and this docs site read, with its default, its limits and what it does. Source: https://crawl-docs.pdhq.win/advanced/environment-variables/ Last updated: 2026-12-02 The API checks its environment when it starts (`apps/api/src/config/env.ts`, a `zod` schema) and refuses to start, saying which value is wrong. Values are cleaned first: surrounding spaces and quotes are removed, because environment panels and copy and paste often add them. In Dokploy set them under **Environment**. With plain Docker put them in a `.env` file next to `docker-compose.yml`. `.env.example` in the repository lists the common ones with comments. ## Needed to start | Variable | Default | Meaning | | --- | --- | --- | | `JWT_SECRET` | none, **required** | Signs logins and encrypts the saved WebDAV password. At least 32 characters. `openssl rand -base64 48`. Changing it ends every login and makes the saved WebDAV password unreadable. | | `ADMIN_PASSWORD_HASH` | none, **required** | Your password as `scrypt::`, 120 characters. See [Install the server](https://crawl-docs.pdhq.win/guide/install-the-server.md). | | `DATABASE_URL` | In Compose: the stack's own `db` service | A PostgreSQL address. In Compose it is built from `POSTGRES_USER`, `POSTGRES_PASSWORD` and `POSTGRES_DB`. The API refuses an address that points at `sc-db` with an empty password. | ## Database (Compose) | Variable | Default | Meaning | | --- | --- | --- | | `POSTGRES_PASSWORD` | empty | The stack's own database password. Letters and numbers only. Needed while the stack uses its own database, and once on a brand-new install even when `DATABASE_URL` is set. | | `POSTGRES_USER` | `socialcrawl` | User of the stack's database. | | `POSTGRES_DB` | `socialcrawl` | Name of the stack's database. | | `DB_SYNCHRONIZE` | `false` in the API, `true` in Compose | Lets TypeORM create and alter tables at start. There are no migrations. See [Data model](https://crawl-docs.pdhq.win/advanced/data-model.md). | | `MIGRATE_TO_DATABASE_URL` | unset | A second address that Settings → Database copies into. Read only when you press Check or Copy. Remove it afterwards. | | `OLD_DATABASE_URL` | unset | The address of the database you left, for Settings → Database to delete its data. Remove it afterwards. | ## Server | Variable | Default | Meaning | | --- | --- | --- | | `PORT` | `4000` | The API's port. | | `CORS_ORIGINS` | empty | Origins allowed to call the API from a browser, comma separated. The extension uses its own origin. | | `RESTRICTED_PASSWORD_HASH` | unset | Second password for the restricted part, same format as `ADMIN_PASSWORD_HASH`. Without it the part cannot be opened. | | `EXTENSION_DIR` | `../extension/dist` | The built extension offered in Settings. In the Docker image it is built in. | | `LAB_ENABLED` | off | Turns on the `/lab` routes (testing only; they can write 12 GB per test to WebDAV). Leave off. | ## Storage | Variable | Default | Meaning | | --- | --- | --- | | `STORAGE_DRIVER` | `local` | `local` or `s3`. | | `STORAGE_DIR` | `./storage` (`/data/bundles` in Compose) | Where bundles live with the `local` driver. | | `S3_ENDPOINT` | none | Required with `s3`. Must start with `https://`. For R2: `https://.r2.cloudflarestorage.com`. | | `S3_BUCKET` | none | Required with `s3`. | | `S3_REGION` | `auto` | Region. | | `S3_ACCESS_KEY_ID`, `S3_SECRET_ACCESS_KEY` | none | Required with `s3`. | ## Videos | Variable | Default | Meaning | | --- | --- | --- | | `MAX_VIDEO_MB` | `4096` (1 to 5000) | The largest video the extension may send. Settings → Videos overrides it. While a post is saved the server needs about twice this free on its temp disk. | | `UPLOAD_DIR` | the system's temp folder | Where uploaded videos wait until their post is saved. | | `VIDEO_CACHE_MB` | `2048` (`0` = off, up to 1,000,000) | How much of the videos kept on WebDAV the server holds on its disk. | | `VIDEO_CACHE_DIR` | the system's temp folder | Where those parts are kept. | ## Speech recognition All optional. See [Captions and transcripts](https://crawl-docs.pdhq.win/guide/captions-and-transcripts.md). | Variable | Default | Meaning | | --- | --- | --- | | `API_TARGET` | `runtime` | Compose build target. `runtime-speech` builds the image with Whisper (about 3 GB). | | `SPEECH_MODEL_NAME` | `base` | Which model the speech image carries (`base`, `small`, ...). | | `SPEECH_COMMAND` | unset (set for you with `runtime-speech`) | The program that listens. Both this and `SPEECH_MODEL` are needed. | | `SPEECH_MODEL` | unset (set for you with `runtime-speech`) | The model file. | | `SPEECH_THREADS` | `4` in the API, `2` in Compose (1 to 64) | Processor threads it uses. | | `SPEECH_LANGUAGE` | `auto` | `auto` or a code such as `en`. | | `SPEECH_MAX_MINUTES` | `240` (1 to 1440) | The longest video or sound it listens to. | ## The web app | Variable | Default | Meaning | | --- | --- | --- | | `API_URL` | `http://127.0.0.1:4000` (`http://sc-api:4000` in Compose) | Where the web app reaches the API from the server side. Never exposed to the browser. | ## Save YouTube from a link (experiment) Optional, and not tested against the real YouTube. All are environment variables of the API; an empty one means "not set". Defaults in parentheses. | Variable | Meaning | | --- | --- | | `YT_LINK` | `off` turns the whole experiment off. Its routes then answer 404. | | `YTS_MAX_HEIGHT` (2160) | Tallest picture it takes, 144 to 4320. | | `YTS_CODEC_ORDER` (`avc1,av01,vp09`) | The most wanted picture codec first. | | `YTS_YT_PROXY` | `host:port` of an HTTP proxy used for YouTube only. `YTS_WARP_ROTATE=1` asks for a new address when blocked. | | `YTS_SLICE_MB` (5), `YTS_PIECE_MB` (8), `YTS_PART_MB` (256), `YTS_PARALLEL` (2) | Read slice, upload piece, big-video part, slices read side by side. | | `YTS_SLICE_TRIES` (4), `YTS_PART_TRIES` (3) | Retries per slice and per part. | | `YTS_SMALL_MB` (0) | Videos up to this size go the normal way. 0 means the server's own limit. | | `YTS_DOCTOR_EVERY_HOURS` (24; 0 = off), `YTS_DOCTOR_VIDEOS` | The daily self-check. | | `YTS_CLIENTS_FILE`, `YTS_STREAM_UA`, `YTS_STATE_DIR` | A JSON copy of the clients table, the user agent for stream requests, and where its files are kept. | ## This docs site Read when the docs are built (see [Maintain these docs](https://crawl-docs.pdhq.win/advanced/maintain-these-docs.md)). | Variable | Default | Meaning | | --- | --- | --- | | `DOCS_SITE_URL` | `https://docs.example.com` | The public address of the docs. Used in `llms.txt`, the sitemap, `robots.txt`, canonical addresses and Open Graph tags. Set it to your real address. | | `NEXT_PUBLIC_DOCS_APP_URL` | unset | The address of your app. When set, an **Open the app** button appears in the docs header. | --- # Deploy and operate > What the Docker Compose stack contains, how updates work, how to back up and restore, where the logs are, and how to deploy these docs as their own service. Source: https://crawl-docs.pdhq.win/advanced/deploy-and-operate/ Last updated: 2026-12-04 ## The stack `docker-compose.yml` at the repository root defines three services: | Service | Image | Port | Alias | Notes | | --- | --- | --- | --- | --- | | `db` | `postgres:17-alpine` | 5432 (not published) | `sc-db` | Volume `pgdata`. A health check (`pg_isready`) gates the API's start. | | `api` | built from `deploy/api.Dockerfile` | 4000 | `sc-api` | Runs as the `node` user. Volume `bundles` at `/data/bundles`. Has ffmpeg. Health check on its port. | | `web` | built from `deploy/web.Dockerfile` | 3000 | none | Next.js standalone server. Reaches the API at `http://sc-api:4000`. | Every service joins a private `backend` network and, for `api` and `web`, Dokploy's shared `dokploy-network` (an **external** network that Dokploy creates). Services reach each other by the aliases `sc-db` and `sc-api`, which cannot clash with another application's `db` or `api` on the shared network. No ports are published: Dokploy's proxy reaches the containers by name and gives each domain HTTPS. The API image has two targets. `runtime` is the normal Alpine image. `runtime-speech` is Debian with Whisper (about 3 GB), chosen with `API_TARGET=runtime-speech`. The extension is built into the API image so that Settings can offer it. ## Updates With **Auto Deploy** on, Dokploy rebuilds and restarts the stack whenever the branch changes. It does so whether or not CI passed, so protect the branch (require the `check` job) and merge only through pull requests. Tables are altered at start by `synchronize` (see [Data model](https://crawl-docs.pdhq.win/advanced/data-model.md)). Back up first. To roll back, deploy an earlier commit. Because tables are changed in place, a rollback after a table change may need a restore from backup. ## Back up and restore | What | Where | How | | --- | --- | --- | | Posts, tags, notes, shares, settings | PostgreSQL | `pg_dump` of the database, or a volume snapshot of `pgdata`. Or copy to another database from Settings, see [Copy the database](https://crawl-docs.pdhq.win/guide/database-copy.md). | | Saved files | The `bundles` volume, or R2, or WebDAV | A volume snapshot, a copy of the bucket, or the WebDAV's own backup. | A restored database without its files shows posts that have no pictures or videos, and the other way round. Back up both at the same time. ## Logs Read the API's log in Dokploy's **Logs** tab. It names the cause of start failures (a wrong environment value is reported by name), WebDAV fallbacks ("that file goes to the main storage instead") and speech settings that name a missing program. The web app's log shows proxy and rendering errors. ## Checks that run in CI `.github/workflows/ci.yml` runs on every pull request and on pushes to `main`: - the dependency audit (`yarn npm audit --all --recursive`), which fails on any advisory; - `deploy/check-compose.sh`, which resolves the compose file the way Dokploy does in each situation (with and without `POSTGRES_PASSWORD` or `DATABASE_URL`) and needs no Docker daemon; - lint, type checks and unit tests for the packages and apps, with a real PostgreSQL for the database-copy tests; - the extension's build and browser tests, and the build of the API and web app; - a boot check that starts the built API against the job's database and asks `/health`. ## Deploy these docs The docs are static files with their own container: a Dockerfile that builds them and serves them with nginx. They are their own Dokploy service, separate from the app, so they keep working while the app is down and a docs problem cannot stop an app deploy. Two kinds of Dokploy service work, and both build the same image from `deploy/docs.Dockerfile`. ### As a Compose service Use this if you already have the app as a Compose service and want the docs to look the same. 1. In the same Dokploy project create a **Compose** service from the same repository and branch `main`. Set **Compose Path** to `./deploy/docs.compose.yml` (the default `./docker-compose.yml` is the app). 2. In **Environment** set `DOCS_SITE_URL` to the docs' public address, for example `https://docs.example.com`. It is required: the deploy stops and names it when it is missing, because the canonical links and the sitemap would otherwise point at a placeholder. If you want the **Open the app** button, also set `NEXT_PUBLIC_DOCS_APP_URL` to the app's address. 3. In **Domains** add a domain such as `docs.example.com` with **Service Name** `docs`, **Port** `80` and HTTPS. 4. Press **Deploy**. ### As an Application 1. In Dokploy create an **Application** from the same repository. 2. Build type **Dockerfile**, Dockerfile path `deploy/docs.Dockerfile`, build context `.`. 3. Under **Build Time Arguments** set `DOCS_SITE_URL` to the docs' public address (for example `https://docs.example.com`) and, if you want the **Open the app** button, `NEXT_PUBLIC_DOCS_APP_URL`. 4. Add a domain such as `docs.example.com` on port **80** with HTTPS. Either way, both values are build arguments: they are written into the pages when the image is built, so changing one needs a new **Deploy**. The Compose file is also checked by `deploy/check-compose.sh` in CI. > [!NOT-TESTED] > The docs image was not built here, because the build environment has no Docker engine. The site itself was built with `next build` and served and inspected in a real browser. The nginx file was not run. ## Without Docker To run the pieces by hand, see [Build, test and extend](https://crawl-docs.pdhq.win/advanced/build-test-extend.md). --- # API routes and scopes > Every route of the Social Crawl API with its method, path and the token scopes that may call it. Made from the controllers, so it matches the code. Source: https://crawl-docs.pdhq.win/advanced/api-routes/ Last updated: 2026-12-02 The API is a NestJS application. This page lists all 141 routes. **It is generated** from the controllers by `yarn workspace @social-crawl/docs routes`, so a route that exists in the code is in this table. ## Authentication Every route needs a bearer token (`Authorization: Bearer `) unless the table says public. A token has a **scope**: | Scope | How you get it | Lifetime | What it may do | | --- | --- | --- | --- | | `web` | `POST /auth/login` with the password | 7 days | Everything that lists `web`, which is every route without a `Scopes` decorator. | | `capture` | `POST /auth/extension-token` (needs a `web` token) | 180 days | Only the routes that list `capture`: saving a post, looking one up, and sending videos. It cannot read or delete a library. | | restricted | `POST /auth/unlock` with the second password | 12 hours | Not a login token. It is sent in the header `x-restricted-token` with a `web` token to see the restricted part. | A route with no `@Scopes` accepts `web` only. A wrong scope answers **403**, a missing token **401**. The web app does not expose these routes to the browser directly. It keeps the token in an `httpOnly` cookie and forwards only an allowlist of routes through `/api/...`. See [Architecture](https://crawl-docs.pdhq.win/advanced/architecture.md). The temporary share links people open (`/s//...`) are pages of the **web app**. They read the **public** routes `/share/:token/...` and `/share-collection/:token/...` below, which need no token because the secret in the address is the key. See [Shares and downloads](https://crawl-docs.pdhq.win/guide/shares-and-downloads.md). Bodies are JSON up to 20 MB. Cross-origin calls are allowed only from the origins in `CORS_ORIGINS`. ## Attachments | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | GET | `/bookmarks/:id/attachments` | web | `attachments.controller.ts` `list` | | GET | `/attachments/title` | web | `attachments.controller.ts` `title` | | POST | `/bookmarks/:id/attachments/posts` | web | `attachments.controller.ts` `posts` | | POST | `/bookmarks/:id/attachments/link` | web | `attachments.controller.ts` `link` | | POST | `/bookmarks/:id/attachments/file` | web | `attachments.controller.ts` `file` | | GET | `/bookmarks/:id/attachments/:attachmentId/file` | web | `attachments.controller.ts` `download` | | DELETE | `/bookmarks/:id/attachments/:attachmentId` | web | `attachments.controller.ts` `remove` | ## Big videos: upload, join, convert | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | GET | `/big-uploads/limits` | web, capture | `big-uploads.controller.ts` `limits` | | GET | `/big-uploads` | web, capture | `big-uploads.controller.ts` `list` | | POST | `/big-uploads` | web, capture | `big-uploads.controller.ts` `start` | | POST | `/big-uploads/sweep` | web, capture | `big-uploads.controller.ts` `sweep` | | GET | `/big-uploads/:id` | web, capture | `big-uploads.controller.ts` `get` | | GET | `/big-uploads/:id/file` | web, capture | `big-uploads.controller.ts` `file` | | GET | `/big-uploads/:id/one` | web, capture | `big-uploads.controller.ts` `one` | | POST | `/big-uploads/:id/join` | web, capture | `big-uploads.controller.ts` `join` | | DELETE | `/big-uploads/:id/join` | web, capture | `big-uploads.controller.ts` `stopJoin` | | DELETE | `/big-uploads/:id/one` | web, capture | `big-uploads.controller.ts` `removeOne` | | GET | `/big-uploads/:id/joined` | web, capture | `big-uploads.controller.ts` `joined` | | POST | `/big-uploads/:id/parts/:n/pieces/:i` | web, capture | `big-uploads.controller.ts` `piece` | | POST | `/big-uploads/:id/parts/:n/abort` | web, capture | `big-uploads.controller.ts` `abortPart` | | POST | `/big-uploads/:id/finish` | web, capture | `big-uploads.controller.ts` `finish` | | POST | `/big-uploads/:id/link` | web, capture | `big-uploads.controller.ts` `link` | | POST | `/big-uploads/:id/check` | web, capture | `big-uploads.controller.ts` `startCheck` | | GET | `/big-uploads/:id/check` | web, capture | `big-uploads.controller.ts` `checkJob` | | POST | `/big-uploads/:id/check/stop` | web, capture | `big-uploads.controller.ts` `stopCheck` | | DELETE | `/big-uploads/:id` | web, capture | `big-uploads.controller.ts` `remove` | | GET | `/big-uploads/:id/convert` | web | `convert.controller.ts` `status` | | POST | `/big-uploads/:id/convert` | web | `convert.controller.ts` `offer` | | POST | `/big-uploads/:id/convert/go` | web | `convert.controller.ts` `go` | | POST | `/big-uploads/:id/convert/own` | web | `convert.controller.ts` `attachOwn` | | DELETE | `/big-uploads/:id/convert` | web | `convert.controller.ts` `stop` | | POST | `/big-uploads/:id/convert/remove-raw` | web | `convert.controller.ts` `removeRaw` | | GET | `/big-uploads/:id/converting` | web | `convert.controller.ts` `live` | | GET | `/big-uploads/:id/converted` | web | `convert.controller.ts` `copy` | | GET | `/convert-queue` | web | `convert.controller.ts` `queue` | ## Capture: uploads and fetches by the extension | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | POST | `/capture/fetches` | web, capture | `fetches.controller.ts` `start` | | GET | `/capture/fetches/:id` | web, capture | `fetches.controller.ts` `get` | | POST | `/capture/uploads` | web, capture | `uploads.controller.ts` `create` | | POST | `/capture/uploads/:id/pieces/:index` | web, capture | `uploads.controller.ts` `append` | | POST | `/capture/uploads/:id/done` | web, capture | `uploads.controller.ts` `finish` | | DELETE | `/capture/uploads/:id` | web, capture | `uploads.controller.ts` `release` | ## Database copy and delete | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | GET | `/settings/database` | web | `database-migration.controller.ts` `status` | | POST | `/settings/database/check` | web | `database-migration.controller.ts` `check` | | POST | `/settings/database/copy` | web | `database-migration.controller.ts` `copy` | | POST | `/settings/database/cancel` | web | `database-migration.controller.ts` `cancel` | | GET | `/settings/database/old` | web | `old-database.controller.ts` `status` | | POST | `/settings/database/old/check` | web | `old-database.controller.ts` `check` | | POST | `/settings/database/old/delete` | web | `old-database.controller.ts` `delete` | ## Health | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | GET | `/health` | none (public) | `health.controller.ts` `check` | ## Layouts | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | GET | `/layouts` | web | `layouts.controller.ts` `list` | | POST | `/layouts` | web | `layouts.controller.ts` `create` | | PUT | `/layouts/:id` | web | `layouts.controller.ts` `update` | | DELETE | `/layouts/:id` | web | `layouts.controller.ts` `remove` | ## Posts (bookmarks) | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | POST | `/posts/preview` | web | `bookmarks.controller.ts` `preview` | | POST | `/bookmarks` | web | `bookmarks.controller.ts` `create` | | POST | `/capture` | web, capture | `bookmarks.controller.ts` `capture` | | GET | `/capture/lookup` | web, capture | `bookmarks.controller.ts` `lookup` | | GET | `/bookmarks` | web | `bookmarks.controller.ts` `list` | | GET | `/bookmarks/:id` | web | `bookmarks.controller.ts` `get` | | PATCH | `/bookmarks/:id` | web | `bookmarks.controller.ts` `update` | | DELETE | `/bookmarks/:id/media/:mediaId` | web | `bookmarks.controller.ts` `removeMedia` | | POST | `/bookmarks/:id/media/:mediaId/file` | web, capture | `bookmarks.controller.ts` `attachUpload` | | POST | `/bookmarks/:id/media/:mediaId/prepare` | web | `bookmarks.controller.ts` `prepareMedia` | | POST | `/bookmarks/:id/media/:mediaId/renditions` | web | `bookmarks.controller.ts` `requestRendition` | | DELETE | `/bookmarks/:id/media/:mediaId/renditions/:height` | web | `bookmarks.controller.ts` `removeRendition` | | POST | `/bookmarks/:id/media/:mediaId/captions` | web | `bookmarks.controller.ts` `addCaption` | | GET | `/settings/speech` | web | `bookmarks.controller.ts` `speech` | | POST | `/bookmarks/:id/media/:mediaId/transcript` | web | `bookmarks.controller.ts` `requestTranscript` | | DELETE | `/bookmarks/:id/media/:mediaId/transcript` | web | `bookmarks.controller.ts` `removeTranscript` | | DELETE | `/bookmarks/:id/media/:mediaId/captions` | web | `bookmarks.controller.ts` `removeCaption` | | GET | `/bookmarks/:id/media-jobs` | web | `bookmarks.controller.ts` `mediaJobsOf` | | DELETE | `/bookmarks/:id` | web | `bookmarks.controller.ts` `remove` | | GET | `/bookmarks/:id/download` | web | `bookmarks.controller.ts` `download` | | GET | `/bookmarks/:id/media/:mediaId/clip` | web | `bookmarks.controller.ts` `clip` | | GET | `/bookmarks/:id/markdown` | web | `bookmarks.controller.ts` `markdown` | | GET | `/bookmarks/:id/files/*path` | web | `bookmarks.controller.ts` `file` | | GET (stream) | `/events` | web | `events.controller.ts` `stream` | | POST | `/auth/unlock` | web | `restricted.controller.ts` `unlock` | | GET | `/restricted` | web | `restricted.controller.ts` `status` | | GET | `/restricted/bookmarks` | web | `restricted.controller.ts` `list` | | POST | `/restricted/bookmarks/:id` | web | `restricted.controller.ts` `restrict` | | DELETE | `/restricted/bookmarks/:id` | web | `restricted.controller.ts` `unrestrict` | | GET | `/restricted/rules` | web | `restricted.controller.ts` `rules` | | POST | `/restricted/rules` | web | `restricted.controller.ts` `addRule` | | DELETE | `/restricted/rules/:id` | web | `restricted.controller.ts` `removeRule` | ## Save YouTube from a link (experiment) | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | GET | `/yt-link/status` | web | `yt-link.controller.ts` `status` | | GET | `/yt-link/log` | web | `yt-link.controller.ts` `log` | | POST | `/yt-link/probe` | web | `yt-link.controller.ts` `probe` | | POST | `/yt-link/doctor` | web | `yt-link.controller.ts` `doctor` | | GET | `/yt-link/jobs` | web | `yt-link.controller.ts` `jobs` | | POST | `/yt-link/jobs` | web | `yt-link.controller.ts` `add` | | GET | `/yt-link/jobs/:id` | web | `yt-link.controller.ts` `job` | | POST | `/yt-link/jobs/:id/cancel` | web | `yt-link.controller.ts` `cancel` | | POST | `/yt-link/jobs/:id/retry` | web | `yt-link.controller.ts` `retry` | | POST | `/yt-link/jobs/:id/discard` | web | `yt-link.controller.ts` `discard` | | DELETE | `/yt-link/jobs/:id` | web | `yt-link.controller.ts` `forget` | ## Settings | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | GET | `/settings/video` | web | `settings.controller.ts` `video` | | PUT | `/settings/video` | web | `settings.controller.ts` `saveVideo` | ## Share links | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | POST | `/collection-shares` | web | `collection-shares.controller.ts` `create` | | GET | `/collection-shares` | web | `collection-shares.controller.ts` `list` | | POST | `/collection-shares/:shareId/extend` | web | `collection-shares.controller.ts` `extend` | | DELETE | `/collection-shares/:shareId` | web | `collection-shares.controller.ts` `remove` | | GET | `/share-collection/:token/p/:n/files/*path` | none (public) | `collection-shares.controller.ts` `file` | | GET | `/share-collection/:token/p/:n/download` | none (public) | `collection-shares.controller.ts` `downloadOne` | | GET | `/share-collection/:token/download` | none (public) | `collection-shares.controller.ts` `downloadAll` | | GET | `/share-collection/:token/markdown` | none (public) | `collection-shares.controller.ts` `markdown` | | GET | `/share-collection/:token/posts` | none (public) | `collection-shares.controller.ts` `posts` | | POST | `/bookmarks/:id/shares` | web | `shares.controller.ts` `create` | | GET | `/bookmarks/:id/shares` | web | `shares.controller.ts` `list` | | POST | `/bookmarks/:id/shares/:shareId/extend` | web | `shares.controller.ts` `extend` | | DELETE | `/bookmarks/:id/shares/:shareId` | web | `shares.controller.ts` `remove` | | GET | `/share/:token` | none (public) | `shares.controller.ts` `meta` | | GET | `/share/:token/files/*path` | none (public) | `shares.controller.ts` `file` | | GET | `/share/:token/download` | none (public) | `shares.controller.ts` `download` | ## Sign-in and tokens | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | POST | `/auth/login` | none (public) | `auth.controller.ts` `login` | | POST | `/auth/extension-token` | web | `auth.controller.ts` `extensionToken` | ## The extension download | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | GET | `/extension/download` | web | `extension.controller.ts` `download` | ## The lab (testing only) | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | GET | `/lab/status` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `status` | | POST | `/lab/probe` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `probe` | | POST | `/lab/generated` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `generated` | | GET | `/lab/jobs/:id` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `job` | | POST | `/lab/jobs/:id/stop` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `stop` | | POST | `/lab/discard` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `discard` | | POST | `/lab/uploads` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `create` | | GET | `/lab/uploads/:id` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `state` | | POST | `/lab/uploads/:id/parts/:n/pieces/:i` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `piece` | | POST | `/lab/uploads/:id/parts/:n/abort` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `abortPart` | | POST | `/lab/uploads/:id/finish` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `finish` | | POST | `/lab/uploads/:id/verify` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `verify` | | DELETE | `/lab/uploads/:id` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `remove` | | POST | `/lab/sweep` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `sweep` | | DELETE | `/lab/all` | web, capture (needs `LabEnabled`) | `lab.controller.ts` `removeAll` | ## The queue | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | GET | `/jobs` | web | `jobs.controller.ts` `list` | ## WebDAV and storage places | Method | Path | Scopes | Handler | | --- | --- | --- | --- | | GET | `/settings/webdav` | web | `webdav.controller.ts` `view` | | PUT | `/settings/webdav` | web | `webdav.controller.ts` `save` | | POST | `/settings/webdav/test` | web | `webdav.controller.ts` `test` | | POST | `/bookmarks/:id/webdav/copy` | web | `webdav.controller.ts` `copy` | | POST | `/bookmarks/:id/webdav/move-large` | web | `webdav.controller.ts` `moveLarge` | | GET | `/settings/storage` | web | `webdav.controller.ts` `names` | | GET | `/bookmarks/:id/storage` | web | `webdav.controller.ts` `location` | | POST | `/bookmarks/:id/storage/keep` | web | `webdav.controller.ts` `keep` | --- # The Post schema > The shape of a saved post as data: the Post, its media, article blocks, video, title, repository and playlist parts, the bundle manifest and the capture request. Source: https://crawl-docs.pdhq.win/advanced/post-schema/ Last updated: 2026-12-02 Every saved post is described by one `zod` schema in `packages/schema/src/index.ts`. The extension builds it, the API validates and stores it as `post.json`, and the renderer draws it. If you write your own reader or importer, this is the contract. ```ts import { postSchema, captureRequestSchema, bundleManifestSchema } from "@social-crawl/schema"; ``` ## Post | Field | Type | Notes | | --- | --- | --- | | `id` | string | The platform's own id. Unique together with `platform`. | | `platform` | enum | `bluesky`, `mastodon`, `reddit`, `youtube`, `facebook`, `instagram`, `x`, `pinterest`, `linkedin`, `web` (any other site, saved as an article). | | `url` | URL | The post's address. | | `source` | enum | `api`, `extension` or `oembed`: how it reached the service. | | `author` | Author | See below. | | `text` | string | Plain text. For an article it is the plain-text version of the body. | | `title` | string, optional | | | `article` | Article, optional | The long body as blocks. | | `video` | VideoInfo, optional | What a video page shows around the video (YouTube). | | `createdAt` | ISO date, optional | When it was posted. | | `capturedAt` | ISO date | When it was saved. | | `media` | Media[] | Pictures, videos, sound and files. Default empty. | | `metrics` | `{ likes, comments, shares, views }`, each optional | Default empty. | | `titleInfo` | TitleInfo, optional | A film or show's page. | | `quoted` | QuotedPost, optional | A post shown inside this one (X's quoted post). | | `repo` | RepoInfo, optional | A code repository's page. | | `playlist` | PlaylistInfo, optional | A YouTube playlist's page. | | `linkPreviews` | LinkPreview[] (at most 8) | Cards for the links in the text. | | `extra` | record | Platform-specific extras. Never rendered raw. | ### Author `displayName` (required), `id`, `handle`, `url`, `avatar` (a Media) and `verified`. ### Media | Field | Notes | | --- | --- | | `id` | Required. Blocks and previews refer to it. | | `kind` | `image`, `video`, `gif`, `audio` or `file` (anything else a page offers for download, kept as it is and never opened by the app). | | `remoteUrl`, `status` | The original address, and `local` (stored in the bundle) or `remote-only` (only the address is known). | | `localPath`, `mimeType`, `size`, `fileName` | Where it is stored in the bundle, its type, its real size, and for a file the name to show. | | `alt`, `width`, `height` | Text and size. | | `posterUrl`, `posterPath` | A picture to download as the thumbnail, and where it is stored. | | `audioUrl`, `partUrls` | For videos the page streams as separate sound, or as numbered pieces with no playlist. The server joins them. | | `label`, `audioFormat` | The name the extension's list showed; for sound, `original`, `mp3` or `flac`. | | `uploadId`, `audioUploadId` | A video the extension downloaded itself and uploaded in pieces (`POST /capture/uploads`). | | `expectedBytes`, `seconds` | The size a video saved without its file had, and a saved video's length. | | `renditions` (up to 8) | Smaller copies of a saved video: `height`, `width`, `path`, `size`. | | `captions` (up to 20) | Subtitle files: `path` (WebVTT), `language`, `name`. | | `transcript` | `{ path, language, lines }`: what speech recognition found, as its own file. | ### Article `blocks` (at most 5000), `siteName`, `siteLogo` (a media id), `excerpt` and `readingMinutes`. A block is one of: | `type` | Fields | | --- | --- | | `heading` | `level` 1 to 6, `inlines` | | `paragraph`, `quote` | `inlines` | | `list` | `ordered`, `items` (each a list of inlines) | | `code` | `text`, `language` | | `image` | `mediaId`, `caption`, `href` (an `http(s)` link the picture leads to) | | `video`, `file` | `mediaId`, `caption` | | `table` | `header`, `rows` of cells of inlines (at most 500 rows, 40 cells) | | `rule` | none | An **inline** is `text` plus optional `bold`, `italic`, `code`, `href` (web, ftp, sftp, magnet, mailto or tel, never `javascript:` or `data:`) and `image` (a small picture in the line, such as a README badge). An article is plain data and never HTML. ### VideoInfo `seconds`, `subscribers`, `dateText`, `viewsText`, `likesText`, `category`, `description` (runs of text, links and times you can click), `hashtags`, `keywords`, `chapters` (`seconds`, `title`, thumbnail), `transcript` (lines with `start` and `text`), `transcriptLanguage`, `captions` (each `language`, `name`, `kind` of `manual`, `auto` or `translated`, and `vtt` text that the server stores as a file), `commentsText` and up to 100 `comments`. ### LinkPreview `url` (as it appears in the text), `finalUrl`, `kind` (`page` or `image`), `title`, `description`, `siteName`, `imageUrl`, `imagePath`. Made by the server when the post is saved. ### TitleInfo, RepoInfo, PlaylistInfo, QuotedPost - **TitleInfo**: `kind` (`movie`, `series`, `episode`, `other`), `name`, `year`, `plot`, `genres`, `contentRating`, `runtime`, `released`, `scores`, `trailer`, `people` (name, role, character, photo), `details` (label and value), `sections` (strips such as seasons and more like this) and `textSections` (storyline, trivia, reviews). - **RepoInfo**: `host`, `owner`, `name`, `description`, `homepage`, `topics`, `stars`, `forks`, `watchers`, `license`, `defaultBranch`, `clone` (https, ssh, cli), `zipMediaId`, `languages` (name, percent, colour), `releases`, `contributors`, `createdAt`, `pushedAt`. - **PlaylistInfo**: `listId`, `total`, `description`, `viewsText`, `updatedText`, `videos` (at most 300: id, url, title, channel, views, age, duration, thumbnail, `unavailable`) and `truncated`. The videos are not downloaded. - **QuotedPost**: `url`, `authorName`, `handle`, `avatarUrl`, `text`, `imageUrl`, `video`, `createdAt`. Only a preview that links to the post. ## BundleManifest (`post.json`) ```json { "version": 1, "post": { "...": "a Post" }, "files": [{ "path": "images/0.jpg", "bytes": 12345, "sha256": "…64 hex digits…" }], "createdAt": "2026-12-02T10:00:00.000Z" } ``` `version` is `BUNDLE_VERSION` (1). Every file has a SHA-256, so a bundle can be verified without the server. ## CaptureRequest What the extension sends to `POST /capture`: ```json { "post": { "...": "a Post without capturedAt and source" }, "tags": ["travel", "recipes"] } ``` `tags` (at most 100 entries) are added to the tags the post already has. They are checked with the rules in [Tags](https://crawl-docs.pdhq.win/guide/tags.md). ## Using the schema - Parse before you trust: `postSchema.parse(data)` throws with the exact path of a wrong field. - Add a new kind of data by extending the schema first (with limits on every string and array), then the reader, then the renderer. The tests in `packages/schema/src/index.test.ts` show the style. --- # The render package > What packages/render does, every function it exports, how a post becomes an offline page, text and Markdown, and the rules that keep saved pages safe. Source: https://crawl-docs.pdhq.win/advanced/render-package/ Last updated: 2026-12-02 `@social-crawl/render` turns a `Post` into things you can read: the offline `index.html`, plain text, Markdown, the video and playlist blocks, the repository sidebar, and layouts. Its only runtime dependency is `@social-crawl/schema` (no third-party package), and it has no network or file access, so the same code runs on the server (saved bundles, shared pages, ZIPs) and in tests. Build it with `yarn workspace @social-crawl/render build`. Test it with `yarn workspace @social-crawl/render test`. ## Pure functions Every function takes data and returns text. Nothing here reads a file or the network, and no function uses the clock or a random number, so the same post always gives the same page. That is why the page of a post can be redrawn later from `post.json`. ## What it exports | Export | What it does | | --- | --- | | `renderPostHtml(post, options)` | The offline page. `options.lang` sets the language, `options.remoteMedia` shows media from its remote address for a **preview** (never for saved bundles) and allows `https:` images in the CSP, `options.layout` is a layout template for an article. | | `renderPostText(post)` | The plain text, saved as `text/post.txt`. | | `renderPostMarkdown(post, options)` | The Markdown. `links: "bundle"` (default) points at saved files such as `images/0.jpg`, and `links: "remote"` at the original addresses. `baseUrl` puts an address in front of every saved file, so the text works away from the folder (what a share link's Markdown uses). | | `transcriptSection(...)` | The words of a video as a Markdown section. | | `renderPlaylistInfo`, `renderPlaylistMarkdown`, `playlistText`, `PLAYLIST_CSS` | A saved YouTube playlist. | | `renderRepoInfo`, `renderRepoMarkdown`, `repoZip`, `shortCount` | A GitHub repository's sidebar and Markdown. | | `renderVideoHtml`, `clock`, `SEEK_SCRIPT`, `SEEK_SCRIPT_HASH` | The video block, and the small script that seeks a video from the time links, with its CSP hash. | | `parseLayout`, `renderLayout`, `pickLayout`, `layoutDomain`, `LAYOUT_CSS`, `LAYOUT_SOURCE_MAX`, `STARTER_LAYOUTS` | The layout language. See [The layout language](https://crawl-docs.pdhq.win/advanced/layout-language.md). | | `renderSourceBadge`, `renderAvatarFallback`, `SOURCE_BADGE_CSS`, `sourceInfo`, `sourceInfoOf`, `sourceKind`, `PLATFORM_LOGOS`, `SITE_LOGOS`, `siteLogoFor` | The source badge, the logos and the fallback avatar. | | `THEMES` | Per-platform accent colour, card width and font stack. | | `linksIn`, `textParts`, `URL_PATTERN` | Finds links in plain text. | | `escapeHtml`, `safeHttpUrl`, `safeLinkUrl`, `safeBundlePath` | The escaping and URL checks everything else uses. | | `mediaPath`, `extensionForMime`, `MEDIA_FOLDERS`, `BUNDLE_PATHS` | Where a file goes inside a bundle (`images/0.jpg`, `videos/0.mp4`) and the fixed names `index.html`, `post.json`, `text/post.txt` and `post.md`. | | `fileLabel`, `formatBytes` | Words for a file and its size. | | `articleBlocks`, `imageKey`, `isAuthorPicture` | Helpers for article pictures. | ## Safety rules for the page The offline page is a security boundary, because it shows text from the whole internet. - **No scripts.** A post or article page has a `Content-Security-Policy` of `default-src 'none'` with `script-src 'none'`, and allows only its own images and media (and inline styles). The one exception is the video page, whose small seek script for time links is allowed by its **hash** (`SEEK_SCRIPT_HASH`), never by `unsafe-inline`. - **Everything is escaped.** Post text, names and titles go through `escapeHtml`. - **Links are checked.** `safeLinkUrl` keeps `http(s)`, `ftp(s)`, `sftp`, `magnet`, `mailto` and `tel`, and drops everything else (`javascript:`, `data:`, `file:`). - **Paths are checked.** `safeBundlePath` accepts only paths inside the bundle. - **Article blocks are data.** An article is blocks, never HTML, so nothing in a saved article can inject markup. ## Tests `render.test.ts` and `layout.test.ts` use Vitest. They render posts of every platform and check the output for what must be there and what must never be. Add a case when you change what a page draws. ## Add a new kind of page 1. Extend the schema in `packages/schema`. 2. Write a `render` function that returns HTML (and one for Markdown). 3. Call it from `renderPostHtml`, and add its CSS to the page's inline style so the page stays self-contained. 4. Add tests, then rebuild with `yarn build:libs`. --- # Site rules > The data format of an extension site rule: every field, how a rule is matched to a page, the three kinds of selector, and how rules are stored, exported and imported. Source: https://crawl-docs.pdhq.win/advanced/site-rules/ Last updated: 2026-12-02 A **site rule** tells the extension how to read the article of one website when its automatic reader gets it wrong. It is data only: CSS selectors and a few switches. It never runs code. The code is `apps/extension/src/templates.ts` and the reader that uses it is `extract-article.ts`. You can make a rule with the mouse (see [Site rules in the extension](https://crawl-docs.pdhq.win/guide/site-rules-in-the-extension.md)) or write it by hand under **Settings → Site rules** in the extension. ## A rule ```json { "name": "My blog", "hosts": ["blog.example.com"], "paths": "^/posts/", "root": "main article", "title": "h1.entry-title", "author": [".byline a", ".author"], "date": "time[datetime]", "remove": [".share-bar", ".related", "nav"], "map": [ { "selector": ".callout", "as": "quote" }, { "selector": ".big-heading", "as": "h2" } ], "expand": ["details.faq summary"], "waitFor": "main article", "scroll": true } ``` A rule needs `hosts` and at least one of `root`, `remove`, `map`, `title`, `author` or `date`. ## Fields | Field | Type | Meaning | | --- | --- | --- | | `id` | text, up to 80 | Unique id. Made for you when you leave it out. | | `name` | text, up to 100 | A name to recognise it in the settings. | | `hosts` | 1 to 20 host names | The sites it is for. `example.com` also covers `www.example.com` and every other subdomain. A leading `*.` or `www.` is dropped. | | `paths` | regular expression, up to 200 | Only pages whose path matches it, written without slashes around it, for example `^/blog/`. | | `root` | selector or up to 10 selectors | The element(s) that hold the article. Several selectors are several areas: all that are on the page are saved, in page order. | | `fallbackRoot` | up to 8 selectors | Backup areas, tried in order when none of `root` is on the page (the site changed its markup). | | `title`, `author`, `date` | a selector or a list of up to 8 | Where to find them when the page's own tags are not enough. A list is a list of fallbacks: the first that finds something wins. | | `remove` | up to 60 selectors | Parts to leave out: menus, related posts, share bars. | | `map` | up to 60 `{ selector, as }` | For parts built from plain boxes: say what each is. `as` is one of `h1`, `h2`, `h3`, `h4`, `quote`, `code`, `rule`, `bullet`, `number`, `paragraph`, `file`, `ignore`. | | `expand` | up to 20 selectors | Parts to click open before reading (toggles whose content is only drawn when opened). They are closed again afterwards. | | `rows` | selector | Parts the page throws away again when they scroll out of view (Notion). While scrolling they are remembered and put back for reading. Needs `scroll`. | | `detect` | selector | Recognises pages made with a tool (Notion) whatever their address: the rule then applies there too, unless the site has a rule of its own. | | `waitFor`, `waitMs` | selector, ms | Wait until the selector exists (the page draws its text late), for up to `waitMs` (default 6000, at most 15000). | | `scroll` | `true` or a selector | Scroll the page, or the element, once from top to bottom, so lazy content loads. | | `allowShort` | `true` | Accept articles with less text than the automatic reader would. | | `keepSmall` | `true` | Keep pictures narrower than 120 px (logos and icons) that the reader leaves out. For pages where every picture is content, such as a README. | ## Selectors Each selector is one of three kinds: | Kind | Looks like | Notes | | --- | --- | --- | | CSS | `main article` | The default. Checked with the browser's own parser, so a wrong one is refused with the field name. | | XPath | `xpath://div[@id='x']` | Everything after `xpath:` is the expression. | | Text | `text:Related posts` | Matches a part by the words in it. | A selector is at most 300 characters. ## Which rule is used 1. Your own rules come first. A rule you made for a host always beats a built-in one. 2. A rule covers a page when one of its `hosts` equals the page's host (without `www.`) or is its parent domain, and `paths`, if set, matches the path. The **most specific host (the longest) wins**. 3. A rule with `detect` also covers pages on any address where that selector exists, unless a rule names the site. 4. With no rule, the automatic reader runs: the page's `
`, or the block with the most text. Built-in rules live in `BUILTIN_TEMPLATES` in `templates.ts`. They were checked against the sites' markup as known, not on the live pages. ## Storage, export and import Rules are kept in the browser's `chrome.storage.local`, at most 200. They live in the extension, not on your server. **Export my rules** writes them as JSON, and **Import rules** reads such a file. Every rule is checked again on import by `parseTemplate`, which says what is wrong. ## Write one 1. Open the page, press **Choose the article area** and click the part. The rule is made for you. Open **Site rules** to read it. 2. Add `remove` for the parts that came along that you do not want. 3. Add `map` entries for parts that are headings or quotes drawn as plain boxes. 4. Press **Save rule**, save the page again, and look at the result in the library. For a page that draws late, add `waitFor`. For lazy pages, add `scroll`. ## Rules for the web app's view are a separate thing How a saved article is **shown** is set by a layout, not a site rule. See [The layout language](https://crawl-docs.pdhq.win/advanced/layout-language.md). --- # The layout language > The exact grammar of a layout template, what each part draws, the errors the parser gives, the five starting layouts, and how to use the parser from code. Source: https://crawl-docs.pdhq.win/advanced/layout-language/ Last updated: 2026-12-02 A layout is a template that says where the parts of a saved web **article** go. It is a small BBCode-like language, parsed and drawn by `packages/render/src/layout.ts`. It changes how an article is shown, never what was saved. For the user view see [Layouts](https://crawl-docs.pdhq.win/guide/layouts.md). ## Grammar Everything between `[` and `]` is a tag. Everything else is text. Blank lines separate paragraphs of text. | Tag | Meaning | Closes with | | --- | --- | --- | | `[title]` `[author]` `[avatar]` `[date]` `[site]` `[reading]` `[original]` `[saved]` | One fact of the post. Drawn only when the post has the data (`[saved]` is always drawn). | none | | `[body]` | Every block of the article that no `[part]` placed. | none | | `[part "Heading"]` | The heading with that name and the blocks under it, up to the next heading of the same or a higher level. The name is in double quotes, 1 to 80 characters, matched without regard to letter case. | none | | `[rule]` | A divider line. | none | | `[columns N]` | `N` is 2 or 3. Columns stack on a phone. | `[/columns]` | | `[next]` | Moves to the next column. Only inside `[columns]`. | none | | `[box tone=T]` | A framed note. `T` is `info`, `warn` or `note` (the default). | `[/box]` | | plain text | A paragraph. | none | Tag names are not case sensitive. A layout is at most **20,000** characters (`LAYOUT_SOURCE_MAX`). Columns and boxes can sit inside each other up to **4** levels (`MAX_DEPTH`). A part that the post does not have draws nothing, and a column or box with nothing in it is left out. ## What each fact draws | Tag | Output | | --- | --- | | `[title]` | The title as a first-level heading. | | `[author]` | The author's name. | | `[avatar]` | The author's picture. | | `[date]`, `[site]`, `[reading]` | The date, the site's name, the reading time such as "4 min read". | | `[original]` | A link to the original page, shown as its address (only `http` and `https`). | | `[saved]` | When it was saved. | All text is escaped. The only output is a fixed set of classes (`lay-text`, `lay-title`, `lay-field`, `lay-body`, `lay-part`, `lay-rule`, `lay-columns`, `lay-col`, `lay-box`) drawn by the stylesheet `LAYOUT_CSS`, which is part of the page, so a saved page needs no build step. ## Errors The parser collects every error with its line number and refuses the template (a saved page whose layout cannot be read falls back to the normal page): | Message | Cause | | --- | --- | | `A [ has no closing ].` | A tag was not closed. | | `A part needs the heading name in quotes: [part "Ingredients"].` | `[part]` without a quoted name. | | `Columns are 2 or 3: [columns 2].` | A wrong number. | | `[next] only works inside [columns].` and `There are more [next] than columns.` | A misplaced `[next]`. | | `A box tone is info, warn, note: [box tone=info].` | An unknown tone. | | `[/columns] has no matching [columns N].` and `[/box] has no matching [box].` | A closing tag with no opening one. | | `[columns] is never closed with [/columns].` and `[box] is never closed with [/box].` | An opening tag with no closing one. | | `Too many columns and boxes inside each other.` | More than 4 levels. | | `I do not know [x].` | An unknown tag. | | `A layout can be 20000 characters at most.` | Too long. | ## Which layout is used A layout belongs to a **site** (a lower-case host without `www.`). For a post, `pickLayout(url, layouts)` takes the layout whose site equals the post's host or is its parent domain, and the **longest** such site wins. A layout for `docs.example.com` beats one for `example.com`. The API allows 100 layouts and one per site. ## The starting layouts `STARTER_LAYOUTS` holds five: **Article**, **Docs**, **Product**, **Recipe** and **Thread**. They are plain templates you can read in `layout.ts` and copy from Settings → Layouts. ## From code ```ts import { parseLayout, renderLayout, pickLayout } from "@social-crawl/render"; const parsed = parseLayout(source); if (!parsed.ok) throw new Error(parsed.errors.map((e) => `line ${e.line}: ${e.message}`).join("\n")); const html = renderLayout(parsed.nodes, post.article.blocks, parts); // `parts` is what the page renderer supplies ``` `renderPostHtml(post, { layout: source })` does all of it for a saved article, and ignores the layout for any other kind of post. ## Where the API uses it - `GET /layouts`, `POST /layouts`, `PUT /layouts/:id` and `DELETE /layouts/:id` manage them, and the API checks each template with `parseLayout` before saving. - `bookmarks/:id/files/layout.html` draws a post's page with its layout, on demand. - The saved `index.html` and every ZIP of an article use it. The stored `index.html` of an older post is only redrawn when the post is saved again. --- # Build, test and extend > Set up a development copy, run the API, web app, extension and docs, run every check the CI runs, and learn the repository's conventions before you change code. Source: https://crawl-docs.pdhq.win/advanced/build-test-extend/ Last updated: 2026-12-02 ## Requirements - Node 22 and Yarn 4 through Corepack. The Yarn version is pinned in the root `package.json`. - PostgreSQL for the API (any recent version; CI uses 17). - ffmpeg for video features and the frame tests (`apt install ffmpeg`). - In a sandbox that blocks the default registry, set `COREPACK_NPM_REGISTRY=https://registry.npmjs.org` so Corepack can fetch Yarn. ```bash corepack enable yarn install yarn build:libs # builds packages/schema and packages/render ``` ## Run it **The API** needs a database and three values: ```bash export DATABASE_URL=postgres://user:pass@127.0.0.1:5432/socialcrawl export JWT_SECRET="$(openssl rand -base64 48)" export ADMIN_PASSWORD_HASH="$(printf '%s' 'a password of 12+ chars' | yarn workspace @social-crawl/api hash-password)" export DB_SYNCHRONIZE=true STORAGE_DIR=./storage PORT=4000 yarn dev:api # builds the libs, then nest start --watch ``` **The web app**, in another terminal: ```bash API_URL=http://127.0.0.1:4000 yarn dev:web # http://localhost:3000 ``` **The extension**: `yarn workspace @social-crawl/extension build` creates `apps/extension/dist`. In Chrome open `chrome://extensions`, turn on **Developer mode**, **Load unpacked**, and choose `dist`. In development the API serves that folder as the download in Settings (`EXTENSION_DIR`, default `../extension/dist`). **These docs**: ```bash yarn workspace @social-crawl/docs dev # builds the content, then next dev yarn workspace @social-crawl/docs build # a static export in apps/docs/out ``` ## The checks (the same ones CI runs) ```bash yarn npm audit --all --recursive # fails on any advisory yarn workspace @social-crawl/web lint yarn workspace @social-crawl/api lint yarn workspace @social-crawl/docs lint yarn lint:libs # the packages and the extension yarn workspace @social-crawl/web format:check yarn workspace @social-crawl/schema typecheck yarn workspace @social-crawl/render typecheck yarn workspace @social-crawl/extension typecheck yarn workspace @social-crawl/api typecheck yarn workspace @social-crawl/schema test yarn workspace @social-crawl/render test yarn workspace @social-crawl/api test yarn workspace @social-crawl/web test yarn workspace @social-crawl/docs test yarn workspace @social-crawl/docs check # the docs' own content checks ``` **Run the API tests with a real PostgreSQL**, as CI does. Without `MIGRATION_TEST_URL` the real-database tests (the database copy and delete) are skipped, and a change to the tables passes locally and then fails in CI: ```bash MIGRATION_TEST_URL=postgres://postgres:postgres@localhost:5432/postgres yarn workspace @social-crawl/api test ``` Use any empty PostgreSQL 16 or newer. PostgreSQL refuses to run as root. The extension's browser tests need Chromium: ```bash CHROMIUM_PATH= yarn workspace @social-crawl/extension test ``` The web app build writes the route types that `tsc` needs, so run `yarn workspace @social-crawl/web build` before `npx tsc --noEmit` there. ## Conventions - **TypeScript** everywhere the tool accepts it. A JavaScript file needs a stated reason. - **Linting is ESLint 10** across the web app, the API, the docs, the packages and the extension. A rule is switched off on one line, with a reason: `// eslint-disable-next-line -- reason`. Formatting is Prettier's job. - **Packages**: official, first-party packages only. Check a package's publisher, maintenance, licence and install scripts, then the audit, before adding it. In an existing project keep its package manager (Yarn here). - **No polyfills.** Use what the target browsers support, or decide on purpose. - **No community UI kits.** The web app's `components/ui` are its own, on Radix primitives and Tailwind. - **Icons**: Tabler first (`@tabler/icons-react`), another set only when Tabler has nothing good. - **Nothing is saved that was not on the post.** Frames of a video are made for a download and not stored. The one exception is a transcript, which can be deleted. - **Posts are data first.** `post.json` is the source of truth; pages are drawn from it. ## Where to change things | You want to | Change | | --- | --- | | Support a new site | A reader in `apps/extension/src` (see [Extension internals](https://crawl-docs.pdhq.win/advanced/extension-internals.md)), a viewer in the web app, and a renderer in `packages/render`. | | Read one site's article better | A site rule: no code (see [Site rules](https://crawl-docs.pdhq.win/advanced/site-rules.md)). | | Add a field to a post | `packages/schema` first, then the reader, the renderer and the viewer. | | Add an API route | A controller in `apps/api/src/`. A route with no `@Scopes` is `web` only. If the browser needs it, add it to the allowlist in `apps/web/src/lib/proxy-allowlist.ts`. Then run `yarn workspace @social-crawl/docs routes`. | | Add a table | An entity in the area, added to `apps/api/src/entities.ts` (the database copy uses that list). There are no migrations. | | Add a setting | In `apps/api/src/config/env.ts` (with a limit), in `docker-compose.yml`, in `.env.example`, and in [Environment variables](https://crawl-docs.pdhq.win/advanced/environment-variables.md). | | Change the look | The web app's colours and spacing are tokens in `apps/web/src/app/globals.css`, shared in spirit with these docs. | | Add a platform adapter for pasted links | Implement `PlatformAdapter` (`apps/api/src/adapters/platform-adapter.ts`): `parse(url)` and `fetchPost(ref)`. Bluesky is the example. | ## Branches and pull requests Code lives on `main`, and you never push to it. Work on a branch and open a pull request. `main` is what Dokploy deploys, so CI must be green before a merge. --- # Extension internals > How the browser extension is built: its modules, how a page is read and sent, how videos are found and uploaded, how big videos are sent, and how to add a reader for a new site. Source: https://crawl-docs.pdhq.win/advanced/extension-internals/ Last updated: 2026-12-02 The extension is plain TypeScript with no framework and no runtime dependencies. It targets Chrome (Manifest V3, minimum version 111). The code is in `apps/extension/src`. `yarn workspace @social-crawl/extension build` compiles it with `tsc` and copies `static/` (the manifest and the HTML pages) into `dist/`. ## The pieces | Piece | Files | Job | | --- | --- | --- | | Service worker | `background.ts` | Keeps, per tab, the video files and playlists the page loaded. Saves a post when the panel asks. Registers the web app bridge. | | The panel ("island") | `island.ts` | The floating panel and its pill, drawn on the page. Shows what was read, the video list, tags, progress and errors. | | Reading and sending | `capture.ts` | Picks the reader for the page (`readerFor`), runs it in the tab with `chrome.scripting.executeScript`, and posts the result to `POST /capture`. | | Readers | `extract.ts` (Instagram), `extract-facebook.ts`, `extract-x.ts`, `extract-pinterest.ts`, `extract-linkedin.ts`, `extract-youtube.ts`, `extract-playlist.ts`, `extract-title.ts` (IMDb, Rotten Tomatoes), `extract-github.ts`, `extract-article.ts` (everything else) | Each is a self-contained function that runs **in the page** and returns a `Post` or a reason. | | Site rules | `templates.ts`, `pick-area.ts`, `options.ts` | The rule data format, the pointing editor, and the rules list in the settings. | | Settings | `settings.ts`, `options.html` | API address, token, video choices, YouTube choices, rules. Stored in `chrome.storage`. | | Video finding | `video-watch.ts`, `video-detect.ts`, `find-streams.ts`, `m3u8.ts`, `video-buttons.ts`, `video-wake.ts`, `probe-download.ts` | A list of what the page loads, like a download manager. Opt-in. | | Downloading | `video-download.ts`, `server-download.ts`, `youtube.ts`, `tube.ts`, `quality.ts` | Saving a picked video: in the browser, then uploaded in 16 MB pieces, or asked of the server. | | Big videos | `big-route.ts`, `big-transfer.ts`, `big-job.ts`, `big-list.ts`, `transfer.ts`, `transfer.html` | Sending a video over the server's limit to WebDAV in parts, from a window of its own. | | Web app bridge | `webapp-bridge.ts` | Lets the web app's **Download video** button ask the extension. Registered only for the web app's site, which the person allowed. | | Lab | `lab*.ts`, `lab.html` | Testing only. Off unless the server sets `LAB_ENABLED`. | ## How a page is read 1. The panel or the toolbar button asks `capture.ts` to read the current tab. 2. `readerFor(url)` chooses a reader. YouTube videos and playlists, X, Facebook, Pinterest, LinkedIn, IMDb and Rotten Tomatoes titles and GitHub repositories each have their own. Instagram uses `extract.ts`. Everything else is an **article**. 3. The reader function is serialised and run in the page. It must be **self-contained**: no imports (types only) and no names from outside, because `chrome.scripting` sends its source text. 4. For an article, a matching site rule (see [Site rules](https://crawl-docs.pdhq.win/advanced/site-rules.md)) is looked up first and passed in. 5. The reader returns `{ ok: true, post, notes }` or `{ ok: false, reason, hint }`. A `hint` of `small` or `pick` makes the panel offer **Save anyway** and **Choose the article area**. ## How a post and its videos are sent - **Small videos.** The browser downloads the files and sends them to `POST /capture/uploads` in 16 MB pieces, then `done`. The post names the upload by `uploadId` (and `audioUploadId` for a sound kept apart), and the server joins them into one file. - **Server downloads.** For sites the server can fetch, only the address goes: `POST /capture/fetches`. - **Streams.** The extension reads the playlist address the page itself requested (HLS), or collects the numbered pieces (LinkedIn), and the server joins them with ffmpeg. DASH is not handled. - **Big videos.** `big-route.ts` decides which way a picked video goes. A video over the server's limit goes the big way: the post is saved first, then a window of the extension (`transfer.html`) sends the tracks in parts, with Resume. - **YouTube.** The formats come from YouTube's player service the way download managers get them, not from the page's own coded player. This is the part most likely to break when YouTube changes. ## Permissions `activeTab`, `scripting`, `storage`, `webRequest`, `declarativeNetRequestWithHostAccess` and `power`, plus optional access to `https://*/*` and localhost. See [Security notes](https://crawl-docs.pdhq.win/advanced/security.md). ## Add a reader for a new site 1. Add `extract-.ts` with one exported async function that returns an `ExtractResult`. Keep it self-contained. 2. Add a branch for the host in `readerFor` in `capture.ts`, and a matching branch in `extract()`. 3. If the site needs a new kind of data, extend the schema first: see [The Post schema](https://crawl-docs.pdhq.win/advanced/post-schema.md). 4. Write a test in `apps/extension/test/`. The extractor tests build a small page and run the reader on it: copy `extract-github.test.mjs` as a pattern. 5. To make the web app show it, add a viewer component and teach `packages/render` to draw it for the saved page. For a site that only needs a better article reader, write a **site rule** instead: no code change. ## Tests The extension tests run in real Chromium (`playwright-core`): ```bash CHROMIUM_PATH= yarn workspace @social-crawl/extension test ``` CI installs Playwright's own Chromium, because Google Chrome no longer loads unpacked extensions from the command line. --- # For AI agents and tools > How an AI assistant or tool should read these docs and a saved post: the llms.txt files, Markdown copies of every page, share links, and the conventions that keep answers accurate. Source: https://crawl-docs.pdhq.win/advanced/for-ai-agents/ Last updated: 2026-12-02 These docs are written for people and for AI tools. Everything is plain Markdown, and nothing important exists only in a picture. ## Read the docs | What | Where | Use it for | | --- | --- | --- | | Index | `/llms.txt` | A list of every page with its title, a one-line description and the address of its Markdown copy. Start here. | | Everything | `/llms-full.txt` | Every page in one file, each after its source address and last-updated date. Use it to give a model the whole documentation at once. | | One page | `/
/.md` | The Markdown of one page, for example `/guide/install-the-server.md`. Every page links to it from its header (**View as Markdown**) and offers **Copy page as Markdown**. | | The pages for people | `/
//` | The same text, drawn for a browser. | | Sitemap | `/sitemap.xml`, `/robots.txt` | For search engines. | Links inside a Markdown copy point at other Markdown copies, with full addresses, so a tool can follow them. ## Conventions you can rely on - **One topic per page**, with a front matter block (`title`, `description`, `updated`) and stable headings: `##` and `###` only, and the same heading text gives the same `#anchor`. - **Callouts** are written as GitHub alerts: `> [!NOTE]`, `> [!TIP]`, `> [!IMPORTANT]`, `> [!WARNING]`, `> [!CAUTION]`, plus two of our own: `> [!NOT-TESTED]` (we never tried this on the real thing) and `> [!SCREEN]` (the words that describe a screenshot or a screen). - **Every screen is described in words** in a `[!SCREEN]` block, so a tool that cannot see an image misses nothing. - **Honesty is marked**: anything not tried on the real thing carries a `[!NOT-TESTED]` block, and the page [What is not tested](https://crawl-docs.pdhq.win/guide/what-is-not-tested.md) lists them all. Do not state those things as facts. - **Terms are used the same way** on every page: see the [Glossary](https://crawl-docs.pdhq.win/advanced/glossary.md). - **Exact names**: environment variables, routes and field names are in code formatting and are copied from the code. - The API route list is **generated** from the controllers: see [API routes and scopes](https://crawl-docs.pdhq.win/advanced/api-routes.md). ## Read a saved post A person can give you a temporary link to one post, or to up to 50 posts. See [Shares and downloads](https://crawl-docs.pdhq.win/guide/shares-and-downloads.md). For a model, use the **Markdown** address: ```text https:///s//md ``` It has the post's text, the full addresses of its pictures and files, and the words of videos that have a transcript or a subtitle file. For several posts, each is after a line ``. Other forms: `/json` (the data), `/zip` and `?light=1` (without videos). - A link answers **404** when it was removed and **410** when its time is up. Do not retry. - Their notes and tags are never in a link. - The link works only while Social Crawl is reachable from the internet and nothing in front of it blocks `/s/`. ## Work on the code Start with [Architecture](https://crawl-docs.pdhq.win/advanced/architecture.md), then [Data model](https://crawl-docs.pdhq.win/advanced/data-model.md), [The Post schema](https://crawl-docs.pdhq.win/advanced/post-schema.md) and [API routes and scopes](https://crawl-docs.pdhq.win/advanced/api-routes.md). The repository's own `TODO.md` lists what is done and what is open, and its `CLAUDE.md` holds the owner's rules for working in it. Respect them: no new package without checking its publisher and the audit, no polyfills, and say exactly what was tested. ## Cite and quote - Quote the page address, not the Markdown copy's, when you point a person to a page. - Use the page's `updated` date to judge how fresh a statement is. The docs follow the `main` branch. - If a page disagrees with the code, the code is right: tell the person, see [Maintain these docs](https://crawl-docs.pdhq.win/advanced/maintain-these-docs.md). --- # Glossary > The words these docs use for Social Crawl's ideas, each defined once and used the same way everywhere, for people and for AI tools. Source: https://crawl-docs.pdhq.win/advanced/glossary/ Last updated: 2026-12-02 Every page uses these words in these senses. ## Words about what you save **Post.** One thing you saved: a social post, an article, a video page, a film's page, a repository or a playlist. It has a row in the database and a bundle of files. **Bundle.** The folder of files that makes one saved post: `index.html`, `post.json`, `post.md`, the text, the pictures and the videos. It opens with a double click, with no network. **Platform.** Where a post came from: `bluesky`, `facebook`, `instagram`, `x`, `pinterest`, `linkedin`, `youtube`, `mastodon`, `reddit` or `web`. `web` means any other website, saved as an article. **Article.** A web page saved as a title, an author, a date and a body of plain blocks (headings, paragraphs, lists, tables, quotes, code, pictures, videos and files). **Reader.** The part of the extension that reads one kind of page and turns it into a post. **Library.** All your posts, as cards, in the web app. The **restricted part** is a second library kept out of sight. **Tag.** A short label you put on a post. Letters, numbers, hyphens and spaces. **Note.** Your own text on a post. Only you can see it. **Attachment.** A saved post, a file or a link that you hung on a post afterwards. ## Words about the parts **Server.** The three containers: the database, the API and the web app. **API.** The NestJS application on port 4000 that stores and serves everything. **Web app.** The Next.js application on port 3000 that you open in a browser. It forwards a fixed list of calls to the API. **Extension.** The browser extension that saves the page you are on. Chrome only today. **Panel (island).** The small floating panel the extension draws on the page. **Token.** A signed proof of who you are. The **web token** lasts 7 days. The **extension token** (scope `capture`) lasts 180 days and can only save posts. **Scope.** What a token may do: `web` or `capture`. ## Words about storage **Main storage.** Where bundles live: the server's disk, or a bucket such as Cloudflare R2. **R2.** Cloudflare's storage with an S3-compatible interface. **WebDAV.** A protocol many cloud storages speak. Used here for large files and for full copies of a post. **Big video.** A video over the server's size limit. It is sent to WebDAV in parts. **Raw video.** The original parts of a big video, before any smaller copy. **Rendition (smaller size).** A smaller copy of a saved video made by the server for the player's Quality menu. **Smaller copy.** A converted copy of a big video made on request: AV1, 10-bit, sound kept as it is. **Transcript.** The words of a video found by speech recognition, kept as a small file you can delete. Not the same as **subtitle files**, which come from the site or from you. ## Words about sharing **Share link.** A temporary link to one post, or to up to 50. Its secret is shown once. **Light ZIP.** A ZIP without videos. **Frame.** A single picture cut from a video. Frames are cut while a ZIP downloads and are never stored. ## Words about rules **Site rule.** Data that tells the extension how to read the article of one website. CSS selectors and switches only. Lives in the extension. **Layout.** A template that says how a saved article of one site is shown. Lives on the server. **Restricted part.** A hidden second library behind a second password. Hidden, not encrypted. ## Words about these docs **`[!NOT-TESTED]`.** A block that marks something never tried on the real thing. **`[!SCREEN]`.** A block that describes a screen in words. **Guide** and **Advanced.** The two layers: the Guide is for someone who has never used it, Advanced is for changing or running it. --- # Maintain these docs > How these docs are built from Markdown, how to add or change a page, the checks that keep them honest, and the rule that keeps them in step with the app. Source: https://crawl-docs.pdhq.win/advanced/maintain-these-docs/ Last updated: 2026-12-04 The docs are the Next.js app `apps/docs`. Its pages are Markdown files in `apps/docs/content`. A build turns them into a static site, a Markdown copy of every page, `llms.txt`, `llms-full.txt`, a search index, a sitemap and `robots.txt`. ## The rule > **A change to what the app does or shows is not finished until the page that describes it is changed in the same pull request.** The same rule is written in the repository's `CLAUDE.md`, so an AI assistant working in the repository follows it too. A page that is wrong is worse than a missing page. When you change a screen, a setting, a route, a column or a message, search the pages for its name and fix what you find: ```bash grep -rn "the thing you changed" apps/docs/content ``` Say in the pull request which pages changed. If a feature has never been tried on the real thing, say so on the page with a `[!NOT-TESTED]` block instead of leaving it out. ## Add a page 1. Create `apps/docs/content/
/.md`, where `
` is `guide` or `advanced`. The file name is the address. 2. Start it with front matter: ```text --- title: A short name, 70 characters at most description: One sentence, 40 to 200 characters, that says what the page tells. Search and AI indexes show it. updated: 2026-12-02 --- ``` 3. Add its slug (`guide/`) to a group in `apps/docs/content/nav.json`. The order in the file is the order in the sidebar and the order of the previous and next links. 4. Write the body. Do not write a `#` heading: the title comes from the front matter. Use `##` and `###`, and do not skip a level. 5. Run `yarn workspace @social-crawl/docs check`. ## Write the way the docs are written - **One topic per page.** If a page needs two titles, make two pages. - **Say what you should see** after each step in the Guide. - **Describe every screen in words** with a `> [!SCREEN]` block of at least 40 characters. The build refuses a shorter one. - **A picture needs alt text** that says what it shows. The build refuses an empty one. - **Link with root paths**: `[Install the server](https://crawl-docs.pdhq.win/guide/install-the-server.md)`. A link to a heading uses its address: the heading text in lower case with dashes (`#step-2-make-your-password-s-hash`). The build checks that the page and the heading exist. - **Check it against the code.** Every command, setting name, button label and message on a page must be copied from the code or the real app, not remembered. - **Plain words.** The Guide is for someone who has never seen the code. Keep the code details in Advanced. - Callouts: `[!NOTE]`, `[!TIP]`, `[!IMPORTANT]`, `[!WARNING]`, `[!CAUTION]`, `[!NOT-TESTED]` and `[!SCREEN]`. Each draws an icon and a word, so the kind never depends on colour alone. ## What the build checks `yarn workspace @social-crawl/docs build` (and `check`) stops with a list of problems when: - a page has no title, a title over 70 characters, a missing or odd-length description, or a bad `updated` date; - a link goes to a page or a heading that does not exist; - a picture has no alt text, or a `[!SCREEN]` block is too short; - a heading skips a level, or the body has its own `#` heading; - a callout kind is unknown, or the text has `TODO`, `TBD` or placeholder text; - a page file is not listed in `nav.json`, or is listed twice. ## The generated page [API routes and scopes](https://crawl-docs.pdhq.win/advanced/api-routes.md) is made from the API's controllers. Do not edit it by hand. After you add, change or remove a route run: ```bash yarn workspace @social-crawl/docs routes ``` and commit the result. ## Build and preview ```bash yarn workspace @social-crawl/docs dev # live, at http://localhost:3000 yarn workspace @social-crawl/docs build # the static site in apps/docs/out yarn workspace @social-crawl/docs test # the content and search tests ``` Set `DOCS_SITE_URL` to the real address of the docs before a production build, so `llms.txt`, the sitemap and the canonical addresses are right. See [Deploy and operate](https://crawl-docs.pdhq.win/advanced/deploy-and-operate.md) for the container. ## How the pages draw The Markdown is rendered with `react-markdown` and GitHub-flavoured tables. Callouts, code blocks with a copy button, headings with anchors and the "On this page" rail with its scroll-following line are components in `apps/docs/src/components`. The rail is the scroll-spy table of contents from the `table-of-contents` repository, copied in. Colours come from the same tokens as the web app, so the docs match it.