Giter Site home page Giter Site logo

customer-statement-processor's Introduction

A screenshot of the application showing some processed customer statements with 4 identified errors.

Customer Statement Processor

Customer Statement Processor is a Next.js application built using the new Next.js app/ router. This project served as an experiment for me to compare it to the traditional pages/ router. I also took the opportunity to try out Vitest for unit tests and Playwright for end-to-end tests.

It utilizes both client and server components, and it has the currently still experimental server actions enabled.

The project contains some sample files in src/tests/fixtures with records in CSV and XML formats. These files can be uploaded in the front-end and are then parsed and validated on the server. If any errors are identified, then the records with errors are displayed in a HTML report in the front-end.

Record parsing and validation

All code regarding record processing (parsing and validation) can be found in src/record-parsing.

The xml2js library helps with turning XML into JavaScript objects. The csv-parser library helps with turning CSV data into JavaScript objects.

zod is being used to do runtime validation of various shapes of data, such as the data being sent from the client to the server, and the contents of the processed XML and CSV files.

Because JavaScript is not typically the right tool to handle accurate money calculations, the library big.js is used to do precision decimal number comparisons.

Running the project

The project was built using Node.js version 19.9.0. If you have trouble with any of these steps, please try again with that version of Node.js.

First, install the dependencies:

npm install

Them, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev

Open http://localhost:3000 with your browser to see the result.

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

Tests

Unit tests

The project has tests in the src/tests directory.

To run the tests, run:

npm test

End-to-end tests

To run the tests in headless mode, run:

npm run e2e

And to open the browser for the end-to-end tests, run:

npm run e2e:ui

customer-statement-processor's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.