nasa-rs

A blazing-fast Rust SDK and CLI for NASA APIs

Access NASA's treasure trove of space data with full API coverage. Built with Rust for optimal performance and deployed on Cloudflare's edge network.

11+ NASA APIs
70+ Commands
100% Rust

Key Features

🌌

Complete NASA Coverage

Access all NASA public APIs including APOD, Mars Rover Photos, Exoplanets, NEO, and more

πŸš€

High Performance

Built with Rust for optimal speed and efficiency, deployed on Cloudflare's global edge network

πŸ’Ύ

Smart Caching

KV-based caching with intelligent TTL management for faster responses and reduced API calls

πŸ›‘οΈ

Rate Limiting

Built-in protection against API abuse with configurable limits per IP address

πŸ“Š

Multiple Formats

Export data as JSON, tables, pretty-print, CSV, or compact format for easy integration

🎨

Interactive CLI

Beautiful command-line interface with colored output, progress bars, and interactive menus

Quick Start

Install CLI

# Install from source
cargo install --path . --features cli

# Or download pre-built binary
curl -L https://github.com/guitaripod/nasa-rs/releases/latest/download/nasa-cli-$(uname -s)-$(uname -m) -o nasa-cli
chmod +x nasa-cli

Configure & Run

# Set your NASA API key
nasa-cli config set-key YOUR_API_KEY

# Get today's APOD
nasa-cli apod today

CLI Command Examples

Explore all available commands with real outputs

$ nasa-cli apod today
🌌 Astronomy Picture of the Day

The Crab Nebula in Infrared
Date: 2024-01-15

Explanation:
The Crab Nebula is cataloged as M1, the first object on Charles Messier's 
famous list of things which are not comets. In fact, the Crab is now known 
to be a supernova remnant, expanding debris from the death explosion of a 
massive star. This intriguing false-color image combines data from space-based 
observatories Chandra, Hubble, and Spitzer to explore the debris cloud in 
X-rays (blue-white), optical (purple), and infrared (pink)...

Copyright: NASA, ESA, J. Hester (ASU)
HD URL: https://apod.nasa.gov/apod/image/2401/crab_nebula_4k.jpg
Media Type: image
$ nasa-cli apod range 2025-01-01 2025-01-03
🌌 APOD Date Range

2025-01-01: Alpha Centauri: The Closest Star System
  URL: https://apod.nasa.gov/apod/image/2501/AlphaCen_Cantrell_960.jpg
  Copyright: Telescope Live, Heaven's Mirror Observatory

2025-01-02: Solar Analemma 2024
  URL: https://apod.nasa.gov/apod/image/2501/solaranalemma2024-4-5BetulT1024.jpeg
  Copyright: Betul Turksoy

2025-01-03: Eclipse Pair
  URL: https://apod.nasa.gov/apod/image/2501/APODEclipsePair1024.jpg
  Copyright: Josh Dury

Total images: 3
$ nasa-cli mars photos --rover curiosity --sol 1000 --camera FHAZ --limit 3
πŸ”΄ Mars Rover Photos
Rover: Curiosity β€’ Sol: 1000 β€’ Camera: Front Hazard Avoidance Camera

Photo 1:
  ID: 102693
  Earth Date: 2015-05-30
  URL: http://mars.jpl.nasa.gov/msl-raw-images/proj/msl/redops/ods/surface/sol/01000/opgs/edr/fcam/FLB_486265257EDR_F0481570FHAZ00323M_.JPG

Photo 2:
  ID: 102694
  Earth Date: 2015-05-30
  URL: http://mars.jpl.nasa.gov/msl-raw-images/proj/msl/redops/ods/surface/sol/01000/opgs/edr/fcam/FRB_486265257EDR_F0481570FHAZ00323M_.JPG

Photo 3:
  ID: 102850
  Earth Date: 2015-05-30
  URL: http://mars.jpl.nasa.gov/msl-raw-images/proj/msl/redops/ods/surface/sol/01000/opgs/edr/fcam/FLB_486265206EDR_F0481570FHAZ00206M_.JPG

Total photos found: 856
$ nasa-cli mars batch curiosity --sol-start 3000 --sol-end 3001 --limit 5
πŸ”΄ Mars Rover Batch Photos

Sol Range: 3000-3001
Retrieved 5 photos from 2 sols

Sol 3000:
  β€’ FHAZ: 2 photos
  β€’ RHAZ: 2 photos
  β€’ MAST: 1 photo

Sol 3001:
  β€’ NAVCAM: 8 photos
  β€’ CHEMCAM: 4 photos

Total photos: 5 (limited from 17 available)
$ nasa-cli asteroids feed --start-date 2024-01-15 --end-date 2024-01-16
β˜„οΈ  Near Earth Objects Feed

2024-01-15:

1. (2021 BL3)
   Diameter: 92.0 - 206.0 meters
   Velocity: 47,023 km/h
   Miss Distance: 0.0321 AU (4,801,829 km)
   ⚠️  Potentially Hazardous

2. (2019 AE9)
   Diameter: 13.1 - 29.3 meters
   Velocity: 28,944 km/h
   Miss Distance: 0.1842 AU (27,554,311 km)

