Astrophotography tool · open source · MIT

Celestial Vision

Celestial Vision tells astrophotographers what is in their night-sky photos: it asks public astronomy databases which stars, galaxies, comets, asteroids and satellites were in that patch of sky at that moment, then has Gemini write the report from their answers.

Plate solvingAstrometry.net
Comets and asteroidsCOBS, JPL Horizons, NASA NeoWs
SatellitesCelesTrak, IAU SatChecker, Project Pluto
Writinggemini-3-flash-preview
03 · Processing viewLog: comet survey
Celestial Vision processing view: the uploaded galaxy image on the left with an Analyzing label, and the live reasoning log on the right listing comets from COBS Planner and positions from JPL Horizons
The processing view during a local run with no Gemini or Astrometry.net key. COBS Planner has listed the comets visible on the observation date, and JPL Horizons is returning each comet's position. Test image: Hubble view of M51 from the NASA Image and Video Library.
Requests · vite.config.ts

Most database calls leave the browser through forwarders on the Vite dev server

Most astronomy services send no CORS headers, so vite.config.ts registers a forwarder for each one under /proxy/ on 127.0.0.1:4200. The browser calls Gemini, NASA NeoWs and Nominatim directly. When a forwarder request fails, satellites.ts and pluto.ts retry through the public corsproxy.io relay.

