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

@stnd/account

v0.1.1

Published

--- title: "@stnd/account" aliases: [] created: 2026-07-05 07:37 modified: 2026-07-05 19:22 last_audited: 2026-07-14 audit_interval_days: 90 next_audit: 2026-10-12 audit_priority: 3 maturity: tree mode: read publish: false status: active tags: - package

Readme


title: "@stnd/account" aliases: [] created: 2026-07-05 07:37 modified: 2026-07-05 19:22 last_audited: 2026-07-14 audit_interval_days: 90 next_audit: 2026-10-12 audit_priority: 3 maturity: tree mode: read publish: false status: active tags:

  • package
  • stnd theme: kernel type: package visibility: private

@stnd/account

A comprehensive, self-contained authentication module for the Standard Garden framework, leveraging BetterAuth.

ELI5

Login, sessions, “sign in with Google”, passkeys (Face ID/Touch ID) — all of it, already wired together, so an app doesn’t reinvent auth from scratch. It’s a Standard module: add it to moduleLoad, point it at a D1 database, and the /api/auth/* routes + the sign-in UI just exist.

Install: moduleLoad: ["@stnd/account"] in astro.config.mjs, then follow “Getting Started” below (D1 schema + env vars — there’s real setup, this isn’t zero-config).

Use it (client-side sign-in):

import { signIn } from "@stnd/account/client";
await signIn.social({ provider: "google" });

Features

  • Google OAuth: Pre-configured social login integration.
  • Passkeys: Built-in support for Touch ID / Face ID / WebAuthn.
  • Magic Links: Ready to be wired up with email service providers.
  • Astro Integration: Automatic API route generation (/api/auth/[…all]) and middleware protection.
  • D1 Compatibility: Seamlessly integrates with Cloudflare D1 and cloudflare:workers environment variables.

Getting Started

1. Database Setup

This module requires specific tables in your Cloudflare D1 database. A schema.sql file is provided in this directory.

When you’re ready to test locally or deploy, apply the schema using Wrangler:

wrangler d1 execute <YOUR_DB_NAME> --local --file=packages/account/schema.sql

(Remove --local when applying to your production database).

2. Environment Variables

Ensure your application’s .dev.vars (for local development) and Cloudflare environment secrets contain the following:

BETTER_AUTH_SECRET="your-generated-secret"
GOOGLE_CLIENT_ID="your-google-client-id"
GOOGLE_CLIENT_SECRET="your-google-client-secret"

Note: Generate a secure secret using npx @better-auth/cli secret or openssl rand -base64 32.

3. Application Integration

In your app’s astro.config.js (e.g., apps/ade/astro.config.js), ensure the module is loaded:

import standard from "@stnd/core";

export default defineConfig({
  integrations: [
    standard({
      moduleLoad: [
        "@stnd/account",
        // ... other modules
      ],
      account: {
        // Optional Configuration overrides (defaults fallback to env vars)
        // db: env.DB, // D1 database binding
        // rpName: "My Custom App", // Passkey Relying Party Name
        // rpID: "my-app.com",      // Passkey Relying Party ID
        // baseURL: "https://auth.my-app.com",
        // trustedOrigins: ["https://my-app.com"]
      },
    }),
  ],
});

4. Google OAuth Setup

To enable Google Login, you must configure a project in the Google Cloud Console:

  1. Create Project: Start a new project (e.g., Utopie-ADE).
  2. OAuth Consent Screen:
    • Set User Type to External.
    • Add your email as a Test User (required while the app is in “Testing” status).
  3. Credentials:
    • Create OAuth client ID of type Web application.
    • Authorized JavaScript origins: http://localhost:8083 (and your production domain).
    • Authorized redirect URIs: http://localhost:8083/api/auth/callback/google (and https://your-domain.com/api/auth/callback/google).
  4. Copy IDs: Paste the Client ID and Secret into your .env or .dev.vars.
  5. Passkey (WebAuthn) Setup Passkeys require a secure context (HTTPS or Localhost).
  • Development: Use http://localhost:8083 or your local port. Note that some browsers require the rpID to match the exact hostname. The module defaults to localhost.
  • Production: Ensure env.RP_ID (or account.rpID in astro.config.js) is set to your domain (e.g., ade.stnd.build). You should also configure env.RP_NAME (or account.rpName) for the prompt display.

6. Client Usage

In your Svelte frontend components, you can import the pre-configured better-auth clients:

import { signIn, signUp, useSession, signOut } from "@stnd/account/client";

// Example: sign in with Google
const handleSignIn = async () => {
  await signIn.social({ provider: "google" });
};

Maintenance & Troubleshooting

Database Adapter Errors

If you see Failed to initialize database adapter or db.insertInto is not a function, ensure that the kysely and kysely-d1 dependencies are correctly installed in the module workspace and that the D1Dialect is being passed the valid D1 binding from the request context.

Origin Mismatch (403 Forbidden)

Ensure baseURL in auth.js matches the port your app is actually running on (e.g., 8083 for ADE). BetterAuth’s CSRF protection is strict about port numbers.

Notes / Observations

(jot down anything noticed here — quirks, gotchas, ideas)

Todo

  • [ ] Nothing tracked yet. [priority:: 3] [token_scale:: 3] [created:: 2026-07-14] [area:: framework]