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

@misterpea/schwab-frame

v0.0.3

Published

Electron + React app frame for building desktop tools on top of the Charles Schwab API.

Readme

@misterpea/schwab-frame 🖼️

An Electron + React desktop app frame for building tools on top of the Charles Schwab API (@misterpea/schwab-node).

Think of it like an unpopulated Eurorack case:

  • Secure Schwab authentication is built in.
  • Drop in your own React modules and Schwab API calls without needing to touch any of the auth plumbing.
  • Use methods found in @misterpea/schwab-node (Order calls not yet available).

What's Included

  • Electron security — main/preload/renderer isolation with contextIsolation enabled and nodeIntegration disabled.
  • In-app credentials — users enter their Schwab developer keys through the settings UI. No .env file, no hardcoded secrets.
  • Encrypted storage — credentials stored via Electron safeStorage; OAuth tokens via EncryptedFileTokenStore from @misterpea/schwab-node, both encrypted at rest.
  • Local HTTPS callback — certificate setup handled automatically by schwab-node-certs.
  • Settings modal — lets users enter, replace, or clear credentials at any time.
  • Dark / light mode — OS preference detected on launch, persisted in localStorage, and toggleable from the topbar or settings modal. Two toggle button locations are provided so developers can keep or remove either.
  • Atkinson Hyperlegible Next Font — bundled locally (no external font requests) to keep the default-src 'self' CSP intact.
  • SCSS styling — palette lives in SCSS maps emitted as CSS custom properties; easy to theme.
  • Default module — a hello-world card that calls getUserPreference() and displays account, permissions, and streamer socket info to confirm a working OAuth session.

Prerequisites

  • Node.js 20.6 or later
  • A Schwab developer app with a client ID, client secret, and a redirect URI pointed at a local HTTPS address (e.g. https://127.0.0.1:8443)

Quick Start

Scaffold a new project from the template:

npx degit MisterPea/schwab-frame my-app
cd my-app
npm install
npm run dev

On first launch the settings modal opens automatically. Enter your Schwab developer credentials and click Save. The app will start the OAuth flow and, once authorized, display the hello-world module.

Scripts

| Script | What it does | |---|---| | npm run dev | Vite dev server + Electron with hot reload | | npm run build | TypeScript compile + Vite production build | | npm start | Build then launch Electron | | npm test | Run the Vitest suite once | | npm run test:watch | Vitest in watch mode | | npm run typecheck | Type-check renderer and main without emitting |

Where To Add Your App

Replace or extend the default module:

  • src/renderer/modules/AppContent.tsx — top-level content container rendered after login.
  • src/renderer/modules/HelloWorldModule.tsx — the default demo card; swap it for your own component.

Keep Schwab API calls in the Electron main process and expose them through small, explicit IPC methods in src/main/preload.ts. That preserves the security boundary while giving React a clean typed surface to call.

Styling

Global styles live in src/renderer/styles.scss. The file uses two SCSS maps — $light and $dark — that are emitted as CSS custom properties via a @include palette() mixin. To change the color scheme, edit the maps at the top of the file.

The dark/light toggle is implemented in src/renderer/hooks/useTheme.ts and rendered by src/renderer/components/ThemeToggle.tsx. The two button placements (topbar and settings) are marked with comments; remove either <ThemeToggle /> instance to disable that location.

Auth & Storage Notes

This template uses the following public APIs from @misterpea/schwab-node:

  • configureDefaultAuth
  • SchwabAuth
  • EncryptedFileTokenStore
  • getUserPreference
  • setupCerts (from @misterpea/schwab-node/scripts/setup-certs)

Credentials are stored under Electron's app.getPath("userData") directory as an encrypted blob. OAuth tokens are stored separately in an encrypted token file and injected into @misterpea/schwab-node through its custom token-store hook.

Test Suite

npm test

The suite is designed to protect the reusable frame while leaving the app surface open. It covers encrypted credential storage, IPC channel names, login and cert ordering, and the default React shell.


Disclaimer

This template builds Electron apps that interact with the Schwab brokerage API. It is not financial advice and carries no liability for financial losses, missed trades, API errors, or authentication interruptions. See DISCLAIMER.md for full details.