vkma.devRU

How to build a VK Mini App with React and Vite

On this page

Create a React and Vite project, register it in the VK developer dashboard, and open your local build inside VK. You can test it before deploying by exposing the local server through an HTTPS tunnel.

1. Create the project

Install Node.js 22.18 or later. Run:

npm create @vkma.dev/app my-app -- --preset base
cd my-app
npm run dev

Confirm dependency installation if prompted. The base preset already connects VK Bridge and sends VKWebAppInit from src/main.tsx. Use the localhost address from the terminal to work on the UI. Check the host response after opening the mini app inside VK.

2. Get the mini app ID

In the VK developer dashboard, choose Create app → Mini app. Enter a name, choose a category, and confirm. Copy the ID from the app dashboard for deployment. See the official VK guide for details and screenshots.

3. Open the local build inside VK

In vite.config.ts, change enabled: false to enabled: true on vkmaTunnel() and restart npm run dev. Wait for the HTTPS address in the terminal. The first run may take a few minutes to issue a certificate.

  1. In the dashboard, open Settings → Placement. Enable development mode for the platform you want to test and set the tunnel address as the development URL. To test on a phone, configure the mobile app platform.
  2. Open the mini app link from the dashboard as an administrator. On a phone, open it from Favorites in the VK mobile client.
  3. Open /__vkma/ on the same dev server. Find VKWebAppInit and the host response in the devtools timeline. If there is a request but no response, check that you opened the mini app link inside VK rather than visiting the tunnel URL directly.

If you cannot reach the tunnel, see HTTPS tunnel troubleshooting.

4. Deploy the build

Set your app ID in vkma-deploy.config.ts, sign in, and build the project:

npx vkma-deploy login
npm run build
npm run deploy

Select which URLs to update, then verify them under Placement. If the development URL still points to your tunnel, change it or turn off development mode to test the hosted build. See deploying to VK static hosting.

If you are building a game, see testing and publishing an HTML5 game on VK.

vkma.dev
RU
Esc