This project combines a React frontend with a Node.js backend in a single repo. It supports Splitwise‑type shared expenses and personal accounts. The backend exposes both REST and GraphQL endpoints for authentication, participants, groups, expenses, reports, and analytics. Ready for local development and Vercel deployment.
- React + Vite frontend with reusable UI components and reports module
- Node.js (Express) backend with Apollo GraphQL and REST routes
- GraphQL schema for Splitwise‑style groups, participants, expenses, splits
- REST routes for auth, participants, groups, expenses, reports, analytics (stubs)
- Environment‑based configuration via
.env - CSV and print‑to‑PDF export on the frontend
- Vercel config for serverless API + static frontend build
.
├─ server/ # Node.js backend (TypeScript)
│ ├─ src/
│ │ ├─ routes/ # REST routes
│ │ └─ schema/ # GraphQL typeDefs and resolvers
│ ├─ package.json
│ └─ tsconfig.json
├─ src/ # React frontend (Vite)
└─ package.json # Root scripts to run both client and server
- Node.js 18+
- npm 9+
npm install
npm --prefix server installCreate a .env file at the repository root (and/or configure on Vercel):
PORT=4000
NODE_ENV=development
DATABASE_URL=postgres://USER:PASSWORD@HOST:PORT/DB_NAME
JWT_SECRET=change-me
VITE_API_URL=http://localhost:4000
Notes:
PORTcontrols backend server port.VITE_API_URLis available to the frontend at build time.- On Vercel, set these in Project Settings → Environment Variables.
Run client and server together:
npm run dev- Frontend: http://localhost:3000
- Backend REST: http://localhost:4000/api
- GraphQL: http://localhost:4000/graphql
npm run build- Frontend output:
dist/ - Backend output:
server/dist/
- Push this repo to GitHub.
- Import the project in Vercel.
- Add env vars in Vercel Project Settings (see above).
- Vercel uses
vercel.jsonto build:@vercel/nodeforserver/src/index.ts@vercel/static-buildfor the React app (output indist)
POST /api/auth/login,POST /api/auth/registerGET/POST /api/participantsGET/POST /api/groupsGET/POST /api/expensesGET /api/reports/summaryGET /api/analytics/trends
- Endpoint:
/graphql - Schema highlights:
- Types:
Participant,Group,Expense,ExpenseSplit - Queries:
participants,groups,expenses,reportSummary - Mutations:
createParticipant,createGroup,addParticipantToGroup,createExpense,settleSplit
- Types:
- The backend currently uses in‑memory data for simplicity; replace with a real DB using
DATABASE_URL. - Add authentication middleware (JWT) for protected routes.
- Extend schema/resolvers and REST routes as your data model evolves.
- The frontend
Reportspage demonstrates multiple report styles and CSV/PDF export.