3. (2024 AB)
   Diameter: 46.2 - 103.3 meters
   Velocity: 35,284 km/h
   Miss Distance: 0.0912 AU (13,642,955 km)

Total NEOs for period: 8
Potentially hazardous: 2
$ nasa-cli asteroids weekly-summary
β˜„οΈ  Weekly Close Approach Summary

Week of 2025-07-07 to 2025-07-13

Total asteroids: 83
⚠️  Hazardous asteroids: 5

Closest Approach:
(2025 MC92)
  Distance: 0.0102 AU (1.52 million km)
  Date: 2025-07-09
  Velocity: 12.3 km/s

Size Distribution:
  β€’ Small (<100m): 64 objects
  β€’ Medium (100m-1km): 17 objects
  β€’ Large (>1km): 2 objects
$ nasa-cli exoplanets search --min-mass 0.5 --max-mass 2.0 --limit 5
πŸͺ Exoplanet Search Results

1. Kepler-452 b
   Discovery Year: 2015
   Mass: 1.63 Earth masses
   Orbital Period: 384.84 days
   Host Star: Kepler-452
   Distance: 1402 light-years
   🌍 In Habitable Zone

2. Proxima Cen b
   Discovery Year: 2016
   Mass: 1.27 Earth masses
   Orbital Period: 11.19 days
   Host Star: Proxima Centauri
   Distance: 4.24 light-years

3. TRAPPIST-1 e
   Discovery Year: 2017
   Mass: 0.62 Earth masses
   Orbital Period: 6.10 days
   Host Star: TRAPPIST-1
   Distance: 39.46 light-years
   🌍 In Habitable Zone

Total matching exoplanets: 127
$ nasa-cli epic images --date 2024-01-10 --type natural
🌍 EPIC Earth Images
Date: 2024-01-10

Image 1:
  Time: 00:31:36 UTC
  Identifier: 20240110003136
  Centroid: Lat: -23.4Β°, Lon: 157.8Β°
  Sun Position: x: -0.924, y: 0.001, z: -0.382
  URL: https://epic.gsfc.nasa.gov/archive/natural/2024/01/10/png/epic_1b_20240110003136.png

Image 2:
  Time: 03:19:48 UTC
  Identifier: 20240110031948
  Centroid: Lat: -23.4Β°, Lon: 115.5Β°
  URL: https://epic.gsfc.nasa.gov/archive/natural/2024/01/10/png/epic_1b_20240110031948.png

Total images for date: 13
$ nasa-cli epic bulk natural --start-date 2025-01-01 --end-date 2025-01-02 --limit 2
🌍 EPIC Bulk Image Retrieval

Date Range: 2025-01-01 to 2025-01-02
Type: Natural Color
Limit per day: 2 images

2025-01-01:
  β€’ 00:13:03 UTC - epic_1b_20250101001751
  β€’ 02:01:05 UTC - epic_1b_20250101020554

2025-01-02:
  β€’ 00:03:42 UTC - epic_1b_20250102000830
  β€’ 01:51:44 UTC - epic_1b_20250102015633

Total images retrieved: 4
βœ“ Bulk retrieval complete
$ nasa-cli donki solar-flares --start-date 2024-01-01 --end-date 2024-01-15
β˜€οΈ  Solar Flare Activity

2024-01-05 14:55:00 UTC
  Class: X1.2
  Source: Active Region 3536
  Peak Time: 15:12:00 UTC
  End Time: 15:28:00 UTC
  Location: N23E45

2024-01-09 02:32:00 UTC
  Class: M5.8
  Source: Active Region 3538
  Peak Time: 02:47:00 UTC
  End Time: 03:15:00 UTC
  Location: S15W23

2024-01-14 09:18:00 UTC
  Class: M3.2
  Source: Active Region 3541
  Peak Time: 09:32:00 UTC
  End Time: 09:48:00 UTC

Total solar flares: 8
X-class: 1, M-class: 4, C-class: 3
$ nasa-cli earth imagery --lat 37.7749 --lon -122.4194 --date 2023-07-01 --dim 0.5
🌎 Earth Imagery

Location: San Francisco, CA
Coordinates: 37.7749Β°N, 122.4194Β°W
Date: 2023-07-01
Dimension: 0.5Β° Γ— 0.5Β°

Image Details:
Acquisition Date: 2023-06-28 (closest available)
Cloud Score: 0.02 (2% cloud cover)
Satellite: Landsat 8
Processing Level: L1T

URL: https://earthengine.googleapis.com/v1alpha/projects/earthengine-legacy/thumbnails/5e4c7e8f9b5c3d1a8e9f2a3b

βœ“ Image retrieved successfully
$ nasa-cli tech search "carbon capture" --limit 3
πŸ”¬ NASA Technology Transfer
Search: "carbon capture"

1. Advanced Carbon Dioxide Removal System
   Patent #: US9,878,276
   Center: Ames Research Center
   Category: Environment
   Description: A regenerative system for removing CO2 from spacecraft
   cabin air that can be adapted for terrestrial carbon capture applications.
   TRL: 6

