Perbug is organized as a monorepo with mobile app, backend API, and static marketing/docs web assets.
app/— Flutter mobile applicationbackend/— Node/TypeScript backend servicesweb/— Astro + MDX + Tailwind marketing and documentation site
cd app
flutter pub get
flutter runIf Flutter reports a package resolution error such as
Couldn't resolve the package 'perbug' in 'package:perbug/main.dart', clear
stale generated artifacts and rebuild:
./scripts/flutter_reset.sh
cd app
flutter build webEquivalent manual commands:
cd app
flutter clean
rm -rf .dart_tool build
flutter pub get
flutter build webcd backend
npm install
npm run devcd web
pnpm install
pnpm devConvenience scripts from repo root:
./scripts/web_dev.sh
./scripts/web_build.shFor testing from another device on your LAN (for example, phone browser), run:
cd web
pnpm dev --host 0.0.0.0 --port 5173Then open http://<your-computer-lan-ip>:5173 from the phone.
Create web/.env based on web/.env.example.
PERBUG_APPSTORE_URL— App Store listing URLPERBUG_PLAYSTORE_URL— Google Play listing URLPERBUG_DOCS_GITHUB_URL— Base URL used for "Edit on GitHub" linksPERBUG_SUPPORT_EMAIL— support email used on/supportPERBUG_SITE_URL— canonical website URL (for SEO/sitemap)PERBUG_ANALYTICS_ENABLED—trueorfalse(default false)PERBUG_ANALYTICS_PROVIDER— optional provider name (analytics stays off by default)
If store links are missing, the UI gracefully displays “Coming soon”.
cd web
pnpm buildStatic output is generated in web/dist.
The website is static and can be deployed to any static host with custom domains.
- Root directory:
web - Build command:
pnpm build - Output directory:
dist
- Project root:
web - Build command:
pnpm build - Build output:
dist
- Base directory:
web - Build command:
pnpm build - Publish directory:
dist
Configure backend CORS via environment variables (see .env.example).
CORS_ALLOWED_ORIGINS— comma-separated allowlist of exact origins (includehttps://app.perbug.comin production).CORS_ALLOW_CREDENTIALS—trueorfalsefor cookie/auth credentialed requests.CORS_ALLOWED_METHODS— allowed methods for preflight and normal browser requests.CORS_ALLOWED_HEADERS— allowed request headers (e.g.Authorization,x-user-id,x-request-id).CORS_EXPOSE_HEADERS— response headers available to browser JS (e.g.x-request-id).CORS_MAX_AGE_SECONDS— preflight cache TTL in seconds.
Example production value:
CORS_ALLOWED_ORIGINS=https://app.perbug.comExample local Flutter/web values:
CORS_ALLOWED_ORIGINS=https://app.perbug.com,http://localhost:3000,http://localhost:5173,http://localhost:8080When accessing local services from a phone on the same Wi‑Fi, include your LAN origin too, e.g.:
CORS_ALLOWED_ORIGINS=http://192.168.1.20:5173,http://192.168.1.20:8080Quick verification:
curl -i -X OPTIONS https://api.perbug.com/api/geo/search \
-H "Origin: https://app.perbug.com" \
-H "Access-Control-Request-Method: GET" \
-H "Access-Control-Request-Headers: content-type,x-user-id,x-request-id"
curl -i "https://api.perbug.com/api/geo/search?q=Berlin" \
-H "Origin: https://app.perbug.com"Perbug payout and node integration now uses a local Bitcoin-style JSON-RPC endpoint on localhost only.
PERBUG_RPC_HOST=127.0.0.1PERBUG_RPC_PORT=9332PERBUG_NODE_PORT=9333PERBUG_RPC_USER=perbugrpcPERBUG_RPC_PASSWORD=change_this_to_a_long_random_password
The backend expects rpcbind=127.0.0.1 and rpcallowip=127.0.0.1 in the node config.
Perbug can run as a Telegram Mini App using the Flutter Web build hosted on HTTPS.
Set these in backend/bot runtime environments (never in frontend code):
TELEGRAM_BOT_TOKEN— Bot token for Perbugbot from BotFather.PERBUG_MINI_APP_URL— HTTPS URL whereflutter build weboutput is hosted.PERBUG_BOT_DISPLAY_NAME— Optional label override (defaults toPerbugbot).
- Build and deploy Flutter web (
app/build/web) to your production HTTPS URL. - Configure Mini App URL in BotFather for Perbugbot.
- Run backend bot worker:
cd backend npm run build npm run bot:perbug /start,/app, and/opencommands will send a launch keyboard with aweb_appbutton.- The bot also configures the chat menu button to open the same Mini App URL.
- Do not hardcode
TELEGRAM_BOT_TOKENin source files. - Do not expose Telegram bot token to Flutter web clients.
- If a token is leaked in logs/chats/source, rotate in BotFather and update server env values.