{"id":16313,"library":"coingecko-api","title":"CoinGecko API Client for Node.js","description":"This package, `coingecko-api`, is a Node.js wrapper for the CoinGecko API, notable for its explicit lack of external dependencies. The current stable version, 1.0.10, was published over six years ago and appears to be largely unmaintained. While the CoinGecko API itself is actively developed with frequent updates and breaking changes, this particular wrapper does not reflect those ongoing developments, including new endpoints, security updates, or changes in data structures. As such, it differentiates itself by being dependency-free but offers an outdated interface to the CoinGecko API. Newer community-driven wrappers, often with TypeScript support, have emerged to keep pace with the official API's evolution.","status":"abandoned","version":"1.0.10","language":"javascript","source_language":"en","source_url":"https://github.com/miscavage/CoinGecko-API","tags":["javascript","coingecko","cryptocurrency","api","api-wrapper","dependency-less","no-dependencies","nodejs","npm"],"install":[{"cmd":"npm install coingecko-api","lang":"bash","label":"npm"},{"cmd":"yarn add coingecko-api","lang":"bash","label":"yarn"},{"cmd":"pnpm add coingecko-api","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS-only, last updated over six years ago. ESM imports will result in a runtime error unless using a CJS interop loader.","wrong":"import CoinGecko from 'coingecko-api';","symbol":"CoinGecko","correct":"const CoinGecko = require('coingecko-api');"},{"note":"Constants like ORDER are exposed as properties of the main CoinGecko export, not as named exports. Requires CommonJS `require` syntax.","wrong":"import { ORDER } from 'coingecko-api';","symbol":"CoinGecko.ORDER","correct":"const CoinGecko = require('coingecko-api');\nconst order = CoinGecko.ORDER.MARKET_CAP_DESC;"},{"note":"Similar to ORDER, constants are properties of the main CoinGecko export. Direct named import will fail.","wrong":"import { STATUS_UPDATE_CATEGORY } from 'coingecko-api';","symbol":"CoinGecko.STATUS_UPDATE_CATEGORY","correct":"const CoinGecko = require('coingecko-api');\nconst category = CoinGecko.STATUS_UPDATE_CATEGORY.GENERAL;"}],"quickstart":{"code":"const CoinGecko = require('coingecko-api');\n\nconst CoinGeckoClient = new CoinGecko();\n\nconst fetchPingAndBitcoinPrice = async () => {\n  try {\n    // Ping the API to check connectivity\n    let pingData = await CoinGeckoClient.ping();\n    console.log('API Ping Status:', pingData.data.gecko_says);\n\n    // Get current price of Bitcoin in USD\n    let bitcoinPrice = await CoinGeckoClient.simple.price({\n      ids: 'bitcoin',\n      vs_currencies: 'usd'\n    });\n    console.log('Bitcoin Price (USD):', bitcoinPrice.data.bitcoin.usd);\n\n    // Example using a constant for ordering results\n    let markets = await CoinGeckoClient.coins.markets({\n      vs_currency: 'usd',\n      order: CoinGecko.ORDER.MARKET_CAP_DESC,\n      per_page: 5\n    });\n    console.log('Top 5 Coins by Market Cap:', markets.data.map(coin => coin.name));\n\n  } catch (error) {\n    console.error('Error fetching data from CoinGecko:', error.message);\n  }\n};\n\nfetchPingAndBitcoinPrice();","lang":"javascript","description":"Demonstrates initializing the CoinGecko API client, making a simple ping request, fetching Bitcoin's price, and listing top coins by market cap using an internal constant."},"warnings":[{"fix":"Consider migrating to a more actively maintained CoinGecko API client, such as `coingecko-api-v3` or `@crypto-coffee/coingecko-api`, which are regularly updated and support modern JavaScript/TypeScript features.","message":"This package (v1.0.10) has not been updated in over six years and does not reflect recent breaking changes in the official CoinGecko API. Endpoints, parameters, or data structures may have diverged significantly, leading to unexpected behavior or incorrect data.","severity":"breaking","affected_versions":"1.0.10"},{"fix":"Verify the expected data structure and field availability against the current official CoinGecko API documentation. Use an updated client or implement custom handling for potentially `null` or missing data.","message":"The official CoinGecko API made significant breaking changes regarding how `market_cap_rank` is handled for rehypothecated tokens and deprecated the `trust_score` field in early 2026. This wrapper will likely return `null` or outdated values for these fields as it has not been updated to reflect these changes.","severity":"breaking","affected_versions":"1.0.10"},{"fix":"Always use `const CoinGecko = require('coingecko-api');` when importing this package. If you require ESM, use a transpilation step or a different, modern API client.","message":"This package is CommonJS-only. Attempting to use `import CoinGecko from 'coingecko-api';` directly in an ES Module context will result in a runtime error unless a compatible CJS interop mechanism is used.","severity":"gotcha","affected_versions":"1.0.10"},{"fix":"Implement custom rate limiting and retry logic in your application. For higher call volumes, consider obtaining a CoinGecko Pro API key and ensure your client supports API key authentication, which this wrapper may not fully facilitate.","message":"The public CoinGecko API has rate limits (e.g., 50 calls/minute for the free tier). This wrapper does not include built-in rate limiting or retry mechanisms. Exceeding limits will result in HTTP 429 Too Many Requests errors.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Ensure your project is configured for CommonJS (`\"type\": \"commonjs\"` in `package.json` or by using `.cjs` file extensions) or use a modern CoinGecko client that supports ESM imports.","cause":"Attempting to use `require()` in an ES Module (ESM) environment without proper configuration, or trying to use `import` with a CommonJS-only package.","error":"ReferenceError: require is not defined"},{"fix":"Check the official CoinGecko API documentation for the method you are trying to call. If it's a new endpoint, this wrapper will not support it. Migrate to a more recent, actively maintained CoinGecko API client or use direct HTTP requests.","cause":"The package is abandoned and does not support new endpoints or methods introduced in the CoinGecko API since its last update over six years ago.","error":"TypeError: CoinGeckoClient.someNewMethod is not a function"},{"fix":"Introduce a delay between API calls, implement a robust rate-limiting strategy, or subscribe to a CoinGecko Pro API plan for higher rate limits. Note that this wrapper does not handle rate limiting internally.","cause":"Exceeded the rate limits for the CoinGecko API (e.g., 50 requests/minute for the public API).","error":"Error fetching data from CoinGecko: 429 Too Many Requests"},{"fix":"The official CoinGecko API has introduced `market_cap_rank_with_rehypothecated` and deprecated `trust_score`. This wrapper is unaware of these changes. Either update to a current API client or add defensive coding to handle potentially `null` or missing data for these specific fields.","cause":"Accessing `market_cap_rank` or similar fields that have been deprecated or modified in the CoinGecko API since this wrapper's last update.","error":"property 'market_cap_rank' of undefined / null"}],"ecosystem":"npm"}