How to build a Nacha compliant ACH file in Nodejs and Typescript

Getting started

Building ACH files is no small task. The sheer number of fields required is enough to make your head spin. This tutorial will use our Node SDK and a CSV of mock employee payroll data to generate a Nacha compliant PPD ACH file.

There are three steps to follow in creating a Nacha compliant PPD ACH file using the Moov ACH project. Outside of this tutorial’s scope is how you will take your completed file and give it to your bank for processing.

Build the file

  1. Publish to the Moov ACH API
  2. Request the completed file from the Moov ACH API

This tutorial is for people with a robust understanding of ACH file management and needs to upgrade their parser or don’t want to reinvent one from scratch. If you’re looking for a full-stack solution to sending ACH payments and more, you may want to look at Paygate.

Anatomy of an ACH file

Before we dive in, let’s talk about the structure of an ACH file. Every line of an ACH file is called a record, and records have all sorts of rules you don’t need to know. So, we won’t get into them here.

You need to know that you only need one File Header Record/Control Record pair. However, there can be multiple batches in a single file. For the sake of this tutorial, we’ll only build a single batch.

* File Header Record
    * Batch Header Record
        * PPD Entry Detail Records
    * Batch Control Record
    * Batch2 Header Record
        * PPD Entry Detail Records
    * Batch2 Control Record
* File Control Record

You may notice in the example above that header records and control records are similar to how HTML tags cordon off different file sections. Most of the critical information for a file is in the PPD Entry Detail Record, and there may be multiple records in a single batch.

If you’d like a detailed breakdown of what an ACH file entails, check out our ACH file structure doc. For this tutorial purpose, we’ll use the default values for many of the fields in your ACH file.


Before we get started you’ll need to have Docker and Make installed. Now all you need to do is star, fork, and clone this project. Next you’ll want to navigate to the project folder and run:


Then run:

docker-compose up

This builds the ACH API as well as create an ACH file. Now that you’ve created your first ACH file you can take a look at it here:


What’s next?

By running these two commands, you have built an API that takes in data and builds a Nacha compliant ACH file. In this example, you used hard-coded data, which you can view in the payroll.ts file of the sample project.

The next steps to using this in your day-to-day operations would be to read payroll data from a CSV file and build multiple “Entry Detail Records” into this file. Once the file gets built, you can upload it to your ODFI’s FTP service.

Next up
August recap of Moov community working groups
Education • 4m