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

finance-cli

v1.0.1

Published

A TypeScript CLI tool to track personal finances with Prisma and Neon Postgres

Readme

Finance CLI A command-line tool to track personal finances, built with TypeScript, Prisma, and Neon Postgres. Manage expenses, income, and budgets with detailed reports, ASCII charts for spending visualization, and multi-month summaries. Features

Add income and expense transactions with categories and descriptions. View monthly or multi-month financial summaries (income, expenses, balance). Export transactions to CSV for external analysis. Analyze spending by category with optional ASCII charts. Set and check monthly budgets with remaining balance alerts. List recent transactions with customizable limits. Delete transactions by ID with robust error handling. Production-ready with retry logic for database operations, unit tests, linting, and CI/CD via GitHub Actions.

Installation Install globally via NPM: npm install -g @movineo/finance-cli

Or clone and run locally: git clone https://github.com/Movineo/finance-cli.git cd finance-cli npm install npm run build

Prerequisites

Node.js: v18 or later. Neon Postgres: A free account with a database (set DATABASE_URL in .env). Git: For cloning the repository (optional).

Setup

Clone the Repository (for local development): git clone https://github.com/Movineo/finance-cli.git cd finance-cli

Install Dependencies: npm install

Set Up the Database:

Create a Neon Postgres database at console.neon.tech. Copy the connection string (pooled, with sslmode=require). Create a .env file in the project root:DATABASE_URL="postgresql://user:[email protected]/neondb?sslmode=require"

Run migrations and generate the Prisma client:npx prisma migrate dev --name init --schema=src/prisma/schema.prisma npx prisma generate --schema=src/prisma/schema.prisma

Build the Project: npm run build

Run the CLI:

Locally:node dist/index.js --help

Globally (after npm link or global installation):finance --help

Usage finance [options]

Commands

add: Add a new transaction. finance add --type expense --amount 50 --category food --description "Lunch"

Options: --type <expense|income>, --amount , --category , --description

summary: View financial summary for the current month or multiple months. finance summary finance summary --months 3

Options: --months (default: 1)

export: Export transactions to CSV. finance export --file transactions.csv

Options: --file

breakdown: View spending by category with an optional ASCII chart. finance breakdown finance breakdown --no-chart

Options: --no-chart (disables ASCII chart)

set-budget: Set a monthly budget. finance set-budget --amount 1000

Options: --amount

check-budget: Check spending against the monthly budget. finance check-budget

list: List recent transactions. finance list --limit 10

Options: --limit (default: 10)

delete: Delete a transaction by ID. finance delete --id 1

Options: --id

Run finance --help for detailed options. Example Workflow

Set a budget

finance set-budget --amount 1500

Add transactions

finance add --type income --amount 1000 --category salary --description "Freelance" finance add --type expense --amount 300 --category utilities --description "Electricity" finance add --type expense --amount 200 --category food --description "Groceries"

View reports

finance list finance breakdown finance summary finance check-budget

Export data

finance export --file transactions.csv

Delete a transaction

finance delete --id 1

Development Scripts

Build: Compile TypeScript to JavaScript.npm run build

Test: Run Jest unit tests.npm test

Lint: Check code quality with ESLint.npm run lint

Development Mode: Run with ts-node for quick testing.npm run dev add --type expense --amount 50

Prisma Commands:npm run prisma:migrate npm run prisma:generate

Testing The CLI includes unit tests for add, delete, summary, check-budget, and breakdown commands using Jest. Run: npm test

CI/CD The project uses GitHub Actions for continuous integration and deployment. The workflow (ci.yml) runs on push/pull requests to the main branch, performing:

Unit tests with Jest. Linting with ESLint. Building the project and generating the Prisma client.

To enable CI/CD:

Push to a GitHub repository (e.g., github.com/Movineo/finance-cli). Add DATABASE_URL to GitHub Secrets (Settings → Secrets and variables → Actions). Monitor runs at https://github.com/Movineo/finance-cli/actions.

Troubleshooting

Database Connection Issues: Verify DATABASE_URL in .env matches your Neon Postgres connection string. Check Neon’s status: status.neon.tech. Test connectivity:npx prisma db pull --schema=src/prisma/schema.prisma

Command Errors: Ensure required options are provided (e.g., --type for add). For delete, use finance list to find valid transaction IDs. Invalid IDs return "Transaction with ID X not found".

ASCII Chart Issues: If the chart doesn’t render correctly, try a different terminal (e.g., PowerShell, VS Code). Use --no-chart to disable the chart.

Test Failures: Run npm test -- --verbose for detailed output. Ensure Prisma mocks are correctly set up in tests.

Contributing

Fork the repository: https://github.com/Movineo/finance-cli. Create a feature branch: git checkout -b feature-name. Commit changes: git commit -m "Add feature". Push to the branch: git push origin feature-name. Open a pull request.

License MIT Acknowledgments

Built with TypeScript, Prisma, Neon, Commander.js, and asciichart. Inspired by personal finance management needs.