A Node.js API that generates high-quality, 16:9 GeoChart images using Google Charts and Puppeteer.
- Generates 1920x1080 (16:9) images of the world map.
- Custom Color Scheme:
- No Data / Default:
#D0D0D0(Light Gray) - Data Gradient:
#BBC3CF(Light Blue-Grey) to#215BAE(Deep Blue)
- No Data / Default:
- Docker Support: Ready for deployment with Docker and Coolify.
- Node.js (v18+)
- OR Docker & Docker Compose
-
Clone the repository:
git clone <repository-url> cd MapChartAPI
-
Install dependencies:
npm install
-
Start the server:
node index.js
The server runs on port 3000.
POST /geochart
Send a JSON object where keys are country names and values are numeric data.
Example Payload:
{
"India": 200,
"USA": 100,
"Nigeria": 50,
"Germany": 75,
"Brazil": 80
}Windows (PowerShell):
Note: Use curl.exe to avoid PowerShell's alias issues.
curl.exe -X POST -H "Content-Type: application/json" -d '{"India": 200, "USA": 100}' http://localhost:3000/geochart -o map.pngLinux/Mac:
curl -X POST -H "Content-Type: application/json" -d '{"India": 200, "USA": 100}' http://localhost:3000/geochart -o map.pngThis project includes a Dockerfile and docker-compose.yml for easy deployment.
docker-compose up -d --buildThe API will be available at http://localhost:3000/geochart.
- Push your code to a Git repository (GitHub/GitLab).
- Login to your Coolify Dashboard.
- Click + New Resource -> Project -> Production (or your env).
- Select Git Repository (Public or Private).
- Paste your repository URL and select the branch (e.g.,
main). - Coolify will detect the
docker-compose.ymlfile.- Build Pack: Select
Docker Compose. - Domains: Set your domain (e.g.,
https://map-api.yourdomain.com). - Ports: Coolify usually auto-detects
3000, but you can verify in Settings.
- Build Pack: Select
- Click Deploy.
Troubleshooting on Coolify:
- If the build fails, check if the
Dockerfileis being picked up correctly. - Ensure the Healthcheck is passing (Coolify shows "Green" status).