[!NOTE] A react, test-less, dev version was made here, before the request for a Svelte version.
This full-stack application allows you to upload a CSV file, store the data in a PostgreSQL database, and view/search the results in a SvelteKit UI. It includes:
backend/
→ Node+Express+Prisma code for CSV upload & data routes.frontend/
→ SvelteKit (TypeScript) for the UI, using Tailwind + shadcn-svelte components.docker-compose.yml
→ Orchestrates containers for Postgres, backend, and frontend.Clone this repo.
Backend
```bash
cd backend
npm install
npx prisma migrate dev npm run dev
Frontend ```bash cd frontend npm install npm run dev
Usage
Visit http://localhost:5173
Upload CSV → Data is stored in Postgres → You can view and search results
cd backend
npm run test
# Runs Jest + Supertest
cd frontend
npm run test
# Runs Vitest + @testing-library
To spin up Postgres, backend, and frontend containers:
docker-compose build
docker-compose up
localhost:5432
localhost:3000
localhost:4173
my-csv-app/
├── docker-compose.yml
├── backend/
│ ├── Dockerfile
│ ├── package.json
│ ├── prisma/
│ │ └── schema.prisma
│ ├── src/
│ │ ├── server.ts
│ │ ├── routes/
│ │ │ ├── csvUpload.ts
│ │ │ ├── dataRoutes.ts
│ │ ├── tests/
│ │ │ ├── csvUpload.test.ts
│ │ │ ├── dataRoutes.test.ts
│ ├── tsconfig.json
│ ├── .env (if applicable)
└── frontend/
├── Dockerfile
├── package.json
├── svelte.config.js
├── vite.config.ts
├── src/
│ ├── routes/
│ │ ├── +layout.svelte
│ │ ├── +page.svelte
│ │ ├── page.test.ts
│ ├── lib/
│ │ ├── components/
│ │ │ ├── ui/
│ │ │ │ ├── button/
│ │ │ │ │ ├── button.svelte
│ │ │ │ ├── input/
│ │ │ │ │ ├── input.svelte
│ │ │ │ │ ├── text-input.svelte
│ │ │ │ ├── table/
│ │ │ │ │ ├── table.svelte
│ ├── tests/
│ │ ├── text-input.test.ts
│ │ ├── page.test.ts
Here are potential improvements to increase reliability and usability:
Improve CSV Validation
Ensure CSV files have correct headers and valid data before processing.
Comprehensive Unit Testing
Expand frontend & backend test coverage for edge cases.
Robust Error Handling
Display better error messages when CSV uploads fail or API calls break.
Enhanced Pagination & Sorting
Allow sorting by name, email, etc., and load more than just next/prev pages.
Production Deployment
Deploy via Nginx + Docker or Vercel (for frontend) and Railway/Fly.io (for backend).