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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@itrocks/account

v0.0.8

Published

Business entity representing a client or user account with login credentials

Readme

npm version npm downloads GitHub issues discord

account

Business entity representing a client or user account with login credentials.

This documentation was written by an artificial intelligence and may contain errors or approximations. It has not yet been fully reviewed by a human. If anything seems unclear or incomplete, please feel free to contact the author of this package.

Installation

npm i @itrocks/account

@itrocks/account is usually installed together with the it.rocks framework and other business‑level packs, but it can also be used on its own in any TypeScript/Node.js project.

Usage

Account is a small business entity that models a user or client account identified by a login and protected by a password.

The class is already decorated to work seamlessly with the it.rocks ecosystem:

  • it is storable (through @itrocks/store) so it can be persisted and retrieved like any other entity,
  • it has a representative field (login) used by @itrocks/class-view when displaying instances,
  • its password field is configured through @itrocks/password to be handled as a password (hashing, masking in views, etc.).

Minimal example

import { Account } from '@itrocks/account'

const account = new Account()

account.login    = 'alice'
account.password = 's3cr3t'

// Persist with your usual store mechanism (for example via @itrocks/store)
// await store.save(account)

This is enough to create an account that can later be retrieved by the data store and used by higher‑level modules such as authentication or session handling.

Example with it.rocks actions

In a typical it.rocks application, Account is used together with action‑based modules like @itrocks/new and @itrocks/edit to expose HTML and JSON endpoints for managing user accounts.

import { Account } from '@itrocks/account'
import { New }     from '@itrocks/new'
import type { Request } from '@itrocks/action-request'

// Business entity
class UserAccount extends Account {}

// Action used to create new accounts
const newAccount = new New<UserAccount>()

// HTML endpoint: renders a sign‑up form
async function newAccountHtml (request: Request<UserAccount>) {
	return newAccount.html(request)
}

// JSON endpoint: form description for SPA / mobile applications
async function newAccountJson (request: Request<UserAccount>) {
	return newAccount.json(request)
}

From an HTTP framework (Fastify, Express, …), you normally transform the incoming request into a Request<UserAccount> with @itrocks/action-request, then delegate the rendering or JSON handling to the New action as above.

API

class Account

Core business entity describing a generic account with credentials.

Properties

login: string
  • Required field used to identify the account (username, email, client code, …).
  • Also used as the representative value of the account in list and detail views.

Typical values: "alice", "[email protected]", "CUST-00123".

password: string
  • Stores the password chosen by the user.
  • Decorated so that higher‑level components handle it as a secret (hashing, masking, non‑searchable field in grids, etc.).

You usually set this field from a plain‑text password in your UI layer; the password module or surrounding infrastructure takes care of hashing and secure storage.

Typical use cases

  • User registration – store login/password pairs when a new user signs up, using Account as the backing entity for your sign‑up form.
  • Authentication backend – keep authenticated users linked to an Account instance so you can later access business‑level information (owner, permissions, preferences) from the account record.
  • Client or partner portal – model external parties (customers, suppliers, partners) who need their own login/password access to a portal or dashboard.
  • Shared account abstraction – reuse the same Account class across multiple projects or services to keep a consistent representation of login credentials while delegating UI and routing to other packages.