2. Solid Oxide Electrolysis Cell for CO2 Reduction
   Patent #: US10,301,729
   Center: Glenn Research Center
   Category: Energy
   Description: High-temperature electrolysis technology for converting
   carbon dioxide into oxygen and carbon monoxide.
   TRL: 4

3. Bio-inspired Carbon Sequestration Material
   Software ID: ARC-18429-1
   Center: Langley Research Center
   Category: Materials
   Description: Novel material inspired by marine organisms for
   efficient atmospheric CO2 absorption and mineralization.
   TRL: 3

Total matching technologies: 12
$ nasa-cli media search "james webb" --media-type image --limit 3
πŸ“Έ NASA Media Library
Search: "james webb"

1. Webb's First Deep Field
   NASA ID: PIA25453
   Date: 2022-07-11
   Keywords: JWST, Galaxy Cluster, SMACS 0723, Deep Field
   Description: The deepest and sharpest infrared image of the
   distant universe to date, showing galaxy cluster SMACS 0723.
   URL: https://images-assets.nasa.gov/image/PIA25453/PIA25453~orig.jpg

2. Cosmic Cliffs in Carina Nebula
   NASA ID: PIA25454
   Date: 2022-07-12
   Keywords: JWST, Carina Nebula, Star Formation, NGC 3324
   Description: "Cosmic Cliffs" in the Carina Nebula showcase
   Webb's ability to peer through cosmic dust.
   URL: https://images-assets.nasa.gov/image/PIA25454/PIA25454~orig.jpg

3. Webb Telescope Mirror Seen in Full Bloom
   NASA ID: NHQ202203160007
   Date: 2022-03-16
   Keywords: JWST, Mirror, Alignment, Engineering
   Description: The 18 primary mirror segments working together
   as a single, precise optical surface.
   URL: https://images-assets.nasa.gov/image/NHQ202203160007/NHQ202203160007~orig.jpg

Total results: 847
$ nasa-cli media collection apollo11 --all-pages --limit 100
πŸ“Έ Media Collection Search

Query: "apollo11"
Retrieving all pages...

Collection Summary:
  β€’ Total items: 100
  β€’ Media types: Image (87), Video (11), Audio (2)
  β€’ Date range: 1969-2019
  
Popular Items:
1. Apollo 11 Launch - 1969-07-16
2. First Moon Landing - 1969-07-20
3. Neil Armstrong Portrait - 1969-07-01
4. Lunar Module on Moon - 1969-07-20
5. Mission Control Celebration - 1969-07-24

βœ“ Collection retrieved successfully
Pages processed: 5
$ nasa-cli ssd close-approaches --date-min 2024-01-15 --date-max 2024-01-20 --dist-max 0.05
🌌 Close Approach Data
Period: 2024-01-15 to 2024-01-20
Max Distance: 0.05 AU

2024-01-16 08:32 Β±00:01
  Object: (2021 BL3)
  Distance: 0.0321 AU (4.80 million km)
  Velocity: 13.06 km/s
  Diameter: ~149 m
  H magnitude: 22.1

2024-01-18 14:27 Β±00:01
  Object: (2024 AB)
  Distance: 0.0486 AU (7.27 million km)
  Velocity: 9.80 km/s
  Diameter: ~75 m
  H magnitude: 23.8

2024-01-19 22:15 Β±00:02
  Object: (2019 YK)
  Distance: 0.0413 AU (6.18 million km)
  Velocity: 15.23 km/s
  Diameter: ~210 m
  H magnitude: 21.5

Total close approaches: 3
⚠️  1 potentially hazardous object
$ nasa-cli interactive
πŸš€ NASA CLI Interactive Mode

Welcome to the NASA CLI interactive interface!
Use arrow keys to navigate, Enter to select, and 'q' to quit.

Main Menu:
β–Ά Astronomy Picture of the Day (APOD)
  Mars Rover Photos
  Near Earth Objects
  Exoplanet Archive
  EPIC Earth Images
  Space Weather (DONKI)
  Earth Imagery
  Technology Transfer
  Media Library
  Solar System Dynamics
  Configuration
  Help

Select an option to continue...
$ nasa-cli mars photos --rover perseverance --sol 500 -o json | jq '.photos[0]'
{
  "id": 1045892,
  "sol": 500,
  "camera": {
    "id": 245,
    "name": "NAVCAM_LEFT",
    "rover_id": 8,
    "full_name": "Navigation Camera - Left"
  },
  "img_src": "https://mars.nasa.gov/mars2020-raw-images/pub/ods/surface/sol/00500/ids/edr/browse/ncam/NLG_0500_0710891234_234ECM_N0260000NCAM00512_00_2I4J01_1200.jpg",
  "earth_date": "2023-07-11",
  "rover": {
    "id": 8,
    "name": "Perseverance",
    "landing_date": "2021-02-18",
    "launch_date": "2020-07-30",
    "status": "active",
    "max_sol": 1035,
    "max_date": "2024-01-15",
    "total_photos": 187439
  }
}

Ready to explore the cosmos?

Get started with nasa-rs today and unlock access to NASA's vast collection of space data.