Integrating the SDK into an Existing Web Project
You can directly install the SDK in an existing web project and convert it into a mini app.
1. Install and initialize the SDK
After installing the SDK, initialize the environment.
npm install @apps-in-toss/web-framework
npx ait initpnpm add @apps-in-toss/web-framework
pnpm ait inityarn add @apps-in-toss/web-framework
yarn ait init2. Edit the configuration file
When you create the project granite.config.ts is created automatically. appName, displayName, iconPlease change them to match the app information registered in the Apps in Toss console.
import { defineConfig } from '@apps-in-toss/web-framework/config';
export default defineConfig({
appName: 'my-mini-app', // Enter the appName you entered in the console.
brand: {
displayName: 'App Name', // Enter the app name you entered in the console.
primaryColor: '#FF91D5', // Change this to the app's main color that will be displayed on the screen.
icon: '', // Enter the URL of the image uploaded in the console. (Right-click the uploaded image in the console's app info and copy the link, then paste it here)
},
web: {
host: 'localhost',
port: 5173,
commands: {
dev: 'vite dev',
build: 'vite build',
},
},
permissions: [],
outdir: 'dist',
});3. Install TDS
TDS (Toss Design System) WebView With this package, you can easily apply components based on the Toss Design System.
For how to use TDS components and guides, TDS WebView documentationplease check it.
4. Run the project
5. Run the mini app
Once the development server is running, you can view the mini app in the sandbox app. For detailed instructions on testing in the local sandbox app, sandbox app please check the documentation.
Accessing the development server on a physical device
To test on a physical device, when running the bundler --host option, and web.hostmust be set to a network address that can be accessed from the physical device.
Once the settings are complete, proceed on the physical device in the following order.
Refer to Install the sandbox app and install the sandbox app that matches your device.
Change the Metro server address in the sandbox app
web.hostto the IP address set inintoss://{appName}Access the mini app via deep link.
6. Debugging
Android — Chrome DevTools
Run the mini app on an Android emulator or physical device.
In the Chrome browser,
chrome://inspect/#devicesopen the page.Under the WebView content to debug in Remote Target inspect select the button.
You can debug WebView content just like debugging a normal web page.
iOS — Safari Developer Tools
Run the mini app on the iOS simulator or physical device.
Safari top menu
Developer → [Device Name] → [App Name] → [URL - Title]select it.You can debug WebView content just like debugging on the web.
7. Build and perform final testing in the Toss app
After development and basic verification in the sandbox app are complete, npm run buildgenerate the app bundle, upload it to the console, and then perform final testing. You must complete testing in the Toss app before you can submit a release request. For details, please refer to Testing in the Toss app documentation.
8. Release
For how to release, Mini app release documentation.