Skip to main content

Quickstart

MentraOS is how you write powerful smart glasses apps. In this Quickstart, let's go from 0 to fully functioning app (that works on these smart glasses) in less than 15 minutes.

Prerequisites​

  • Node.js (v18 or later)
  • Bun
  • Basic TypeScript knowledge

Building Your First App​

The quickest way to get started is using our example app. This guide assumes you have a pair of compatible smart glasses connected to a phone running the MentraOS app.

Install MentraOS on your phone​

Download MentraOS from mentra.glass/os

Set up ngrok​

We are going to use ngrok to expose your local app to the internet. This is useful for development, but when you're ready to go live, you'll want to deploy to a cloud service like Railway or an Ubuntu server.

  1. Install ngrok
  2. Create an ngrok account
  3. Set up a static address/URL in the ngrok dashboard
  • Make sure you run the ngrok config add-authtoken <your_authtoken> line.
  • Make sure you select Static Domain, then generate a static domain.

Register your app with MentraOS​

MentraOS Console

  1. Navigate to console.mentra.glass
  2. Click "Sign In" and log in with the same account you're using for MentraOS
  3. Click "Create App"
  4. Set a unique package name like com.yourName.yourAppName
  5. For "Public URL", enter your ngrok static URL
  6. In the edit app screen, add the microphone permission. See the Permissions guide for details.

This automatically installs the app for your user. For other people to test the app (including others in your organization), they need to install the app. Get the app install link from the app edit page under the Share with Testers section.

Get your app running​

  1. Install bun

  2. Create a new repo from the template using the Use this template dropdown in the upper right of the example app repository or the following command:

    gh repo create --template Mentra-Community/MentraOS-Cloud-Example-App

    Create repo from template

    Note: If you want a more in-depth example (recommended for those who've already completed this quickstart), you can use the Extended Example which includes app settings support.

  3. Clone your new repo locally:

    git clone <your-repo-url>
  4. Navigate to your repo directory and install dependencies:

    cd <your-repo-name>
    bun install
  5. Set up your environment variables:

    • Create a .env file in the root directory by copying the example:
      cp .env.example .env
    • Edit the .env file with your app details:
      PORT=3000
      PACKAGE_NAME=com.yourName.yourAppName
      MENTRAOS_API_KEY=your_api_key_from_console
    • Make sure the PACKAGE_NAME matches what you registered in the MentraOS Console
    • Get your API_KEY from the MentraOS Developer Console
  6. Run your app:

    bun run dev
  7. Expose your app to the internet with ngrok:

    ngrok http --url=<YOUR_NGROK_URL_HERE> 3000

    Note: 3000 is the port. It must match what is in the app config. If you changed it to 8080, use 8080 for ngrok instead.

IMPORTANT: After making changes to your app code or restarting your server, you must restart your app inside the MentraOS phone app.

For more information, visit the MentraOS-Cloud-Example-App repository. For a more in-depth example with app settings support, see the Extended Example.

Next Steps​