Installation
Setup
Create Polar utility
Create a server-side utility for the Polar client:
app/lib/polar.server.ts
The
.server.ts suffix ensures this module is only bundled for the server.Route Actions
Handle form submissions and mutations with actions:app/routes/checkout.tsx
Dynamic Routes
Load individual products with dynamic segments:app/routes/products.$id.tsx
Resource Routes
Create API endpoints with resource routes:app/routes/api.webhooks.polar.tsx
Error Handling
Use error boundaries for robust error handling:app/routes/products.$id.tsx
Session Management
Integrate Polar with Remix sessions:app/lib/session.server.ts
app/routes/_index.tsx
Meta Function
Generate SEO metadata from Polar data:app/routes/products.$id.tsx
Best Practices
Server-side only
Use
.server.ts suffix for files with sensitive operations.Error boundaries
Implement error boundaries for graceful error handling.
Progressive enhancement
Use Remix Forms for JavaScript-free functionality.
Type safety
Leverage TypeScript for better developer experience.
Next Steps
Checkout
Implement Polar Checkout in your Remix app.
Webhooks
Set up webhook handlers for real-time events.
TypeScript SDK
Explore the full TypeScript SDK.
API Reference
Browse the complete API reference.