Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jacobsamo/buzztrip/llms.txt

Use this file to discover all available pages before exploring further.

Markers are the primary way users annotate locations on a BuzzTrip map. Every marker is linked to a places record — a de-duplicated store of geographic point-of-interest data. When a marker is created, the backend checks whether a place already exists at the given coordinates before inserting a new one. Markers can also be assigned to one or more collections, which are managed via collection_links join records. This makes it easy to group related pins (e.g. “Restaurants”, “Hotels”) without duplicating the marker itself. All operations require authentication via the authedQuery / authedMutation wrappers.

getMarkersView

Retrieves all markers on a map enriched with their associated place data, forming a CombinedMarker array. An optional markerId filter returns only that single marker. Position (lat / lng) on the returned object is sourced from the linked place record when available, falling back to the value stored directly on the marker. API path: api.maps.markers.getMarkersView
Type: authedQuery — authentication required
mapId
Id<'maps'>
required
The map whose markers should be fetched.
markerId
Id<'markers'>
Optional. When provided, only the matching marker is returned.
Returns: CombinedMarker[] | null
import { useQuery } from "convex/react";
import { api } from "@/convex/_generated/api";
import { Id } from "@/convex/_generated/dataModel";

const mapId = "abc123" as Id<"maps">;

// All markers on the map
const markers = useQuery(api.maps.markers.getMarkersView, { mapId });

// Single marker
const single = useQuery(api.maps.markers.getMarkersView, {
  mapId,
  markerId: "marker_xyz" as Id<"markers">,
});

markers?.forEach((m) => {
  console.log(m.title, m.lat, m.lng, m.place.address);
});

createMarker

Inserts a new marker onto a map. Before inserting, the backend checks whether a places record already exists at the provided lat/lng coordinates using the by_place_lat_lng index. If no existing place is found, a new one is created via createPlace. This de-duplicates geographic POI data across all maps. After the marker is inserted, collection_links join records are created for each ID in collectionIds. API path: api.maps.markers.createMarker
Type: authedMutation — authentication required
mapId
Id<'maps'>
required
The map to add the marker to.
marker
CombinedMarker
required
The marker data, including embedded place information.
collectionIds
string[]
Optional list of collection IDs to link the new marker to. A collection_links record is inserted for each entry.
Returns: Id<'markers'> — the document ID of the newly created marker.
import { useMutation } from "convex/react";
import { api } from "@/convex/_generated/api";
import { Id } from "@/convex/_generated/dataModel";

const createMarker = useMutation(api.maps.markers.createMarker);

const markerId = await createMarker({
  mapId: "abc123" as Id<"maps">,
  marker: {
    title: "Senso-ji Temple",
    note: "Amazing at sunrise, very crowded by 9am",
    lat: 35.7148,
    lng: 139.7967,
    icon: "Landmark",
    color: "#e85d04",
    place: {
      title: "Senso-ji Temple",
      lat: 35.7148,
      lng: 139.7967,
      address: "2-3-1 Asakusa, Taito City, Tokyo",
      icon: "Landmark",
      rating: 4.7,
      gm_place_id: "ChIJ8T1GpMGOGGARDYGSgpooDWw",
      types: ["place_of_worship", "tourist_attraction"],
      bounds: null,
    },
  },
  collectionIds: ["collection_temples" as Id<"collections">],
});

console.log("Created marker:", markerId);

editMarker

Updates an existing marker’s fields and/or adjusts its collection assignments. Collection links can be added and removed in the same call. API path: api.maps.markers.editMarker
Type: authedMutation — authentication required
marker_id
Id<'markers'>
required
The marker to update.
mapId
Id<'maps'>
required
The map the marker belongs to. Required when creating new collection_links.
marker
Partial<markersEditSchema>
required
Any subset of marker fields to update. All fields are optional.
collectionIds_to_add
Id<'collections'>[]
Optional list of collection IDs to link to this marker. A new collection_links record is inserted for each.
collectionIds_to_remove
Id<'collections'>[]
Optional list of collection IDs to unlink from this marker. The corresponding collection_links record is deleted.
Returns: { collectionLinksDeleted: string[]; collectionLinksCreated: string[] | null }
import { useMutation } from "convex/react";
import { api } from "@/convex/_generated/api";
import { Id } from "@/convex/_generated/dataModel";

const editMarker = useMutation(api.maps.markers.editMarker);

const result = await editMarker({
  marker_id: "marker_xyz" as Id<"markers">,
  mapId: "abc123" as Id<"maps">,
  marker: {
    note: "Best visited on weekday mornings to avoid crowds",
    color: "#3a86ff",
  },
  collectionIds_to_add: ["collection_must_see" as Id<"collections">],
  collectionIds_to_remove: ["collection_maybe" as Id<"collections">],
});

console.log("Removed links:", result.collectionLinksDeleted);
console.log("Added links:", result.collectionLinksCreated);

deleteMarker

Permanently deletes a marker document. Collection links referencing this marker are not automatically removed — handle that separately if required. API path: api.maps.markers.deleteMarker
Type: authedMutation — authentication required
markerId
Id<'markers'>
required
The document ID of the marker to delete.
Returns: void
import { useMutation } from "convex/react";
import { api } from "@/convex/_generated/api";
import { Id } from "@/convex/_generated/dataModel";

const deleteMarker = useMutation(api.maps.markers.deleteMarker);

await deleteMarker({ markerId: "marker_xyz" as Id<"markers"> });

Build docs developers (and LLMs) love