An open API service indexing awesome lists of open source software.

https://github.com/joao1barbosa/csv-operator-distribution

Full-stack application for assigning clients to operators with CSV import and export.
https://github.com/joao1barbosa/csv-operator-distribution

csv docker mysql nestjs nextjs typescript

Last synced: 8 days ago
JSON representation

Full-stack application for assigning clients to operators with CSV import and export.

Awesome Lists containing this project

README

          

# ๐Ÿ“Š CSV Operator Distribution

> A full-stack technical challenge: bulk-register clients from a CSV upload and distribute them across operators โ€” with CSV import/export and a per-layer tested NestJS API. TypeScript end to end.

## ๐Ÿ“‹ Overview

Solution to a full-stack technical challenge. The app lets you view operators and the
clients assigned to them, register clients in bulk by uploading a CSV (each client is
distributed to an operator on upload), and export all clients back to CSV.

- View operators and their assigned clients.
- Upload a CSV to register clients immediately, distributed across operators (round-robin).
- Export all clients to a CSV file.
- Redistribute existing clients across operators.

## ๐Ÿš€ Tech Stack

| Layer | Technology |
|-------|-----------|
| **Frontend** | TypeScript, React, Next.js, React Query, React Hook Form, Zod, Tailwind, shadcn/ui |
| **Backend** | NestJS, Multer, csv-parser, fast-csv |
| **ORM / DB** | Prisma ยท MySQL |
| **Testing** | Jest |
| **Runtime** | Docker / Docker Compose |

## ๐Ÿ“ท Demo


Dashboard

CSV upload

Responsive layout

Database schema:

Database schema

## ๐Ÿ— Architecture

A NestJS API with clear layering โ€” **controllers โ†’ services โ†’ repositories**, with DTOs,
entities, and validators per module (`clients`, `operators`) โ€” behind a Next.js frontend.
CSV parsing is streamed; client distribution is a round-robin over the available operators.

## ๐Ÿงช Testing

Unit tests with Jest, **one spec per layer** (service, controller, validator):

```bash
cd backend && yarn test
```

## ๐Ÿ”ง How to Run Locally

**Prerequisites:** Docker + Docker Compose V2.

The `.env.example` ships pre-filled (this is not a production app) โ€” just copy it to `.env`.

```bash
docker compose up --build -d
```

## ๐Ÿ“ก API Reference

**Operators** โ€” `POST /operators`, `GET /operators`, `GET /operators/:id`,
`PATCH /operators/:id`, `DELETE /operators/:id`.

**Clients** โ€” `GET /clients`, `GET /clients/:id`, `POST /clients`, `PATCH /clients/:id`,
`DELETE /clients/:id`, `POST /clients/upload` (CSV, form-data `file`),
`GET /clients/download` (CSV export), `GET /clients/redistribute`.

## ๐Ÿ‘ค Author

**Joรฃo Barbosa** โ€” Software Engineer (backend / platform).
[LinkedIn](https://www.linkedin.com/in/joao1barbosa/) ยท [GitHub](https://github.com/joao1barbosa)