A single-page application for calculating CPR deadlines with a flowchart-based date calculator using React and Vercel serverless functions.
- React - Frontend framework (Vite)
- Vercel Serverless Functions - Backend API
- Node.js - Runtime environment
npm i -g vercelcd frontend
npm install
cd ..Start the development server:
vercel devOr use the npm script:
npm run dev:localThis will:
- Start Vercel's local dev server
- Serve your React frontend
- Run your serverless functions at
/api/calculate-deadline - Usually runs on
http://localhost:3000
First time setup: When you run vercel dev for the first time, you can skip linking to a Vercel project for local development.
If you just want to test the UI (API calls will fail):
cd frontend
npm run devRuns on http://localhost:5173
cpr-deadline-tracker/
├── api/
│ ├── calculate-deadline.js # Serverless function for deadline calculation
│ └── health.js # Health check endpoint
├── utils/
│ └── dateCalculations.js # Date calculation logic
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # React components
│ │ ├── utils/ # Frontend utilities (formatting)
│ │ ├── App.jsx
│ │ └── main.jsx
│ ├── index.html
│ ├── vite.config.js
│ └── package.json
├── vercel.json # Vercel deployment configuration
├── package.json
└── README.md
GET /api/health- Health checkPOST /api/calculate-deadline- Calculate deadline based on flowchart logic
- Install Vercel CLI (if not already installed):
npm i -g vercel- Deploy:
vercelOr for production:
vercel --prod- Frontend: Built with Vite and served as static files
- Backend: Serverless functions handle API requests
- Routing: Vercel rewrites handle API routes and SPA routing
- ✅ Flowchart-based deadline calculator
- ✅ Conditional question flow
- ✅ Real-time deadline calculation via serverless functions
- ✅ Backend API for calculations
- ✅ Modern, responsive UI
- ✅ Vercel-ready deployment
- Add database for storing calculation history (if needed)
- Add authentication (if user accounts are needed)
- Add saved calculations feature
- Export/print functionality