Quick Start

MiniKit-JS SDK

MiniKit-JS is our official SDK for creating mini apps that work with World App. It provides handy functions and types to make development a breeze.

Template Repository

If you want to create a brand new mini app, you can use our template repositories:

Otherwise, continue below with the installation instructions.

Installing MiniKit

minikit-js is the core lib, framework agnostic,

minikit-react provides hooks that make it easy to interact with the MiniKit SDK.

npm install @worldcoin/minikit-js

or use a CDN like (jsdelivr)[https://www.jsdelivr.com/package/npm/@worldcoin/minikit-js], then you can inline it in html:

<script>
  import { MiniKit } from "https://cdn.jsdelivr.net/npm/@worldcoin/[email protected]/+esm"
</script>

make sure to use consistent versions when using the CDN.

Usage

  1. Create a MiniKit Provider component that installs the SDK and makes it easy to access MiniKit inside your app
// src/minikit-provider.tsx
'use client' // Required for Next.js

import { ReactNode, useEffect } from 'react'
import { MiniKit } from '@worldcoin/minikit-js'

export default function MiniKitProvider({ children }: { children: ReactNode }) {
	useEffect(() => {
		MiniKit.install()
	}, [])

	return <>{children}</>
}
  1. Wrap your root with the MiniKitProvider component.
// src/index.tsx

export default async function Root({
	children,
}: Readonly<{
	children: React.ReactNode
}>) {
	return (
		<html lang="en">
			<MiniKitProvider>
				<body className={inter.className}>{children}</body>
			</MiniKitProvider>
		</html>
	)
}
  1. Check if MiniKit is installed and ready to use

By default, MiniKit.isInstalled() will return false until the SDK is installed and it receives an init payload from World App. You can use this check to conditionally render components that rely on your app being loaded as a Mini App.

// ...
console.log(MiniKit.isInstalled())