CAREFINDER is a web application designed to help users find, export, and share hospital information within Nigeria. It aims to address the challenge of accessing healthcare by providing an easy-to-use tool for locating hospitals based on user input or nearby cities.
carefinder/ ├── backend/ │ ├── app.js | | │ ├── db.js | | │ └── routes/ | | │ └── hospitals.js ├── src/ │ ├── components/ | | | │ │ ├── HospitalList.tsx
│ │ ├── HospitalForm.tsx
│ │ ├── SearchBar.tsx
│ │ └── MarkdownEditor.tsx
│ ├── pages/
│ │ ├── api/
│ │ │ └── hospitals.ts
│ │ ├── auth/
│ │ │ ├── login.tsx
│ │ │ └── register.tsx
│ │ ├── hospitals/
│ │ │ ├── index.tsx
│ │ │ └── [id].tsx
│ │ ├── index.tsx
│ │ └── _app.tsx
│ ├── services/
│ │ ├── api.ts
│ │ └── auth.ts
│ ├── styles/
│ │ └── globals.css
│ ├── utils/
│ │ └── validation.ts
│ └── types/
│ └── toast-ui-react-editor.d.ts
├── tests/
│ ├── api.test.ts
│ ├── validation.test.ts
│ ├── HospitalList.test.tsx
│ ├── MarkdownEditor.test.tsx
│ └── SearchBar.test.tsx
├── .eslintrc.js
├── .prettierrc
├── tsconfig.json
└── package.json
- Node.js
- npm (or yarn)
- PostgreSQL (or MySQL)
-
Clone the repository:
- git clone <repository_url>
- cd carefinder
-
Install dependencies:
- npm install
-
Set up the database:
- Ensure PostgreSQL (or MySQL) is installed and running. Create a database for the project.
-
Configure environment variables:
-
Create a
.env
file in the root of the project and add the following:DATABASE_URL=postgres://user:password@localhost:5432/carefinder JWT_SECRET=your_jwt_secret
-
-
Run database migration:
- npx prisma migration dev --name init
-
Start the backend server: npm run dev
-
Start the frontend development server:
- cd src
- npm run dev
-
Register:
- Go to /auth/register to create an admin account.
-
Login:
- Go to /auth/login to log in with your admin credentials.
-
Search Hospitals:
- Use the search bar on the home page or the hospitals page to find hospitals by location or city.
-
Add Hospital:
- Admin users can add new hospitals by navigating to the hospital form page and filling out the details.
-
Edit Hospital:
- Admin users can edit existing hospital details by clicking on a hospital from the list and modifying the details.
-
Delete Hospital:
- Admin users can delete a hospital from the hospital details page.
Export Hospitals:
Use the export button on the hospitals page to download a CSV file of the hospital list.
Share Hospitals:
Share the list of hospitals via email or generate a shareable link from the hospitals page.
Testing
To run the tests, use the following command:
- npm test
tests/api.test.ts: Tests for API endpoints.
tests/validation.test.ts: Tests for validation functions.
tests/HospitalList.test.tsx: Component tests for HospitalList.
tests/MarkdownEditor.test.tsx: Component tests for MarkdownEditor.
tests/SearchBar.test.tsx: Component tests for SearchBar.
Linting To run the linter, use the following command: - npm run lint
To format the code, use the following command: - npm run format
To build the project for prodection, use the following command: - npm run build
To start the production server, use the following command: - npm start
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes and push to your fork.
- Create a pull request to the main repository.
This project is licensed under the MIT License. See the LICENSE file for details.
It is a Next.js project bootstrapped with create-next-app
.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx
. The page auto-updates as you edit the file.
This project uses next/font
to automatically optimize and load Inter, a custom Google Font.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.