{"id":22943956,"url":"https://github.com/moov-io/metro2","last_synced_at":"2025-04-05T15:07:28.830Z","repository":{"id":36979695,"uuid":"268563554","full_name":"moov-io/metro2","owner":"moov-io","description":"Open Source Metro 2 consumer credit history report for credit report file creation and validation","archived":false,"fork":false,"pushed_at":"2025-03-25T16:46:45.000Z","size":14205,"stargazers_count":101,"open_issues_count":8,"forks_count":49,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-29T14:12:37.930Z","etag":null,"topics":["credit-history","credit-reports","hacktoberfest","metro2"],"latest_commit_sha":null,"homepage":"https://moov-io.github.io/metro2/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/moov-io.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-01T15:42:41.000Z","updated_at":"2025-03-19T06:54:33.000Z","dependencies_parsed_at":"2023-02-17T21:46:20.801Z","dependency_job_id":"c8082bf0-5eec-414a-bc19-a091cbbe3aaf","html_url":"https://github.com/moov-io/metro2","commit_stats":null,"previous_names":[],"tags_count":33,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moov-io%2Fmetro2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moov-io%2Fmetro2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moov-io%2Fmetro2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moov-io%2Fmetro2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moov-io","download_url":"https://codeload.github.com/moov-io/metro2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353745,"owners_count":20925329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["credit-history","credit-reports","hacktoberfest","metro2"],"created_at":"2024-12-14T14:14:57.206Z","updated_at":"2025-04-05T15:07:28.798Z","avatar_url":"https://github.com/moov-io.png","language":"Go","funding_links":[],"categories":["Banking Infrastructure"],"sub_categories":[],"readme":"[![Moov Banner Logo](https://user-images.githubusercontent.com/20115216/104214617-885b3c80-53ec-11eb-8ce0-9fc745fb5bfc.png)](https://github.com/moov-io)\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://moov-io.github.io/metro2/\"\u003eProject Documentation\u003c/a\u003e\n  ·\n  \u003ca href=\"https://moov-io.github.io/metro2/api/#overview\"\u003eAPI Endpoints\u003c/a\u003e\n  ·\n  \u003ca href=\"https://moov.io/blog/education/metro2-api-guide/\"\u003eAPI Guide\u003c/a\u003e\n  ·\n  \u003ca href=\"https://slack.moov.io/\"\u003eCommunity\u003c/a\u003e\n  ·\n  \u003ca href=\"https://moov.io/blog/\"\u003eBlog\u003c/a\u003e\n  \u003cbr\u003e\n  \u003cbr\u003e\n\u003c/p\u003e\n\n[![GoDoc](https://godoc.org/github.com/moov-io/metro2?status.svg)](https://godoc.org/github.com/moov-io/metro2)\n[![Build Status](https://github.com/moov-io/metro2/workflows/Go/badge.svg)](https://github.com/moov-io/metro2/actions)\n[![Coverage Status](https://codecov.io/gh/moov-io/metro2/branch/master/graph/badge.svg)](https://codecov.io/gh/moov-io/metro2)\n[![Go Report Card](https://goreportcard.com/badge/github.com/moov-io/metro2)](https://goreportcard.com/report/github.com/moov-io/metro2)\n[![Repo Size](https://img.shields.io/github/languages/code-size/moov-io/metro2?label=project%20size)](https://github.com/moov-io/metro2)\n[![Apache 2 License](https://img.shields.io/badge/license-Apache2-blue.svg)](https://raw.githubusercontent.com/moov-io/metro2/master/LICENSE)\n[![Slack Channel](https://slack.moov.io/badge.svg?bg=e01563\u0026fgColor=fffff)](https://slack.moov.io/)\n[![Docker Pulls](https://img.shields.io/docker/pulls/moov/metro2)](https://hub.docker.com/r/moov/metro2)\n[![GitHub Stars](https://img.shields.io/github/stars/moov-io/metro2)](https://github.com/moov-io/metro2)\n[![Twitter](https://img.shields.io/twitter/follow/moov?style=social)](https://twitter.com/moov?lang=en)\n\n# moov-io/metro2\n\nMoov's mission is to give developers an easy way to create and integrate bank processing into their own software products. Our open source projects are each focused on solving a single responsibility in financial services and designed around performance, scalability, and ease-of-use.\n\nMetro2 implements a reader, writer, and validator for consumer credit history reports in an HTTP server and Go library. The HTTP server is available in a [Docker image](#docker) and the Go package `github.com/moov-io/metro2` is available.\n\n## Table of contents\n\n- [Project status](#project-status)\n- [Usage](#usage)\n  - As an API\n    - [Docker](#docker)\n    - [Google Cloud](#google-cloud-run)\n    - [Data persistence](#data-persistence)\n  - [As a command line tool](#command-line)\n  - As a Package\n      - [Go Library](#go-library)\n      - [Installation](#package-installation)\n      - [Overview](#package-overview)\n      - [Examples](#package-examples)\n- [Learn about Metro 2](#learn-about-metro-2)\n- [Getting help](#getting-help)\n- [Supported and tested platforms](#supported-and-tested-platforms)\n- [Contributing](#contributing)\n- [Related projects](#related-projects)\n\n## Project status\n\nMoov Metro2 is actively used in multiple production environments. Please star the project if you are interested in its progress. If you have layers above Metro2 to simplify tasks, perform business operations, or found bugs we would appreciate an issue or pull request. Thanks!\n\n## Usage\n\nThe Metro2 project implements an HTTP server and [Go library](https://pkg.go.dev/github.com/moov-io/metro2) for creating and modifying files in Metro 2 format, which is used for consumer credit history reporting by U.S. credit bureaus.\n\n### Docker\n\nWe publish a [public Docker image `moov/metro2`](https://hub.docker.com/r/moov/metro2/) on Docker Hub with each tagged release of Metro2. No configuration is required to serve on `:8080`. We also have Docker images for [OpenShift](https://quay.io/repository/moov/metro2?tab=tags) published as `quay.io/moov/metro2`.\n\nPull \u0026 start the Docker image:\n```\ndocker pull moov/metro2:latest\ndocker run -p 8080:8080 moov/metro2:latest\n```\n\nUpload a file and validate it:\n```\ncurl -X POST --form \"file=@./test/testdata/packed_file.json\" http://localhost:8080/validator\n```\n```\nvalid file\n```\n\nConvert a file from JSON to raw Metro format:\n```\ncurl -X POST --form \"file=@./test/testdata/packed_file.json\" --form \"format=metro\" http://localhost:8080/convert\n```\n```\n0480HEADER                           555555555508202002051019990510199905101999YOUR BUSINESS NAME HERE                 LINE ONE OF YOUR ADDRESS LINE TWO OF YOUR ADDRESS LINE THERE OF YOUR ADDRESS                    1234567890\n...\n```\n\nConvert a file from raw Metro format to JSON:\n```\ncurl -X POST --form \"file=@./test/testdata/packed_file.dat\" --form \"format=json\" http://localhost:8080/convert\n```\n```\n{\"header\": {\"blockDescriptorWord\": 370,\"recordDescriptorWord\": 366,\"recordIdentifier\": \"HEADER\",\"transUnionProgramIdentifier\": \"5555555555\",\"activityDate\": \"2002-08-20T00:00:00Z\", ...\n```\n\n### Google Cloud Run\n\nTo get started in a hosted environment you can deploy this project to the Google Cloud Platform.\n\nFrom your [Google Cloud dashboard](https://console.cloud.google.com/home/dashboard) create a new project and call it:\n```\nmoov-metro2-demo\n```\n\nEnable the [Container Registry](https://cloud.google.com/container-registry) API for your project and associate a [billing account](https://cloud.google.com/billing/docs/how-to/manage-billing-account) if needed. Then, open the Cloud Shell terminal and run the following Docker commands, substituting your unique project ID:\n\n```\ndocker pull moov/metro2\ndocker tag moov/metro2 gcr.io/\u003cPROJECT-ID\u003e/metro2\ndocker push gcr.io/\u003cPROJECT-ID\u003e/metro2\n```\n\nDeploy the container to Cloud Run:\n```\ngcloud run deploy --image gcr.io/\u003cPROJECT-ID\u003e/metro2 --port 8080\n```\n\nSelect your target platform to `1`, service name to `metro2`, and region to the one closest to you (enable Google API service if a prompt appears). Upon a successful build you will be given a URL where the API has been deployed:\n\n```\nhttps://YOUR-METRO2-APP-URL.a.run.app\n```\n\nNow you can complete a health check:\n```\ncurl https://YOUR-METRO2-APP-URL.a.run.app/health\n```\nYou should get this response:\n```\n{\"status\":\"alive\"}\n```\n\n### Data persistence\nBy design, Metro2  **does not persist** (save) any data about the files or entry details created. The only storage occurs in memory of the process and upon restart Metro2 will have no files or data saved. Also, no in-memory encryption of the data is performed.\n\n### Command line\n\nMetro2 has a command line interface to manage Metro 2 files and launch a web service.\n\n```\nmetro2 --help\n\nUsage:\n   [command]\n\nAvailable Commands:\n  convert     Convert metro file format\n  help        Help about any command\n  print       Print metro file\n  validator   Validate metro file\n  web         Launches web server\n\nFlags:\n  -h, --help           help for this command\n      --input string   input file (default is $PWD/metro.json)\n\nUse \" [command] --help\" for more information about a command.\n```\n\nEach interaction that the library supports is exposed in a command-line option:\n\n Command | Info\n ------- | -------\n`convert` | The convert command allows users to convert a metro file to a specified file format (json, metro). The result will create a new file.\n`print` | The print command allows users to print a metro file in a specified file format (json, metro).\n`validator` | The validator command allows users to validate a metro file.\n`web` | The web command will launch a web server with endpoints to manage metro files.\n\n\n### Go library\n\nThis project uses [Go Modules](https://go.dev/blog/using-go-modules) and Go v1.18 or newer. See [Golang's install instructions](https://golang.org/doc/install) for help setting up Go. You can download the source code and we offer [tagged and released versions](https://github.com/moov-io/metro2/releases/latest) as well. We highly recommend you use a tagged release for production.\n\n### Package Installation\n```\n$ git@github.com:moov-io/metro2.git\n\n# Pull down into the Go Module cache\n$ go get -u github.com/moov-io/metro2\n\n$ go doc github.com/moov-io/metro2\n```\n\n### Package Overview\n\nPackage file defines main interfaces to a metro file.\n\n```\nfunc NewFile(format string) (File, error)\n\nfunc NewFileFromReader(r io.Reader) (File, error)\n\ntype File\n\tGetType() string\n\tSetType(string) error\n\tSetRecord(lib.Record) error\n\tAddDataRecord(lib.Record) error\n\tGetRecord(string) (lib.Record, error)\n\tGetDataRecords() []lib.Record\n\tGeneratorTrailer() (lib.Record, error)\n\tParse(record string) error\n\tString(newline bool) string\n\tValidate() error\n```\n\nFile has some records for header, body, trailer\n\nRecords have distinguished by file type\n\n```\ntype Record\n\tName() string\n\tParse(string) (int, error)\n\tString() string\n\tValidate() error\n\tLength() int\n\tBlockSize() int\n\tAddApplicableSegment(Segment) error\n\tGetSegments(string) []Segment\n\ntype BaseSegment        // for character file format\n\ntype PackedBaseSegment  // for packed file format\n\ntype HeaderRecord       // for character file format\n\ntype PackedHeaderRecord // for packed file format\n\ntype TrailerRecord      // for character file format\n\ntype PackedTrailerRecord // for packed file format\n```\n\nRecord has some segments to describe special form\n\nBase Record can use correctly the features of appendable segments\n\n```\ntype Record\n\tName() string\n\tParse(string) (int, error)\n\tString() string\n\tValidate() error\n\tLength() int\n\tBlockSize() int\n\tAddApplicableSegment(Segment) error\n\tGetSegments(string) []Segment\n\ntype J1Segment\n\ntype J2Segment\n\ntype K1Segment\n\ntype K2Segment\n\ntype K3Segment\n\ntype K4Segment\n\ntype L1Segment\n\ntype N1Segment\n```\n\n### Package Examples\n\nFile object has type for metro packed file and metro character file, should specify file type when creating new file\n```\nf, err := file.NewFile(utils.PackedFileFormat)\nerr = json.Unmarshal([]byte(buf), f)\n```\n\nFile object will create from metro file buffer directly, CreateFile function will create new file and will set file type based on metro file body\n```\nr, _ = os.Open(filepath.Join(\"...))\nf, err := file.NewFileFromReader(r)\n```\n\nFile object will manage records using member functions\n\nPlease use exact record object that has same type (header, base, trailer)\n\n```\nf, err := file.NewFile(utils.CharacterFileFormat)\nnewHeader := lib.HeaderRecord{}\nerr = f.SetRecord(\u0026newSegment)\nexsitedHeader, err := f.GetRecord(utils.HeaderRecordName)\nnewBase := lib.HeaderRecord{}\n...\n```\n\nSimilarly, Record can manage the appendable segments\n\n## Learn about Metro 2\n- [Intro to Metro 2](https://www.cdiaonline.org/resources/furnishers-of-data-overview/metro2-information/)\n- [Metro 2 File Structure](https://www.collect.org/cv11/Help/metro2format.html)\n\n## Getting help\n\n channel | info\n ------- | -------\nTwitter [@moov](https://twitter.com/moov)\t| You can follow Moov.io's Twitter feed to get updates on our project(s). You can also tweet us questions or just share blogs or stories.\n[GitHub Issue](https://github.com/moov-io) | If you are able to reproduce a problem please open a GitHub Issue under the specific project that caused the error.\n[moov-io slack](https://slack.moov.io/) | Join our slack channel to have an interactive discussion about the development of the project.\n\n## Supported and tested platforms\n\n- 64-bit Linux (Ubuntu, Debian), macOS, and Windows\n\n## Contributing\n\nYes please! Please review our [Contributing guide](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md) to get started!\n\nThis project uses [Go Modules](https://go.dev/blog/using-go-modules) and Go v1.18 or newer. See [Golang's install instructions](https://golang.org/doc/install) for help setting up Go. You can download the source code and we offer [tagged and released versions](https://github.com/moov-io/metro2/releases/latest) as well. We highly recommend you use a tagged release for production.\n\n### Releasing\n\nTo make a release of metro2 simply open a pull request with `CHANGELOG.md` and `version.go` updated with the next version number and details. You'll also need to push the tag (i.e. `git push origin v1.0.0`) to origin in order for CI to make the release.\n\n### Testing\n\nWe maintain a comprehensive suite of unit tests and recommend table-driven testing when a particular function warrants several very similar test cases. To run all test files in the current directory, use `go test`. Current overall coverage can be found on [Codecov](https://app.codecov.io/gh/moov-io/metro2/).\n\n### Fuzzing\n\nWe currently run fuzzing over ACH in the form of a [Github Action](https://github.com/moov-io/metro2/actions/workflows/fuzz.yml). Please report crashes examples to [`oss@moov.io`](mailto:oss@moov.io). Thanks!\n\n## Related projects\n\nAs part of Moov's initiative to offer open source fintech infrastructure, we have a large collection of active projects you may find useful:\n\n- [Moov Watchman](https://github.com/moov-io/watchman) offers search functions over numerous trade sanction lists from the United States and European Union.\n\n- [Moov Fed](https://github.com/moov-io/fed) implements utility services for searching the United States Federal Reserve System such as ABA routing numbers, financial institution name lookup, and FedACH and Fedwire routing information.\n\n- [Moov Wire](https://github.com/moov-io/wire) implements an interface to write files for the Fedwire Funds Service, a real-time gross settlement funds transfer system operated by the United States Federal Reserve Banks.\n\n- [Moov ACH](https://github.com/moov-io/ach) provides ACH file generation and parsing, supporting all Standard Entry Codes for the primary method of money movement throughout the United States.\n\n- [Moov Image Cash Letter](https://github.com/moov-io/imagecashletter) implements Image Cash Letter (ICL) files used for Check21, X.9 or check truncation files for exchange and remote deposit in the U.S.\n\n## License\n\nApache License 2.0 - See [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoov-io%2Fmetro2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoov-io%2Fmetro2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoov-io%2Fmetro2/lists"}