A modern, browser-based tool for validating, editing, and ensuring compliance of CSV data against predefined or custom JSON schemas. Built with Next.js, TypeScript, and Shadcn/ui.
- CSV Handling: Upload, edit (with code editor), save, and download CSV files.
- Schema Management: Select predefined schemas or upload custom JSON schemas.
- Live Validation: Real-time validation using Ajv, with errors/warnings shown per row/value.
- Detailed Results: Errors and warnings are clearly displayed, with row numbers and schema paths.
- Save & Download: Download your edited CSV at any time.
- Auto Re-validation: CSV is automatically re-validated shortly after edits are made in the editor.
- Human-Readable Schema Docs: View a Markdown-rendered, human-friendly version of the selected schema.
- Responsive UI: Smoothly resizing panels with light/dark mode support.
- Automated Checks: Robust CI/CD pipeline with linting, testing (unit & E2E), and security scans.
Prerequisites:
- Node.js (v18+ recommended)
- pnpm (or npm/yarn)
Installation & Running Locally:
# 1. Clone the repository
git clone https://github.com/FabienDostieIT/CSV_Data_Validator.git
cd CSV_Data_Validator
# 2. Install dependencies
pnpm install
# 3. Run the development server
pnpm dev
# 4. Open http://localhost:3000 in your browser- Upload/Edit CSV: Provide your CSV via drag-and-drop or file selection. Edit directly in the editor.
- Select/Upload Schema: Choose a schema from the dropdown or upload your own.
- Validate: Click "Validate Data" to see errors/warnings.
- View Docs: Toggle the schema panel to view its Markdown documentation.
- Save/Download: Save changes to trigger re-validation or download the edited CSV.
- Location: Predefined schemas are located in the
schemas/v1/directory. - Adding New Schemas: To add your own schema for local validation, simply place your
.jsonschema file inside theschemas/v1/directory. The application will automatically pick it up and list it in the schema selection dropdown after a refresh. - Schema Naming: Ensure your schema file has a
.jsonextension.
This project uses a layered approach for quality assurance:
Automated Checks Workflow (Click to Expand)
- Pre-Commit (
lint-staged):- Purpose: Auto-formats and fixes basic lint errors on staged files.
- Benefit: Ensures clean commit history; fast feedback.
- Pre-Push (
husky):- Purpose: Local safeguard checking lint, types (
tsc --noEmit), and unit tests (pnpm test:unit) on the entire code being pushed. - Benefit: Prevents pushing broken code; catches issues missed by pre-commit.
- Purpose: Local safeguard checking lint, types (
- CI (
GitHub Actions): * Purpose: Definitive quality gate (lint, all tests, build, security scans) in a clean environment. * Benefit: Ensures merged code meets all standards; catches anything missed locally.
Manual Checks:
# Lint check
pnpm lint
# Format check (Prettier)
pnpm format --check
# Run unit tests
pnpm test:unit
# Run all tests (unit + integration)
pnpm test
# Run E2E tests (Playwright)
pnpm e2e- CI (
.github/workflows/CI.yml): Runs automatically on pushes/PRs tomainanddevelop. Includes lint, format check, full tests (pnpm test), build, and E2E tests. - CodeQL (
.github/workflows/codeql-analysis.yml): Performs security analysis. - Vercel Deployment (
.github/workflows/vercel.yml): Deploys the application to Vercel from themainbranch usingBetaHuhn/deploy-to-vercel-action@v1. - Preview Deployments: Automatically creates preview deployments for pull requests with PR comments showing deployment URLs.
- Vercel Configuration: Uses
vercel.jsonto define build settings and other configuration. - 2025 Compatibility: All workflows are updated to use the latest GitHub Actions (v4+) and include the 2025-compatible cache keys that will remain functional after the April 2025 GitHub cache service changes.
To set up deployments to Vercel, you need to add the following secrets to your GitHub repository:
VERCEL_TOKEN: Your Vercel API tokenVERCEL_PROJECT_ID: Your Vercel project IDVERCEL_ORG_ID: Your Vercel organization IDGITHUB_TOKEN: Automatically provided by GitHub Actions
You can obtain the Vercel values from the Vercel dashboard or by running:
vercel linkThese secrets are required for both the production deployment workflow (vercel.yml) and the preview deployments in the CI workflow.
This project includes tools to test GitHub Actions workflows locally before pushing changes to GitHub:
-
Install act if you haven't already:
# Linux/macOS with Homebrew brew install act # Or with npm npm install -g @nektos/act
-
Use the provided script to securely test workflows:
# Source the script to load the function source act-secrets.sh # Test the Vercel deployment workflow run_act_workflow .github/workflows/vercel.yml push # Test the CI workflow with PR preview run_act_workflow .github/workflows/CI.yml pull_request
The script will prompt for your GitHub and Vercel credentials, which are never stored on disk and only kept in memory during the test.
You'll need to create:
- A GitHub Personal Access Token with
reposcope - Vercel credentials as mentioned in the deployment section
- Framework: Next.js 15+ (React 19)
- Language: TypeScript 5+
- UI: Shadcn/ui, Radix UI, Tailwind CSS
- Validation: Ajv
- CSV Parsing: PapaParse
- Editor: Monaco Editor
- Testing: Jest (Unit), Playwright (E2E)
- CI/CD: GitHub Actions, Husky, lint-staged
Contributions, issues, and pull requests are welcome! Please ensure all checks (lint, tests) pass before submitting a PR.
MIT © 2025 Fabien Dostie, [F]it
Refer to SECURITY.md for vulnerability reporting details.