Reference implementation for integrating Appboxo Web SDK into a web application to host miniapps.
This sample demonstrates how to integrate @appboxo/web-sdk into a React web application to host miniapps in an iframe.
npm install
npm startApp runs on http://localhost:3000 and expects miniapp on http://localhost:3000 (or configure your miniapp URL).
npm install @appboxo/web-sdkimport { AppboxoWebSDK } from "@appboxo/web-sdk";
const appboxoWebSDK = new AppboxoWebSDK({
clientId: "your-client-id-here", // Replace with actual clientId from Appboxo dashboard
appId: "your-app-id-here", // Replace with actual appId from Appboxo dashboard
debug: true,
});// Get auth_code from your backend
const authCode = await getAuthCodeFromBackend();
appboxoWebSDK.setAuthCode(authCode);const iframe = document.getElementById("miniapp-iframe");
appboxoWebSDK.setIframe(iframe);
appboxoWebSDK.initialize();Update these values in src/App.tsx:
clientId: Your client identifier from Appboxo dashboardappId: Miniapp identifier from Appboxo dashboardauth_code: Authentication code from your backend (use sample values for testing)iframe.src: Your miniapp URL
src/
├── App.tsx # Main app component with SDK integration
├── App.css # Styles
└── index.tsx # Entry point
For production, replace sample credentials with real backend integration:
// Get from backend and set
const authCode = await fetch('/api/auth-code').then(r => r.json());
appboxoWebSDK.setAuthCode(authCode);# Install dependencies
npm install
# Start dev server
npm start
# Build for production
npm run build- This is a sample implementation demonstrating SDK integration
- Production implementation should connect to your backend for authentication
- Auth code should be generated by your backend based on user session