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

digicred-database

v1.0.1

Published

A robust and scalable database repository for the DigiCred application, built with Drizzle ORM and designed for Turso (SQLite-compatible) databases. This repository manages core application data including user authentication, financial transactions, savin

Readme

digicred_database_repo

A robust and scalable database repository for the DigiCred application, built with Drizzle ORM and designed for Turso (SQLite-compatible) databases. This repository manages core application data including user authentication, financial transactions, savings accounts, and credit requests.

Features

  • User Management: Handles user registration, authentication, roles (Admin, Customer), and sessions.
  • Account Management: Stores user account details and provider information.
  • Financial Transactions: Records deposits, withdrawals, and repayments for savings accounts.
  • Savings Accounts: Manages individual user savings balances.
  • Credit Requests: Processes and tracks credit applications with various statuses (Pending, Approved, Rejected, Repaid).
  • JWKS (JSON Web Key Set): Securely stores public and private keys for JWT (JSON Web Token) operations.
  • Type-Safe Schema: Fully type-safe database interactions powered by Drizzle ORM and TypeScript.
  • Migrations: Easy database schema evolution with Drizzle Kit migrations.

Installation

To use this database repository in your project, follow these steps:

  1. Prerequisites:

    • Node.js (LTS version recommended)
    • npm or Yarn
  2. Install Dependencies:

    npm install digicred_database_repo
    # or
    yarn add digicred_database_repo

    If you are working within the digicred_database_repo itself (e.g., for development or contributing), clone the repository and install dependencies:

    git clone <repository-url>
    cd digicred_database_repo
    npm install

Configuration

This repository requires environment variables for database connection. Create a .env file in the root of your project (or ensure these variables are set in your deployment environment):

DATABASE_URL="your_turso_database_url"
DATABASE_AUTH_TOKEN="your_turso_auth_token"
  • DATABASE_URL: The connection URL for your Turso database.
  • DATABASE_AUTH_TOKEN: The authentication token for your Turso database.

Usage

Initializing the Database Client

You can import and use the db client from this package to interact with your database:

import { db, schema } from 'digicred_database_repo';
import { eq } from 'drizzle-orm';

async function getUser(userId: string) {
  const user = await db.query.users.findFirst({
    where: eq(schema.users.id, userId),
  });
  return user;
}

// Example: Fetch all users
async function getAllUsers() {
  const users = await db.query.users.findMany();
  console.log(users);
}

getAllUsers();

Schema

The database schema is defined in src/schema.ts and includes the following main tables:

  • users: Stores user information, including roles.
  • sessions: Manages user sessions.
  • accounts: Stores external account details linked to users.
  • verifications: Handles verification tokens (e.g., email verification).
  • jwks: Stores JSON Web Key Sets for JWT signing/verification.
  • savingsAccounts: Manages individual savings accounts for users.
  • transactions: Records all financial transactions (deposits, withdrawals, repayments).
  • creditRequests: Manages user credit requests.

Development

Migrations

Drizzle Kit is used for managing database migrations.

  • Generate a new migration:

    npm run db:generate # or yarn db:generate

    This command will create a new migration file in the migrations directory based on changes in src/schema.ts.

  • Apply migrations to your database:

    npm run db:push # or yarn db:push

    This command applies pending migrations to your configured database.

Seeding Data

The repository includes a script to seed initial admin users.

  • Seed Admin Users:
  • Seed Admin Users:
    npm run db:seed:admins # or yarn db:seed:admins
    This script will create a set of default admin users in your database. Ensure your .env file is correctly configured before running.

Other Development Scripts

  • npm run db:generate: Generates new Drizzle migrations based on schema changes.

  • npm run db:migrate: This script is typically used to apply migrations when working with a local sqlite database.

  • npm run db:push: Pushes schema changes directly to the database, useful for development without creating new migration files.

  • npm run db:studio: Opens Drizzle Studio for a visual interface to your database.

  • npm run build: Compiles the TypeScript code to JavaScript.

  • npm run check-types: Runs TypeScript type checking.

    This script will create a set of default admin users in your database. Ensure your .env file is correctly configured before running.

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

This project is licensed under the MIT License.