Guides
Plan-enterprise-icon
Expo Application Services
API Reference

Get started

There are two ways to get started with the Expo Module API: you can either initialize a new module from scratch or add the Expo Module API to an existing module. This guide will walk you through creating a new module from scratch, and the "Integrating in an existing library" guide covers the latter case.

1. Creating a new module

To create a new Expo module from scratch, run the create-expo-module script as shown below. The script will ask you a few questions and then generate the native Expo module along with the example app for Android and iOS that uses your new module.
Terminal
→ npx create-expo-module my-module

2. Running the example project

Navigate to the module directory and then open the Android and/or iOS example project by running the following commands:
Terminal
→ cd my-module
→ npm run open:android
→ npm run open:ios
Now, you can run the example project on your device or simulator/emulator. When the project compiles and runs, you will see "Hello world! 👋" on the screen.
Info-icon
Note: If you're using Windows, you can open the example project by opening the android directory in Android Studio, but you cannot open the iOS project files.

3. Making a change

Android

Open up MyModuleModule.kt in Android Studio (⌘ Cmd + O or Ctrl + O and search for MyModuleModule.kt). Change the hello method to return a different string. For example, you can change it to return "Hello world! 🌎🤖". Rebuild the app and you should see your change.

iOS

Open up MyModuleModule.swift in Xcode (⌘ Cmd + O or Ctrl + O and search for MyModuleModule.swift). Change the hello method to return a different string. For example, you can change it to return "Hello world! 🌎🍎". Rebuild the app and you should see your change.

Next steps

Now that you've learned how to initialize a module and make simple changes to it, you can continue to a tutorial or dive right into the API reference.
Creating your first native module

Create a simple, but complete, native module to interact with Android and iOS preferences APIs.

Arrow-right-icon
Module API Reference

Outline for the Expo Module API and common patterns like sending events from native code to JavaScript.

Arrow-right-icon
  • Message-iconAsk a question on the forums
  • Edit-iconEdit this page

Was this doc helpful?