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

ComponentTechnologyPurpose
FrontendNext.js (React)Full-stack web application framework
UI stylingTailwind CSSResponsive layouts and frosted-glass effects
AuthenticationNextAuth.js with Google OAuthSecure sign-in with a Google account
AI engineGoogle GeminiConversation and structured JSON extraction
PDF processingpdf-libReads and fills PDF form fields
DatabasePostgreSQL on NeonServerless cloud database
ORMPrismaBackend-to-database layer
BackendNext.js API routesServerless functions for the app's logic
HostingNetlifyProduction deployment
PaymentsPayHereFull 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. 1

    Install packages

    Run npm install in the project folder.

  2. 2

    Create your environment file

    Add a .env.local file in the project root using the variables in the table below.

  3. 3

    Prepare the database

    Run npx prisma generate, then npx prisma migrate dev.

  4. 4

    Start the app

    Run npm run dev and open http://localhost:3000.

npm install
npx prisma generate
npx prisma migrate dev
npm run dev

For production, npm run build runs prisma generate and then builds the app. Start it with npm start.

Environment variables

VariableRequiredWhat it does
DATABASE_URLYesPostgreSQL connection string.
NEXTAUTH_URLYesThe public address of your site.
NEXTAUTH_SECRETYesSecret used to sign sessions.
GOOGLE_CLIENT_IDYesGoogle OAuth client ID.
GOOGLE_CLIENT_SECRETYesGoogle OAuth client secret.
GEMINI_API_KEYYesKey for the Gemini API. Without it the chat returns a server configuration error.
GEMINI_MODELNoChooses the Gemini model without changing code.
ADMIN_EMAILSNoEmails allowed to open the admin panel.
PAYHERE_MERCHANT_IDFor billingPayHere merchant ID.
PAYHERE_MERCHANT_SECRETFor billingPayHere merchant secret.
PAYHERE_MODENolive for real payments. Anything else uses the PayHere sandbox.
PAYHERE_NOTIFY_URLFor billingAddress PayHere calls to confirm a payment.
PAYHERE_PLAN_AMOUNTNoFull House price. Defaults to 3000.
PAYHERE_PLAN_CURRENCYNoCurrency for the price above.
NEXT_PUBLIC_PLAN_PRICE_LABELNoPrice 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.

SettingDefaultMeaning
FREE_CHAT_LIMIT1Chats a Free user can start, in total.
FREE_MESSAGE_LIMIT10Messages a Free user can send in that chat.