This repository is a Vercel project with three responsibilities:
- a small Svelte web entrance
- an article extraction API at
api/readability.js - a Telegram webhook at
api/webhook.js
The current architecture is intentionally simple:
src/contains the Vite/Svelte frontendapi/contains thin Vercel serverless handlerslib/server/contains shared backend logicpublic/contains only static assets that should be copied through the build
- Package manager:
pnpm - Frontend:
Vite+Svelte - Runtime target:
Node 22.x - Deployment target:
Vercel
Important files:
package.jsonvercel.jsonvite.config.mjspnpm-lock.yaml
Install dependencies:
pnpm installRun frontend locally:
pnpm devBuild for production:
pnpm buildDeploy production:
npx vercel deploy --prod-
Keep
api/handlers thin. Move reusable logic intolib/server/instead of duplicating it across endpoints. -
Do not reintroduce the old Rollup/Yarn setup. This repo is standardized on
pnpm,Vite, andpnpm-lock.yaml. -
Do not commit generated legacy assets. In particular,
public/build/should not come back. -
Preserve the separation of concerns:
- request handling in
api/ - extraction/config/Telegram logic in
lib/server/ - UI in
src/
- request handling in
-
Keep Vercel config aligned with pnpm.
vercel.jsoncurrently enables Corepack because Vercel needs that for pinnedpnpm@10. -
Be careful with Telegram formatting. Messages sent through the webhook use HTML parse mode, so links and text must stay escaped correctly.
-
Be careful with extracted HTML. Readability output is sanitized before rendering. Do not remove sanitization unless you replace it with something equivalent.
Expected variables in Vercel:
BOT_TOKENIV_RHASHAPP_URLoptionalREADABILITY_API_URLoptional
APP_URL and READABILITY_API_URL can be inferred automatically, so avoid hardcoding them unless required.
- Vercel production is currently expected to build with
pnpm build. - The project uses
packageManagerinpackage.jsonandENABLE_EXPERIMENTAL_COREPACKinvercel.jsonso the remote build uses the pinned pnpm version. - If deployment starts failing on package-manager resolution, check
package.jsonandvercel.jsonfirst.
There is no formal automated test suite yet.
Before shipping changes, at minimum:
- Run
pnpm build. - Ensure both server modules still load:
node -e "require('./api/readability.js'); require('./api/webhook.js'); console.log('ok')"- If backend logic changed, manually verify:
/api/readability?url=.../api/readability?url=...&format=json- Telegram webhook behavior if relevant
When making substantial changes:
- prefer one coherent commit per migration or feature
- keep the user as the primary author when requested
- add
Co-authored-by: Codex <codex@openai.com>when Codex contributed materially