- Overview
- Features
- Technical Stack
- Directory Structure
- API Routes
- Database Configuration
- Email Configuration
- Running the App Locally
- Conclusion
The Med Portal Web App is a comprehensive platform designed for doctors to manage their clients, programs, and appointments. It features a robust backend built with Node.js, PostgreSQL, and ES6 imports, along with a responsive frontend using EJS templates and partials. The app includes various API routes for user authentication, client management, and program enrollment. It also integrates with SMTP Gmail services for email notifications.
- Doctor Sign In: Doctors can log in using their credentials.
- Doctor Registration: New doctors can register for an account.
- Forgot Password: Doctors can reset their passwords if forgotten.
- Verify Account: Doctors can verify their accounts.
- Delete Doctor Account: Doctors can delete their own accounts.
- Delete Client Account: Doctors can delete client accounts.
- Client Registration: Doctors can register new clients.
- Client Profile: Doctors can view client profiles, including personal details and enrolled programs.
- Enroll Client in Programs: Doctors can enroll clients in multiple programs.
- Client Cards: Registered clients are displayed as cards in the dashboard, which are clickable to view detailed profiles.
- Email Notifications: Clients receive an email notification upon registration.
- Add Programs: Doctors can add multiple programs.
- Enroll Clients in Programs: Clients can be enrolled in more than one program.
- Responsive Design: The dashboard is designed to feel like a mobile app and is fully responsive on all devices.
- Pagination: Client cards are paginated for better usability when there are many clients.
- Search Bar: Doctors can search for clients by name.
- Backend: Node.js, PostgreSQL, ES6 imports
- Frontend: EJS templates and partials
- Email Service: SMTP Gmail service
- API Routes: GET, POST, DELETE methods
med-portal-web-app/
├── Database/
│ └── db.js
├── Transporter/
│ └── email.js
├── Test_apis/
│ ├── getclient.js
│ ├── getAllUsers.js
│ └── programs.js
├── api_Routes/
│ ├── GET/
│ │ ├── home.js
│ │ ├── signup.js
│ │ ├── login.js
│ │ ├── dashboard.js
│ │ ├── verify_token.js
│ │ ├── logout.js
│ │ ├── addProgram.js
│ │ ├── clientRegister.js
│ │ ├── programEnroll.js
│ │ ├── forgot_password.js
│ │ ├── deleteAccount.js
│ │ ├── resetToken.js
│ │ └── clients.js
│ ├── POST/
│ │ ├── signup_post.js
│ │ ├── login_post.js
│ │ ├── programADD_post.js
│ │ ├── clientRegister_post.js
│ │ ├── programsEnrol.js
│ │ ├── forgotPassword_post.js
│ │ └── processToken.js
│ └── DELETE/
│ ├── clientDelete.js
│ └── doctorDelete.js
├── views/
│ ├── partials/
│ │ ├── home/
│ │ ├── login/
│ │ ├── register/
│ │ ├── dashboard/
│ │ ├── clientProfile/
│ │ └── program/
│ ├── index.ejs
│ ├── login.ejs
│ ├── register.ejs
│ ├── dashboard.ejs
│ ├── clientProfile.ejs
│ └── program.ejs
├── node_modules/
├── .gitignore
├── index.js
└── package.json
- GET /signup: Display the signup form.
- POST /signup-post: Handle doctor registration.
- GET /login: Display the login form.
- POST /login: Handle doctor login.
- GET /verify: Verify the doctor's account.
- GET /logout: Log out the doctor.
- GET /forgot-password: Display the forgot password form.
- POST /forgot-password: Handle forgot password request.
- GET /reset-password: Display the reset password form.
- POST /reset-password: Handle password reset.
- GET /clients/register: Display the client registration form.
- POST /clients/register_post: Handle client registration.
- GET /clients: Display all clients.
- GET /clients/1: Display specific client.
- DELETE /clients/:id: Delete a client by ID.
- GET /programs/add: Display the program addition form.
- POST /programs/add: Handle adding a new program.
- GET /programs/enroll: Display the program enrollment form.
- POST /programs/enroll: Handle enrolling a client in a program.
N/B: These are a few test routes that query the live database.
- GET /api/clients: Test Clients
- GET /api/users: Test Users
- GET /api/programs-per-doctor: Test Programs
- Database: PostgreSQL
- Configuration:
Database/db.js
// Database/db.js
import pg from 'pg';
const { Pool } = pg;
const pool = new Pool({
user: process.env.PGUSER,
password: process.env.PGPASSWORD,
database: process.env.PGDATABASE,
host: process.env.PGHOST,
port: YOUR DB PORT NUMBER,
});
export default pool;
##Email Configuration
**Service**: SMTP Gmail
**Configuration**: Transporter/email.js
```javascript
let transporter = nodemailer.createTransport({
host: process.env.EMAIL_HOST,
port: process.env.EMAIL_PORT,
secure: process.env.EMAIL_PORT === "465",
auth: {
user: process.env.EMAIL_USER,
pass: process.env.EMAIL_PASS
},
tls: {
rejectUnauthorized: false
}
});git clone https://github.com/eritech98/CEMA_health_system.gitnpm installnodemon index.jsThe Med portal Web App is a fully functional web application designed to streamline the management of clients and programs for doctors. It is built with modern technologies and follows best practices for security and usability. This project can serve as a strong foundation for more advanced healthcare management systems.
- To use the application, first, sign up as a user by providing your details (email, password, etc.).
- Once you're signed in, go to the "Add Program" section.
- Enter the details of the program you want to create.
- Click "Add Program" to save the new program.
- After adding a program, go to the "Register Client" section.
- Fill in the client details such as name, email, and phone number.
- Click "Register Client" to save the new client.
- After registering a client, go to the "Enroll Client" section.
- Select the client and the program you want to enroll them in.
- Click "Enroll" to add the client to the selected program.
That's it! You can now manage your clients and programs in the web application.