FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
mattspieg
mattspiegsg-luma-events
Public
Like
sg-luma-events
Home
Code
10
RAILWAY_MIGRATION.md
README.md
deno-server.ts
deploy-to-railway.md
H
luma-proxy.ts
main.tsx
node-server.js
package.json
railway.toml
test-local.sh
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 miliseconds.
Sign up now
Code
/
Code
/
Search
luma-proxy.ts
https://mattspieg--7bd2e46c406f11f083ce76b3cceeab13.web.val.run
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.

๐Ÿš‚ MIGRATED TO RAILWAY

This project has been migrated from Val Town to Railway for better deployment options. See the migration files:

  • Deno Version: deno-server.ts + railway.toml (recommended)
  • Node.js Version: node-server.js + package.json
  • Migration Guide: RAILWAY_MIGRATION.md
  • Deployment Steps: deploy-to-railway.md

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

After Railway deployment, your proxy will be available at:

https://[your-app-name].up.railway.app

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-app-name].up.railway.app') .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-app-name].up.railway.app?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-app-name].up.railway.app?next3=true') .then(response => response.json()) .then(data => { console.log('Next 3 events:', data.entries); // Check if we're showing past events as fallback if (data._fallback === 'recent_past_events') { console.log('No upcoming events found, showing most recent past events'); } // data.entries will contain max 3 events, sorted by date // If upcoming events exist: sorted earliest first // If no upcoming events: shows 3 most recent past events });

Smart Fallback: If no upcoming events are found, the proxy automatically returns the 3 most recent past events and adds a _fallback: "recent_past_events" field to let you know.

Optimized API Calls: When using next3=true, the proxy requests up to 100 events from Luma (instead of the default ~50) to ensure it finds upcoming events if they exist.

You can combine this with other parameters:

// Get next 3 events for a specific calendar fetch('https://[your-app-name].up.railway.app?calendar_id=your-calendar-id&next3=true') .then(response => response.json()) .then(data => console.log(data));

Security Notes

  • The API key is read-only and low-risk (only accesses public event data)
  • Can be hardcoded safely or use environment variables for best practice
  • The proxy allows requests from any origin (*) - this is intentional for maximum compatibility

API Key Setup

For Railway deployment, you can set environment variables:

  1. Go to your Railway project dashboard
  2. Click "Variables" tab
  3. Add: LUMA_API_KEY = secret-FMPoZlwNgVJ0qkCSn2EIHpTUA
  4. 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

Migration Benefits

โœ… Railway advantages over Val Town:

  • Custom domains
  • Better scaling
  • Your client already uses Railway
  • Git-based deployments
  • Built-in monitoring
  • Free tier available

Testing

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

HTTP
  • luma-proxy.ts
    mattspieg--7bโ€ฆ13.web.val.run
Code
RAILWAY_MIGRATION.mdREADME.mddeno-server.tsdeploy-to-railway.md
H
luma-proxy.ts
main.tsxnode-server.jspackage.jsonrailway.tomltest-local.sh
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
ยฉ 2025 Val Town, Inc.