Here's how to run the HEALORA Doctor Portal application and access it in Chrome:
Before starting, make sure you have:
Updated the database credentials in backend/.env file:
DB_HOST=localhost
DB_USER=your_mysql_username
DB_PASSWORD=your_mysql_password
DB_NAME=healora_dbInitialize the database:
cd backend
npm install
node database/init-db.jsThis will create the database, tables, and add sample data.
Start both servers (from the project root):
npm install
npm run dev:allThis command uses concurrently to start both the frontend and backend servers simultaneously.
Alternatively, you can start them separately:
cd backend && npm run devnpm run devOpen Chrome and navigate to:
http://localhost:3000You should see the login screen. Use the demo credentials:
john.smith@healora.compassword123The backend API is running on:
http://localhost:5000Once logged in, you'll have access to the doctor dashboard with patient management, prescriptions, and other medical features.
Please make sure to add the following environment variables to your project:
Perfect! Now that you've added all the required environment variables to your Vercel project, your Doctor Portal application is properly configured for deployment.
Here's what these environment variables are used for:
JWT_SECRET - Used for signing and verifying JSON Web Tokens for authenticationJWT_EXPIRE - Sets the expiration time for JWT tokens (e.g., "24h")DB_HOST, DB_USER, DB_PASSWORD, DB_NAME - Database connection detailsPORT - The port on which the backend server will runNEXT_PUBLIC_API_URL - The URL for the frontend to connect to the backend APIWhen running locally, the application will use these environment variables from your .env files. The frontend will connect to the backend API using the NEXT_PUBLIC_API_URL value.
Since you've added these variables to your Vercel project:
For the backend, you'll need to deploy it separately to a service like:
Remember to update the NEXT_PUBLIC_API_URL in your Vercel project settings to point to your deployed backend URL once it's live.
For the database, you'll need a MySQL database service like:
After setting up your database, update the database environment variables in your backend deployment to connect to your production database.
Is there anything specific about the deployment or running the application that you'd like me to explain further?
PS C:\Users\vinay\Downloads\two> npm run dev:all
healora-doctor-portal@0.1.0 dev:all
concurrently "npm run dev" "npm run backend"
[0]
[0] > healora-doctor-portal@0.1.0 dev
[0] > next dev
[0]
[1]
[1] > healora-doctor-portal@0.1.0 backend
[1] > cd backend && npm run dev
[1]
[1]
[1] > doctor-portal-backend@1.0.0 dev
[1] > nodemon server.js
[1]
[1] [nodemon] 3.1.9
[1] [nodemon] to restart at any time, enter rs
[1] [nodemon] watching path(s): .
[1] [nodemon] watching extensions: js,mjs,cjs,json
[1] [nodemon] starting node server.js
[0] ▲ Next.js 14.0.3
[0] - Local: http://localhost:3000
[0] - Environments: .env.local, .env
[0]
[0]
[0] We detected TypeScript in your project and created a tsconfig.json file for you.
[1] Created directory: uploads
[1] Created directory: uploads/doctors
[1] Created directory: uploads/patients
[1] Created directory: uploads/reports
[1] Database connection established successfully
[1] Server running on port 5000
[1] API is available at http://localhost:5000/api
[0] ⚠ Attempted to load @next/swc-win32-x64-msvc, but an error occurred: \?\C:\Users\vinay\Downloads\two\node_modules@next\swc-win32-x64-msvc\next-swc.win32-x64-msvc.node is not a valid Win32 application.
[0] \?\C:\Users\vinay\Downloads\two\node_modules@next\swc-win32-x64-msvc\next-swc.win32-x64-msvc.node
[0] ⚠ Found lockfile missing swc dependencies, patching...
[0] ⨯ Failed to patch lockfile, please try uninstalling and reinstalling next in this workspace
[0] TypeError: fetch failed
[0] at node:internal/deps/undici/undici:13185:13
[0] at processTicksAndRejections (node:internal/process/task_queues:95:5)
[0] at runNextTicks (node:internal/process/task_queues:64:3)
[0] at process.processImmediate (node:internal/timers:454:9)
[0] at async fetchPkgInfo (C:\Users\vinay\Downloads\two\node_modules\next\dist\lib\patch-incorrect-lockfile.js:64:17)
[0] at async Promise.all (index 4)
[0] at async patchIncorrectLockfile (C:\Users\vinay\Downloads\two\node_modules\next\dist\lib\patch-incorrect-lockfile.js:160:26) {
[0] [cause]: ConnectTimeoutError: Connect Timeout Error (attempted addresses: 2606:4700:83b3:80e2:e4fe:842:6810:23:443, 104.16.27.34:443)
[0] at onConnectTimeout (node:internal/deps/undici/undici:2331:28)
[0] at node:internal/deps/undici/undici:2283:50
[0] at Immediate._onImmediate (node:internal/deps/undici/undici:2313:37)
[0] at process.processImmediate (node:internal/timers:483:21) {
[0] code: 'UND_ERR_CONNECT_TIMEOUT'
[0] }
[0] }
[0] ⨯ Failed to load SWC binary for win32/x64, see more info here: https://nextjs.org/docs/messages/failed-loading-swc
[0]
[0] npm run dev exited with code 0
PS C:\Users\vinay\Downloads\two\backend> npm run dev
doctor-portal-backend@1.0.0 dev
nodemon server.js
[nodemon] 3.1.9
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,cjs,json
[nodemon] starting node server.js
Database connection established successfully
Uncaught Exception: listen EADDRINUSE: address already in use :::5000
Error: listen EADDRINUSE: address already in use :::5000
at Server.setupListenHandle [as _listen2] (node:net:1904:16)
at listenInCluster (node:net:1961:12)
at Server.listen (node:net:2063:7)
at Function.listen (C:\Users\vinay\Downloads\two\backend\node_modules\express\lib\application.js:635:24)
at startServer (C:\Users\vinay\Downloads\two\backend\server.js:94:9)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[nodemon] app crashed - waiting for file changes before starting...
please verify the code by running it has error and modify the code