Early scaffold for a TypeScript Node.js Telegram trading bot using grammY.
- TypeScript + strict config
- Environment validation via
zod - Logging with
pino - Dev runner with
tsx(fast ESM TS execution + watch) - Testing with
vitest - Linting with ESLint + Prettier
- Install dependencies:
npm install- Create a
.envfile (see.env.examplefor the full list):
NODE_ENV=development
TELEGRAM_BOT_TOKEN=123456:replace_me
# Optional integrations (uncomment & fill as needed)
# TURNKEY_ENDPOINT=
# TURNKEY_PRIVATE_KEY=
# TURNKEY_PUBLIC_KEY=
# TURNKEY_ORGANIZATION_ID=
# FIREBASE_SERVICE_KEY=
# APTOS=
# APTOS_TESTING_PRIVATE_KEY=
# APTOS_GEOMI_TESTNET_INDEXER_API_KEY=
# APTOS_GEOMI_MAINNET_INDEXER_API_KEY=
# REDIS_URL=redis://localhost:6379/0- Run in dev mode (auto-reload):
npm run dev- Build & run production bundle:
npm run build
npm startDelete a sub-organization (irreversible):
Prerequisites (env vars in your .env):
TURNKEY_ENDPOINT=https://api.turnkey.com # or custom if provided
TURNKEY_API_PRIVATE_KEY=... # P-256 private key (PEM without headers ok)
TURNKEY_API_PUBLIC_KEY=... # Corresponding public key
TURNKEY_PUBLIC_KEY=... # Root user api key public key used when creating sub orgs
TURNKEY_ORGANIZATION_ID=... # Root (parent) organization UUID
Run via npm script (preferred):
npm run delete:suborg -- <SUB_ORG_UUID>Or with an env variable:
SUB_ORG_ID=<SUB_ORG_UUID> npm run delete:suborgDirect execution with tsx (if installed globally or via npx):
npx tsx scripts/delete-suborg.ts <SUB_ORG_UUID>Skip confirmation prompt:
npm run delete:suborg -- <SUB_ORG_UUID> --force
# or
FORCE=1 SUB_ORG_ID=<SUB_ORG_UUID> npm run delete:suborgExit codes:
- 0 success / aborted by user
- 1 missing id
- 2 completed but no id returned in result
- 3 failure submitting or polling delete
Enable verbose polling logs by setting TURNKEY_VERBOSE=1 in your environment.
src/
index.ts # entrypoint
- Add trading exchange integration (e.g., CCXT) with proper rate limiting
- Implement command modules pattern
- Persistent storage (SQLite/Postgres)
- Add risk management & order execution logic
- Expand test suite
MIT (add a LICENSE file as needed)