npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@archlast/sdk-expo

v0.1.1

Published

Archlast SDK for Expo (React Native) with SecureStore and deep linking

Readme

@archlast/sdk-expo

Archlast SDK for Expo (React Native) with SecureStore and deep linking support.

Installation

npm install @archlast/sdk-expo
npx expo install expo-secure-store

Features

  • Secure Storage: Uses expo-secure-store for session persistence
  • Deep Linking: OAuth callback support via deep links
  • Better-Auth Wrapped: No need to install better-auth directly
  • React Native Hooks: useAuth(), useSession()
  • Type-Safe: Full TypeScript support

Configuration

1. Update app.json

Add your app's scheme to app.json for deep linking:

{
    "expo": {
        "scheme": "archlast",
        "extra": {
            "eas": {
                "projectId": "your-project-id"
            }
        }
    }
}

2. Update Metro Config

Enable package exports in metro.config.js:

const { getDefaultConfig } = require("expo/metro-config");

const config = getDefaultConfig(__dirname);

config.resolver.unstable_enablePackageExports = true;

module.exports = config;

Or use babel plugin resolution:

// babel.config.js
module.exports = function (api) {
    return {
        presets: ["babel-preset-expo"],
        plugins: [
            [
                "module-resolver",
                {
                    alias: {
                        "better-auth/react":
                            "./node_modules/better-auth/dist/client/react/index.mjs",
                        "better-auth/client/plugins":
                            "./node_modules/better-auth/dist/client/plugins/index.mjs",
                        "@better-auth/expo/client":
                            "./node_modules/@better-auth/expo/dist/client.mjs",
                    },
                },
            ],
        ],
    };
};

3. Environment Variables

# Optional: Set Better-Auth server URL
EXPO_PUBLIC_BETTER_AUTH_URL=http://localhost:4000

# Or use Archlast URL
EXPO_PUBLIC_ARCHLAST_HTTP_URL=http://localhost:4000

# Optional: Set deep link scheme (default: archlast)
EXPO_PUBLIC_DEEP_LINK_SCHEME=archlast

Usage

Basic Client

import { BaseClient } from "@archlast/sdk-expo";

const client = new BaseClient({
    baseUrl: "http://localhost:4000",
});

// Query
const tasks = await client.query("listTasks", { limit: 10 });

// Mutate
const task = await client.mutate("createTask", {
    text: "New task",
});

Authentication

"use client";
import { authClient } from "@archlast/sdk-expo/auth";
import { useAuth } from "@archlast/sdk-expo/react";

export default function LoginScreen() {
    const { signIn, session, isLoading } = useAuth();

    const handleLogin = async () => {
        await authClient.signIn.email({
            email: "[email protected]",
            password: "password",
        });
    };

    if (isLoading) return <ActivityIndicator />;

    if (session) {
        return <Text>Welcome {session.user.name}</Text>;
    }

    return <Button title="Sign In" onPress={handleLogin} />;
}

Deep Link Handling

For OAuth providers, handle the deep link callback:

{
  "expo": {
    "scheme": "archlast"
  }
}
import * as React from "react";
import { useEffect } from "react";
import { parseOAuthCallback, getInitialURL, addDeepLinkListener } from "@archlast/sdk-expo/linking";

export default function App() {
    useEffect(() => {
        // Handle initial URL (app opened from OAuth redirect)
        getInitialURL().then((url) => {
            if (url) {
                const callback = parseOAuthCallback(url);
                // Exchange code for session...
            }
        });

        // Listen for deep links while app is running
        const subscription = addDeepLinkListener(({ url }) => {
            const callback = parseOAuthCallback(url);
            // Handle callback...
        });

        return () => subscription.remove();
    }, []);

    return <YourRootComponent />;
}

Social Sign-In

import { authClient } from "@archlast/sdk-expo/auth";

export default function SocialLogin() {
    const handleGoogleLogin = async () => {
        await authClient.signIn.social({
            provider: "google",
            callbackURL: "/dashboard", // Becomes archlast://dashboard
        });
    };

    return <Button title="Login with Google" onPress={handleGoogleLogin} />;
}

Protected Routes

import { useAuth } from "@archlast/sdk-expo/react";

export default function ProtectedScreen() {
    const { session, isLoading } = useAuth();

    if (isLoading) return <ActivityIndicator />;

    if (!session) {
        return <LoginPage />;
    }

    return <DashboardScreen />;
}

API

Client Creation

import { BaseClient } from "@archlast/sdk-expo";

const client = new BaseClient({
  baseUrl: string;        // Archlast server URL
  appId?: string;         // Optional app ID for isolation
  apiKey?: string;        // Better-Auth API key
});

Auth

  • authClient - Default Better-Auth client
  • useSession() - Hook for session state
  • createAuthClient(options) - Create custom client

Storage

  • secureStoreAdapter - SecureStore adapter for Better-Auth
  • initializeSecureStoreAdapter() - Initialize the SecureStore adapter

Linking

  • parseOAuthCallback(url) - Parse OAuth deep link
  • getInitialURL() - Get app's opening URL
  • addDeepLinkListener(callback) - Listen for deep links
  • openOAuthURL(url) - Open OAuth provider in browser

Session Persistence

Sessions are automatically persisted in SecureStore with these settings:

  • Storage: expo-secure-store (encrypted on most devices)
  • Prefix: better-auth.session_token
  • Sync: Automatic with Better-Auth server

Web Support

The SDK works on Expo Web (in development) using:

  • Cookies instead of SecureStore
  • Standard browser navigation
  • Same API as native

Troubleshooting

Metro Bundler Issues

If you see import errors, add to babel.config.js:

plugins: [
    [
        "module-resolver",
        {
            alias: {
                "better-auth/react": "./node_modules/better-auth/dist/client/react/index.mjs",
                "@better-auth/expo/client": "./node_modules/@better-auth/expo/dist/client.mjs",
            },
        },
    ],
];

Deep Links Not Working

  1. Check app.json has the correct scheme
  2. Ensure EXPO_PUBLIC_DEEP_LINK_SCHEME matches
  3. Test with: npx expo url --scheme archlast

Clear Cache

npx expo start --clear

License

MIT