• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
mattspieg

mattspieg

sg-luma-events

Public
Like
sg-luma-events
Home
Code
3
README.md
H
luma-proxy.ts
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
6/3/2025
Viewing readonly version of main branch: v12
View latest version
README.md

Luma API CORS Proxy

This is a serverless CORS proxy for the Luma API that allows frontend applications to fetch event data without running into CORS issues.

How it works

The proxy:

  1. Accepts GET requests from any origin
  2. Forwards the request to the Luma API with your API key
  3. Returns the response with proper CORS headers (Access-Control-Allow-Origin: *)
  4. Handles preflight OPTIONS requests for CORS compliance

Usage

Your Proxy URL

Once deployed, your proxy will be available at:

https://[your-username]--[hash].web.val.run

Using in Webflow (or any frontend)

Replace your direct Luma API calls with calls to your proxy:

// Instead of this (which gets blocked by CORS): // fetch('https://api.lu.ma/public/v1/calendar/list-events') // Use this: fetch('https://[your-username]--[hash].web.val.run') .then(response => response.json()) .then(data => { console.log('Luma events:', data); // Use your event data here }) .catch(error => { console.error('Error fetching events:', error); });

Query Parameters

You can pass any query parameters that the Luma API supports:

// Example with query parameters fetch('https://[your-username]--[hash].web.val.run?calendar_id=your-calendar-id&after=2024-01-01') .then(response => response.json()) .then(data => console.log(data));

Filter to Next 3 Upcoming Events

To get only the next 3 upcoming events, add next3=true to your query:

// Get only the next 3 upcoming events fetch('https://[your-username]--[hash].web.val.run?next3=true') .then(response => response.json()) .then(data => { console.log('Next 3 events:', data.entries); // data.entries will contain max 3 events, sorted by date (earliest first) // Only includes events with start_at > current time });

You can combine this with other parameters:

// Get next 3 events for a specific calendar fetch('https://[your-username]--[hash].web.val.run?calendar_id=your-calendar-id&next3=true') .then(response => response.json()) .then(data => console.log(data));

Security Notes

  • The API key is currently hardcoded in the proxy for simplicity
  • For better security, you can set a LUMA_API_KEY environment variable in Val Town
  • The proxy allows requests from any origin (*) - this is intentional for maximum compatibility

API Key Setup

If you want to use environment variables instead of hardcoding:

  1. Go to your Val Town settings
  2. Add an environment variable: LUMA_API_KEY = secret-FMPoZlwNgVJ0qkCSn2EIHpTUA
  3. The proxy will automatically use the environment variable if available

Error Handling

The proxy includes error handling and will return appropriate HTTP status codes:

  • 405 for non-GET requests
  • 500 for API errors
  • Forwards the actual Luma API status code for API responses

Testing

You can test the proxy directly in your browser by visiting the proxy URL. It should return JSON data from the Luma API.

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.