This repository provides a Next.js web app for collecting patient and insurance data, then sending that data to the Develop Health benefit-verification endpoint on the server side. It uses Tailwind CSS for styling and Formidable to handle file uploads (front/back of insurance cards). By calling the external API on the server, we ensure that sensitive tokens and credentials are never exposed in client-side code.
- Features
- Tech Stack
- Project Structure
- Setup & Installation
- Usage
- API Route (
/api/submit-bv
) - Customization
- License
- Next.js 13 project with server-side calls to
https://api.develophealth.io/benefit-verification
. - Tailwind CSS integration for utility-based styling.
- Formidable used in a Next.js API Route to parse
multipart/form-data
and file uploads. - Basic form capturing:
- Patient info (name, DOB, phone, address, etc.)
- Basic health info (height, weight, T2DM status)
- Insurance info (provider, group #, member ID, Rx BIN, etc.)
- File Upload support (front and back of insurance card) converted to base64 strings on the server side.
- Password + Terms & Privacy checkboxes for demonstration (not actually creating user accounts in this app).
- Next.js: React-based framework for server-rendered or hybrid web apps.
- React: The underlying library for building the UI.
- Tailwind CSS: Utility-first CSS framework.
- Formidable: Node.js module for parsing form data, especially file uploads.
- Node Fetch (built-in in Next.js): Used to call external APIs from our server route.
A simplified view of the most relevant files:
insurance-checker-example/
│
├─ pages/
│ ├─ index.js # The main form page
│ └─ api/
│ └─ submit-bv.js # The server route for handling form submissions
│
├─ styles/
│ └─ globals.css # Where Tailwind imports (@tailwind base, etc.) live
│
├─ tailwind.config.js
├─ postcss.config.js
├─ package.json
└─ README.md # This file
-
Clone the repository:
git clone https://github.com/develop-health/insurance-checker-example.git cd insurance-checker-example
-
Install dependencies:
npm install # or yarn
-
Configure environment variables (optional):
- If you want to store the Develop Health API token in an
.env.local
file, do something like:NEXT_PUBLIC_API_BASE_URL=https://api.develophealth.io DEVHEALTH_BENEFIT_VERIFICATION_TOKEN=some-secret-token
- Then, in
pages/api/submit-bv.js
, reference it as:const token = process.env.DEVHEALTH_BENEFIT_VERIFICATION_TOKEN;
- If you want to store the Develop Health API token in an
-
Run the development server:
npm run dev
Then open http://localhost:3000 in your browser.
- Open the app in your browser at http://localhost:3000.
- Fill out the patient/insurance form.
- Attach (optional) front/back images of the insurance card.
- Submit. The form data (and images) is posted to
/api/submit-bv
. - The server route:
- Parses the
multipart/form-data
(including images). - Builds a JSON payload with the base64-encoded images.
- Submits the final payload to
https://api.develophealth.io/benefit-verification
.
- Parses the
Check your browser’s dev tools or the server logs to see success/failure responses.
- Location:
pages/api/submit-bv.js
- Method:
POST
only - Logic:
- Disables Next.js body parsing (
config.api.bodyParser = false
). - Uses Formidable to parse files + fields (named import
IncomingForm
). - Converts images to base64 strings.
- Builds the JSON object:
{ drugs: [...], diagnoses: [...], insurance: [...], patient: { ... }, provider: { ... }, entity: { ... }, ... }
- Calls
https://api.develophealth.io/benefit-verification
with an Authorization header.
- Disables Next.js body parsing (
You can edit or extend the logic to match your own data model or environment variables.
- Add real logic for storing the user’s password or creating an account. Currently, the
accountPassword
is only captured in the form and never used for anything. - Extend the
payload
to add or remove certain fields (e.g. Type 2 diabetes code, internal references, or additional drug info). - Tailwind classes can be customized or extended in
tailwind.config.js
. - Change the default GLP-1 drug list, dosage, or quantity.
- Move the
Authorization: "Bearer <token>"
string to an environment variable for safety.
This project is provided “as is” without warranty of any kind. Please see LICENSE (if you have a license file) or otherwise assume it is private/personal code not intended for public distribution, unless you specify an open-source license.
Enjoy building your GLP-1 benefit verification flow with Next.js and Tailwind!