Skip to content

A Node.js API that generates high-quality, 16:9 GeoChart images using Google Charts and Puppeteer.

Notifications You must be signed in to change notification settings

Ytosko/MapChartAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MapChart API

A Node.js API that generates high-quality, 16:9 GeoChart images using Google Charts and Puppeteer.

Features

  • 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)
  • Docker Support: Ready for deployment with Docker and Coolify.

Prerequisites

  • Node.js (v18+)
  • OR Docker & Docker Compose

Installation

  1. Clone the repository:

    git clone <repository-url>
    cd MapChartAPI
  2. Install dependencies:

    npm install
  3. Start the server:

    node index.js

    The server runs on port 3000.

Usage

Endpoint

POST /geochart

Request Body

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
}

Example Request (curl)

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.png

Linux/Mac:

curl -X POST -H "Content-Type: application/json" -d '{"India": 200, "USA": 100}' http://localhost:3000/geochart -o map.png

Docker Deployment

This project includes a Dockerfile and docker-compose.yml for easy deployment.

Run with Docker Compose

docker-compose up -d --build

The API will be available at http://localhost:3000/geochart.

Deploying to Coolify

  1. Push your code to a Git repository (GitHub/GitLab).
  2. Login to your Coolify Dashboard.
  3. Click + New Resource -> Project -> Production (or your env).
  4. Select Git Repository (Public or Private).
  5. Paste your repository URL and select the branch (e.g., main).
  6. Coolify will detect the docker-compose.yml file.
    • 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.
  7. Click Deploy.

Troubleshooting on Coolify:

  • If the build fails, check if the Dockerfile is being picked up correctly.
  • Ensure the Healthcheck is passing (Coolify shows "Green" status).

About

A Node.js API that generates high-quality, 16:9 GeoChart images using Google Charts and Puppeteer.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published