Configuration
The technology behind Doctor Bank and how to run your own copy.
This page is for developers and project reviewers. If you only want to fill in a form, start with the Quickstart instead.
Technology stack
| Component | Technology | Purpose |
|---|---|---|
| Frontend | Next.js (React) | Full-stack web application framework |
| UI styling | Tailwind CSS | Responsive layouts and frosted-glass effects |
| Authentication | NextAuth.js with Google OAuth | Secure sign-in with a Google account |
| AI engine | Google Gemini | Conversation and structured JSON extraction |
| PDF processing | pdf-lib | Reads and fills PDF form fields |
| Database | PostgreSQL on Neon | Serverless cloud database |
| ORM | Prisma | Backend-to-database layer |
| Backend | Next.js API routes | Serverless functions for the app's logic |
| Hosting | Netlify | Production deployment |
| Payments | PayHere | Full House subscription checkout |
Requirements
- Node.js and npm.
- A PostgreSQL database. A free Neon database works for development.
- A Google Cloud OAuth client for sign-in.
- A Google Gemini API key.
Set up your copy
- 1
Install packages
Run
npm installin the project folder. - 2
Create your environment file
Add a
.env.localfile in the project root using the variables in the table below. - 3
Prepare the database
Run
npx prisma generate, thennpx prisma migrate dev. - 4
Start the app
Run
npm run devand openhttp://localhost:3000.
npm install
npx prisma generate
npx prisma migrate dev
npm run devFor production, npm run build runs prisma generate and then builds the app. Start it with npm start.
Environment variables
| Variable | Required | What it does |
|---|---|---|
DATABASE_URL | Yes | PostgreSQL connection string. |
NEXTAUTH_URL | Yes | The public address of your site. |
NEXTAUTH_SECRET | Yes | Secret used to sign sessions. |
GOOGLE_CLIENT_ID | Yes | Google OAuth client ID. |
GOOGLE_CLIENT_SECRET | Yes | Google OAuth client secret. |
GEMINI_API_KEY | Yes | Key for the Gemini API. Without it the chat returns a server configuration error. |
GEMINI_MODEL | No | Chooses the Gemini model without changing code. |
ADMIN_EMAILS | No | Emails allowed to open the admin panel. |
PAYHERE_MERCHANT_ID | For billing | PayHere merchant ID. |
PAYHERE_MERCHANT_SECRET | For billing | PayHere merchant secret. |
PAYHERE_MODE | No | live for real payments. Anything else uses the PayHere sandbox. |
PAYHERE_NOTIFY_URL | For billing | Address PayHere calls to confirm a payment. |
PAYHERE_PLAN_AMOUNT | No | Full House price. Defaults to 3000. |
PAYHERE_PLAN_CURRENCY | No | Currency for the price above. |
NEXT_PUBLIC_PLAN_PRICE_LABEL | No | Price text shown on the site. Defaults to “LKR 3,000”. Keep it in step with the amount above. |
Google sign-in
In Google Cloud, create an OAuth client and add http://localhost:3000/api/auth/callback/google as an authorized redirect address. When you deploy, add the same path on your live domain.
Protected areas
These routes require sign-in: /chat, /dashboard, and /admin. The landing page, login page, and this Academy are public.
Plan limits
Free plan limits live in one file, lib/plans.ts, so the server and the interface always show the same numbers.
| Setting | Default | Meaning |
|---|---|---|
FREE_CHAT_LIMIT | 1 | Chats a Free user can start, in total. |
FREE_MESSAGE_LIMIT | 10 | Messages a Free user can send in that chat. |