better-wall
v0.1.2
Published
BetterWall SDK - A modern Superwall alternative with web-based paywalls
Maintainers
Readme
BetterWall SDK
A modern Superwall alternative with web-based paywalls. One package for all platforms.
Installation
bun add better-wall
# React Native also needs:
bun add react-native-webviewUsage
Backend / API Client
import { BetterWallClient } from 'better-wall';
const client = new BetterWallClient({
apiKey: 'your-api-key',
});
// Fetch wall configuration
const wall = await client.getWall('wall-id');
// Create new wall
const newWall = await client.createWall({
name: 'Premium Paywall',
config: { /* ... */ },
});
// Track events
await client.trackEvent('wall-id', 'view', { userId: '123' });React Native / Expo
import { BetterWall, useBetterWall } from 'better-wall/react-native';
function App() {
const betterWall = useBetterWall();
return (
<>
<Button title="Show Paywall" onPress={betterWall.show} />
<BetterWall
ref={betterWall.ref}
visible={betterWall.visible}
wallId="your-wall-id"
onClose={betterWall.hide}
eventHandlers={{
purchase_completed: (args) => {
console.log('Purchased:', args);
},
}}
/>
</>
);
}React Web
import { BetterWall, useBetterWall } from 'better-wall/react';
function App() {
const betterWall = useBetterWall();
return (
<>
<button onClick={betterWall.show}>Show Paywall</button>
<BetterWall
visible={betterWall.visible}
wallId="your-wall-id"
onClose={betterWall.hide}
eventHandlers={{
purchase_completed: (args) => {
console.log('Purchased:', args);
},
}}
/>
</>
);
}Features
- ✅ One Package - Single install for all platforms
- ✅ TypeScript - Fully typed API
- ✅ Backend SDK - API client for Node.js/Deno/Bun
- ✅ React Native - Expo Go compatible, no custom dev client
- ✅ React Web - iframe-based paywalls for web apps
- ✅ Bidirectional Communication - Events between native and web
- ✅ Update Without Releases - Change paywalls instantly
Package Exports
// Core/Backend SDK
import { BetterWallClient } from 'better-wall';
// React Native
import { BetterWall, useBetterWall } from 'better-wall/react-native';
// React Web
import { BetterWall, useBetterWall } from 'better-wall/react';Documentation
Full documentation at betterwall.dev/docs
Comparison to Superwall
| Feature | Superwall | BetterWall | |---------|-----------|------------| | Expo Go Support | ❌ No | ✅ Yes | | Native Payments | ✅ Yes | Web-based | | Update Without Release | ❌ No | ✅ Yes | | Custom Events | ✅ Yes | ✅ Yes | | Platform | iOS/Android native | Cross-platform | | Package | Multiple packages | One package |
License
MIT
