0.0
The project is in a healthy, maintained state
A modern, fast, and memory-efficient implementation of Japanese bank code (Zengin Code) database with flexible query capabilities
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 2.0
~> 5.0
~> 13.0
~> 0.9

Runtime

>= 1.4
 Project Readme

ZenginLite

Gem Version update

A lightweight implementation of zengin-code/zengin-rb.

The name "zengin-lite" comes from the fact that it uses SQLite to store and query bank and branch data.

Rebuilt from scratch with focus on:

  • ⚡️ Fast startup time (5-10ms)
  • 💾 Low memory footprint (1MB)
  • 🔍 Flexible query capabilities

Performance & Trade-offs

This gem (zengin-lite) is designed as a lightweight alternative to zengin-rb.

When to use zengin-lite

  • Web Applications / API Servers: When you need to validate bank codes or look up branch names occasionally in user requests.
  • Memory Constrained Environments: Running on FaaS (AWS Lambda, etc.) or small containers where memory usage matters. zengin-lite keeps memory usage very low (~1MB) by querying SQLite on demand.

When to use zengin-rb

  • Batch Processing / Heavy Loops: If you need to iterate over thousands of banks/branches or perform bulk data processing.
  • Maximum Performance: zengin-rb loads all data into memory (Hash), offering microsecond-level access speed at the cost of higher memory usage (20MB+).

Installation

Add this line to your application's Gemfile:

gem 'zengin_lite'

Or install it yourself as:

$ gem install zengin_lite

Usage

require 'zengin_lite'

# Find bank and branch
bank = ZenginLite.bank("0001") # => #<ZenginLite::Bank code="0001" name="みずほ銀行" ...>
branch = bank.branch("001")    # => #<ZenginLite::Branch code="001" name="東京営業部" ...>

# Search banks
banks = ZenginLite.search_banks(name: "三井")

# Check existence (returns nil if not found)
ZenginLite.bank("9999") # => nil

For more detailed API documentation, please refer to the YARD documentation.

Data Source

This gem uses data from zengin-code/source-data, which is automatically updated daily.

Development

# Clone with submodule
$ git clone --recursive https://github.com/kromiii/zengin-lite.git
$ cd zengin-lite
$ bundle install

# Update source data and build database
$ git submodule update --remote
$ bundle exec rake db:build

# Run tests
$ bundle exec rake test

# Verify database integrity
$ bundle exec rake db:verify

# Build and install locally (database will be built automatically)
$ bundle exec rake install

# Generate documentation
$ bundle exec yard doc
$ open doc/index.html

License

The gem is available as open source under the terms of the MIT License.