-
Notifications
You must be signed in to change notification settings - Fork 5
Transform repository into a multi-language data file project with separated data and library releases #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: renatovico <[email protected]>
Co-authored-by: renatovico <[email protected]>
Co-authored-by: renatovico <[email protected]>
Co-authored-by: renatovico <[email protected]>
separate per subfolder data, libs, examples in libs bring the javascript version, in examples bring a python version, elixir version, ruby version, .net version |
@copilot please move the javascript complete, i don't want the package.json and other stuffs of js library the root only need the readme for the project and points |
Co-authored-by: renatovico <[email protected]>
Done in commit b51f4e1. Reorganized the repository structure:
Each example includes full implementation and README showing how to use the bin-cc data.
Done in commit b51f4e1. Moved all JavaScript library files (package.json, index.js, creditcard-identifier.js, tests) to The root now only contains:
The root README now serves as a project guide pointing to all implementations rather than being JavaScript-specific. |
@copilot i want a way to "build" this data, and validate, and to be more open to another contributes the idea is be like the browser-list, and i want improve the details { |
Co-authored-by: renatovico <[email protected]>
Done in commit 8b7b8bf. Created a build system similar to browserslist with: Build System:
Enhanced Data Structure:
Future-Ready for Your Example:
Contribution Flow:
See |
Provide the GitHub actions to generate the files and version to be tagged |
@copilot i want support this detail in data eg:
|
Co-authored-by: renatovico <[email protected]>
Done in commit 2e1ee67. Created three GitHub Actions workflows: 1. CI Workflow (
2. Build and Release (
3. Manual Release (
See
... Done in commit 2e1ee67. Now supports detailed BIN-level data including Network, Card Type, Card Category, and Issuer. Schema: {
"scheme": "visa",
"brand": "Visa",
"patterns": [...],
"bins": [
{
"bin": "491441",
"type": "CREDIT",
"category": null,
"issuer": "BANCO PROSPER, S.A."
},
{
"bin": "491414",
"type": "CREDIT",
"category": "GOLD",
"issuer": "BANCO DO ESTADO DO PARANA"
}
]
} Example file: Fields supported:
The See updated |
Co-authored-by: renatovico <[email protected]>
@copilot i want the release of data is to be in github releases, only libs need publish in npm and the lib of js download the github release data |
Co-authored-by: renatovico <[email protected]>
Done in commit fe9160f. Separated data and library releases: Data Releases (GitHub):
Library Releases (npm):
JavaScript Library Changes:
All 70 tests still pass. Data and library can now be versioned and released independently. |
Overview
This PR transforms the bin-cc repository into a data file project similar to tzdata and browserslist, allowing libraries in multiple programming languages to use it as an authoritative source of truth for credit card BIN (Bank Identification Number) patterns. It includes a complete build system, automated CI/CD workflows, support for detailed BIN-level data including issuer information and card categories, and separates data releases (GitHub) from library releases (npm).
Motivation
The repository previously had credit card brand data hardcoded in JavaScript, making it difficult for other libraries to reuse this valuable data without depending on the specific validation functions. By following the tzdata/browserslist pattern with a clean separation of data and implementations, plus a build system for validation and automated CI/CD, we enable the broader ecosystem across multiple programming languages to consume this data in their own implementations. Data is now released independently on GitHub, while library implementations are published to package registries like npm.
Project Structure
The repository has been reorganized into a clear, language-agnostic structure with a build system and automation:
Changes Made
1. Data Extraction & Build System
data/sources/
: Human-editable card scheme definitions (visa.json, mastercard.json, etc.)scripts/build.js
): Compiles source files, validates data, generates patternsdata/compiled/brands.json
): Rich metadata including scheme, brand, type, number details, CVV, patterns, countries, and optional BIN-level detailsdata/brands.json
): Maintained for backward compatibility2. GitHub Actions CI/CD with Separated Releases
.github/workflows/ci.yml
):.github/workflows/data-release.yml
):data/sources/**
data-vX.Y.Z
tags.github/workflows/publish-npm.yml
):vX.Y.Z
tags3. Detailed BIN-Level Data Support
Now supports optional detailed information for specific 6-digit BINs:
New Optional Fields:
bin
: 6-digit BIN numbertype
: Card type (CREDIT, DEBIT)category
: Card tier (CLASSIC, GOLD, PLATINUM, etc.) or nullissuer
: Issuing bank nameExample file included:
data/sources/visa-detailed.example.json
with 15 Brazilian Visa BINs demonstrating the format4. Repository Reorganization
libs/javascript/
subfolder with complete implementationdata/
folder: Centralized location for the source of truth dataexamples/
folder: Multi-language usage examples5. JavaScript Implementation (
libs/javascript/
)index.js
: Main entry point that exports both functions and datacreditcard-identifier.js
: Loads data from downloaded file with fallbackdownload-data.js
: NEW - Downloads latest data from GitHub releasesnpm install
6. Multi-Language Examples
Created complete working implementations in:
examples/python/
): Full validator class with all featuresexamples/elixir/
): Functional implementation with pattern matchingexamples/ruby/
): Object-oriented implementationexamples/dotnet/
): Class-based implementation with LINQEach example includes:
data/brands.json
7. Enhanced Data Structure
The compiled format now includes rich metadata:
Currently Implemented:
scheme
: Scheme identifier (e.g., "visa")brand
: Display name (e.g., "Visa")type
: Card type (credit/debit)number
: Valid lengths and Luhn validation flagcvv
: CVV code lengthpatterns
: BIN and full validation patternscountries
: Countries of issuance (GLOBAL, BR, US, etc.)metadata
: Source file referencebins
: Optional array of detailed BIN information (issuer, category, type)8. Comprehensive Documentation
data/SCHEMA.md
: Detailed schema documentation for all formats including BIN-level datadata/README.md
: Data usage guidelibs/javascript/README.md
: JavaScript-specific documentation with download instructionsexamples/BIN_DATA_USAGE.md
: Comprehensive guide with usage examples for BIN-level data.github/workflows/README.md
: Complete CI/CD automation documentation with separated release workflowsBuild System
The project follows a source → build → compiled workflow similar to browserslist:
Building the Data
This command:
data/sources/
data/compiled/brands.json
Contribution Workflow
Release Architecture
Data Releases (GitHub)
data-vX.Y.Z
(e.g.,data-v2.0.1
)data/sources/**
brands.json
,compiled/brands.json
,sources/*.json
Library Releases (npm)
vX.Y.Z
(e.g.,v1.3.0
)Workflow Process
Automatic Data Releases:
data/sources/
data-vX.Y.Z
release with data filesManual Library Releases:
1.3.0
)latest
,beta
,next
)vX.Y.Z
releaseUsage Examples
JavaScript (from
libs/javascript/
)Python
Ruby
Direct JSON Access (Any Language)
# Download latest data directly curl -L https://github.com/renatovico/bin-cc/releases/download/data-v2.0.1/brands.json -o brands.json
Backward Compatibility
✅ Zero breaking changes - All existing JavaScript functionality is preserved:
findBrand(cardNumber)
- Identifies credit card brandisSupported(cardNumber)
- Checks if card is supportedhipercardRegexp()
- Returns Hipercard regexAll 70 existing tests pass without modification.
Benefits
Testing
This transformation makes bin-cc a proper multi-language data file project with a complete build system, automated CI/CD, detailed BIN information support, and a clean separation between data releases (GitHub) and library releases (npm) that can serve as the foundation for credit card validation across any programming language or framework, while being open and easy for community contributions.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.