BROWSER · SERVICES/*.TS AND APP.TSX EXTERNAL SERVICE SERVICES/GEMINI.TSGemini callsthe six model requests GOOGLE · @GOOGLE/GENAIGemini APIgemini-3-flash-preview generateContent: images, FactSheet text, chat turns SERVICES/NASA.TSNear-Earth objectsfeed for the date + 2 days API.NASA.GOVNASA NeoWsyour key, or DEMO_KEY GET /neo/rest/v1/feed with api_key APP.TSXSite geocoderwatermark location text NOMINATIM.OPENSTREETMAP.ORGNominatimno key needed GET /search?q=location VITE DEV SERVER 127.0.0.1:4200 SERVICES/ASTROMETRY.TSPlate solvelog in, upload, poll the job /proxy/astrometry NOVA.ASTROMETRY.NETAstrometry.netfield center, scale, objects image, downscaledto 1800 px /api/login, /api/upload,/api/jobs/{id}/... SERVICES/COBS.TSComet listsplanner, orbits, observations /proxy/cobs COBS.SICOBSvisible comets, magnitudes date, latitude,longitude /api/planner.api,comet.api, obs_list.api HORIZONS.TS · NASA.TSEphemeridescomets, asteroids, planets /proxy/horizons SSD.JPL.NASA.GOVJPL HorizonsRA, Dec, distance, magnitude designation,date, site /api/horizons.api SERVICES/APPLAUSE.TSHistorical platesplate search, previews /api/applause/* PLATE-ARCHIVE.ORGAPPLAUSE DR4digitized glass plates field RA, Dec,search radius TAP sync query withAuthorization token SERVICES/SATCHECKER.TSSatellite checkin the field at that time? /proxy/satchecker SATCHECKER.CPS.IAU.ORGIAU SatCheckerpositions per NORAD number NORAD number, site,10-second steps /ephemeris/catalog-number-jdstep/ SERVICES/SATELLITES.TSTLE downloadcached two hours, then SGP4 /proxy/celestrak CELESTRAK.ORGCelesTrakcurrent orbital elements active, DEB, R/Belement sets /NORAD/elements/gp.php SERVICES/PLUTO.TSArchived TLE checkobjects within 5° of center /proxy/pluto PROJECTPLUTO.COMProject PlutoTLEs near the photo date time, site,field center /cgi-bin/sat_id/sat_id3 retry when the forwarder request fails CORSPROXY.IOPublic CORS relay relays the same URL
The red outline marks the only model API. The dashed outline is the dev server: its forwarders work under npm run dev and npm run preview, and the APPLAUSE middleware (blue) runs only under npm run dev, where server/applauseApi.ts reads APPLAUSE_TOKEN and sends it as a header. A static copy of dist/ on a plain web host has neither.
Astrometry.net publishes your photo

astrometry.ts uploads the image with publicly_visible set to y, so every solved image appears on nova.astrometry.net. It downscales the file to 1,800 px on the long side first.

Three keys travel in the bundle

The define block in vite.config.ts writes the Gemini, Astrometry.net and NASA keys into the browser code. The README asks you to keep any build on your own machine for that reason.

CelesTrak is asked every two hours at most

satellites.ts keeps the combined TLE text in localStorage for two hours. A comment in the code notes that CelesTrak answers 403 to repeat requests inside that window.

Pipeline · processImage() in App.tsx

The plate solution decides which checks can run

processImage() runs the same order for every upload. Astrometry.net's plate solution feeds three later steps: the comet survey, the satellite check and the asteroid positions all test objects against the field center and radius it returns, and each step skips that test when the solve fails.

APP.TSX · EXTRACTEXIFEXIF readdate, GPS, camera; your date wins GEMINI.TS · PRESCANGIMAGEWatermark pre-scandate, site, target, exposure APP.TSX · NOMINATIMGeocode the siteonly when EXIF has no GPS then site name image, date, lat, lon, target PARALLEL STAGE · PROMISE.ALL SERVICES/ASTROMETRY.TSPlate solvecenter, radius, scale, rotation GEMINI.TS · DETECTSTREAKSStreak detectionstart and end pixel per trail SERVICES/NASA.TSNeoWs feedobjects within 0.1 AU COBS.TS · HORIZONS.TSNamed targetruns when a target name is known streaks kept: in frame, ≥ 30 px objects ≤ 0.1 AU target ephemeris THEN, IN ORDER APP.TSX · COBS + HORIZONSComet surveytests the eight brightest SATELLITES.TS · PLUTO.TSSatellite checkSGP4, SatChecker, Project Pluto NASA.TS · HORIZONSAsteroid positionsprojected onto the plate TYPES.TS · APP.TSXFactSheetmagnitude tagged with its source then then results plate solution center, radius, scale, rotation FactSheet text GEMINI.TSSummary callwrites from the FactSheet GEMINI.TS · APP.TSXOutput checkspositions, caps, added entries SERVICES/RESOLVER.TSSecond passunknowns and weak matches RESULTSDASHBOARD.TSXResults dashboardregistry, comparator, chat JSON entries result
Red outlines are Gemini calls and the blue line carries the plate solution; every other box is a database query or plain TypeScript. Without a plate solution, the three survey steps skip their in-field tests, and the summary call receives the photo along with the FactSheet.
Each magnitude names its source

App.tsx prefers a COBS observation, then a JPL prediction. When the COBS Planner and JPL values disagree by more than three magnitudes, it computes an estimate from the absolute magnitude and the Horizons distance and tags it as computed.

Stacked images change the satellite math

For a file such as Stacked_52_..._20.0s, the satellite check uses the sub-exposure length for crossing tests, because a trail can appear in one sub-frame only.

Old photos widen the satellite search

When the downloaded CelesTrak elements are more than seven days from the photo date, satellites.ts marks SGP4 unreliable and widens its scan, and the app falls back to SatChecker and Project Pluto.

Checks · services/gemini.ts and App.tsx

What Gemini receives and what the code changes in its reply

The summary call has the most room to invent things, so the code limits what goes in and rewrites what comes back. Its system prompt tells the model to summarize the identifications it is given, never to identify objects from the image, and to quote FactSheet numbers exactly or write "unknown".

1 · WHAT THE SUMMARY CALL SEES PROMPT BUILT IN GEMINI.TS FactSheet valuesquote them exactly or write unknown Detected streaksstart and end pixel for each trail Astrometry.net namesIF THE SOLVE WORKED catalog objects in the field SatellitesIF A STREAK WAS FOUND minus any SatChecker disproved The photo itselfIF THE SOLVE FAILED every confidence then capped at 0.6 system prompt and data GEMINI-3-FLASH-PREVIEW Summary call JSON schema and googleSearch; retried without search 2 · WHERE EACH OBJECT LANDS field center ξ, η projected from RA, Dec model's pixel guess overwritten RA, Dec → tangent plane (ξ, η) → ÷ pixel scale → rotate by orientation → shift to image center Each moved entry gets the evidence line "Position verified via WCS Projection", plus 0.1 confidence. 3 · CONFIDENCE SET OR CAPPED BY CODE 1.0 0.95Project Pluto match for a streak 0.90SatChecker match + streak geometrycomet placed in field by Horizons 0.80SatChecker places it in the field 0.60cap: plate solving failed 0.55SGP4 estimate + streak geometry 0.50cap: streak with no catalog match 0.35SGP4 estimate only 0.30streak with no satellite candidate below 0.6: resolver.ts re-checks it
Panel 1: the rows outlined in red enter the prompt only under the condition on their tag. Panel 2: for every entry with coordinates, gemini.ts drops the pixel position the model returned and computes one with a gnomonic projection of the entry's RA and Dec onto the plate solution. Panel 3: the confidence values the code assigns or caps; entries on the shaded part of the scale go to resolver.ts. gemini.ts also removes any reference image URL that does not answer a HEAD request with an image content type within three seconds.
Streaks and comets are written by code

App.tsx adds one entry per detected streak and pairs it with the best-ranked satellite: a Project Pluto match first, then a SatChecker match, then an SGP4 estimate. Comets that Horizons places inside the solved field are added the same way unless Gemini already listed them.

Weak entries get a second pass

resolver.ts tries a streak against its meteor shower table and the ISS before re-matching satellites at a wider tolerance. It then compares any entry that has coordinates with the planets, five bright asteroids and the three brightest comets of the date, and an entry that stays unmatched lists every database it tried.

The caption gets its own pass

generateInstagramCaption() finds AU distances and magnitudes in the caption and rewrites any that disagree with the FactSheet: a distance off by more than half and by more than 0.5 AU, or a magnitude off by more than two. It then trims the text to Instagram's 2,200-character limit.

Run it

Run it on your own machine with your own keys

You need Node.js 20 and npm. The dev server binds to 127.0.0.1 on port 4200 with strictPort, so it exits when another process holds that port. Without keys, the upload screen and the review step work and the comet survey runs; the run then stops at the Gemini summary step with "Analysis engine failed."

git clone https://github.com/NXTLupo/Celestial-Vision.git
cd Celestial-Vision
npm install
cp .env.example .env.local   # add the keys you have
npm run dev                  # http://127.0.0.1:4200
VariableWhat it unlocks
GEMINI_API_KEYEvery Gemini call. A finished report needs it.
ASTROMETRY_API_KEYPlate solving. Without it the app skips the satellite check, the in-field comet and asteroid tests, and the APPLAUSE plates.
APPLAUSE_TOKENOptional. The dev-server middleware sends it with plate searches.
NASA_API_KEYOptional. NeoWs falls back to NASA's DEMO_KEY, which has lower rate limits.
The review step: a thumbnail of the staged galaxy image, an observation date field marked as taken from the file date, an optional target object field, and Cancel and Initiate Analysis buttons
The review step after a drop. The date came from the file's modified date, so the form asks you to check it; the target field is optional and suggests comet names from COBS for that date.