MediManage is a full-stack application designed to streamline the management of small clinics. It provides an intuitive interface for handling patient records, scheduling appointments, and overseeing other essential administrative tasks. With its robust features and user-friendly design, MediManage ensures efficient and organized clinic operations.
- Patient Management: Easily add, update, and manage patient information.
- Consultation Scheduling: Schedule and track patient appointments with ease.
- Prescriptions: Generate and manage prescriptions PDF files.
- Secure Authentication: Protect sensitive data with robust security measures.
- Reporting and Analytics: Generate insightful reports to optimize clinic operations.
The frontend of MediManage is built using modern technologies to ensure a responsive and seamless user experience.
- Next.js (
next
): A React framework for server-rendered applications. - React (
react
,react-dom
): A JavaScript library for building user interfaces. - Tailwind CSS (
tailwindcss
,@tailwindcss/forms
,@tailwindcss/typography
): A utility-first CSS framework for rapid UI development. - NextAuth.js (
next-auth
): Authentication for Next.js applications. - Zod (
zod
): A TypeScript-first schema validation library. - React Icons (
react-icons
): Include popular icons in your React projects easily. - React Intersection Observer (
react-intersection-observer
): A React implementation of the Intersection Observer API. - React PDF Renderer (
@react-pdf/renderer
): Create PDF files in React.
The backend leverages the power of Spring Boot to provide a scalable and secure foundation for the application.
- Spring Boot Starter Web (
spring-boot-starter-web
): Build web applications, including RESTful services. - Spring Boot Starter Data JPA (
spring-boot-starter-data-jpa
): Simplify data persistence with JPA. - Spring Boot Starter Security (
spring-boot-starter-security
): Secure the application with Spring Security. - Spring Boot Starter Validation (
spring-boot-starter-validation
): Provide validation support. - PostgreSQL Driver (
postgresql
): Connect to PostgreSQL databases. - H2 Database (
h2
): An in-memory database for development and testing. - Java JWT (
java-jwt
): JSON Web Token (JWT) creation and verification. - ModelMapper (
modelmapper
): Simplify object mapping. - Lombok (
lombok
): Reduce boilerplate code with annotations. - SpringDoc OpenAPI (
springdoc-openapi-starter-webmvc-ui
,springdoc-openapi-starter-webflux-ui
): Generate API documentation. - Spring Boot DevTools (
spring-boot-devtools
): Enhance the development experience with automatic restarts.
-
Frontend:
-
Backend:
- Docker and Docker Compose
-
Clone the Repository
git clone https://github.com/Barata-Ribeiro/MediManage.git cd MediManage/client
-
Install Dependencies
Using npm:
npm install
Or using Yarn:
yarn install
-
Configure Environment Variables
Create a
.env.local
file in theclient
directory and add the necessary environment variables:TOKEN_NAME=TOKEN_NAME JWT_BACKEND_SECRET=JWT_RANDOM_KEY NEXT_PUBLIC_INSTITUTION_NAME=CLINIC_PUBLIC_NAME AUTH_SECRET=AUTO_GEN_AUTH_JS_KEY # Added by npx auth. Read more: https://cli.authjs.dev
-
Run the Development Server
npm run dev
The application will be available at http://localhost:3000.
-
Build for Production
npm run build npm start
-
Navigate to the Server Directory
cd MediManage/server
-
Create
docker-compose.yml
Create a
docker-compose.yml
file in theserver
directory with the following content:name: medimanage-backend services: medimanage-database: image: postgres:latest container_name: medimanage-database restart: always environment: POSTGRES_DB: medimanage_db POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres PGDATA: /var/lib/postgresql/data/pgdata ports: - "5432:5432" volumes: - pgdata:/var/lib/postgresql/data medimanage-app: build: . container_name: medimanage-app restart: always environment: DB_ORIGIN: medimanage-database DB_PORT: 5432 DB_NAME: medimanage_db DB_USER: postgres DB_PASSWORD: postgres JWT_SECRET: secret CORS_ORIGINS: http://localhost:3000 ports: - "8080:8080" depends_on: - medimanage-database volumes: pgdata:
-
Create
Dockerfile
Create a
Dockerfile
in theserver
directory with the following content:# Build stage FROM maven:3.9.9-eclipse-temurin-21 as builder LABEL authors="Barata Ribeiro <joaomendesjorge@barataribeiro.com>" WORKDIR /app COPY src /app/src COPY pom.xml /app RUN mvn clean package -DskipTests # Run stage FROM eclipse-temurin:21-jre-alpine WORKDIR /app COPY --from=builder /app/target/*.jar app.jar EXPOSE 8080 ENTRYPOINT ["java", "-jar", "/app/app.jar", "--spring.profiles.active=production"]
-
Configure Environment Variables
Ensure the following environment variables are set in the
docker-compose.yml
under themedimanage-app
service:environment: DB_ORIGIN: medimanage-database DB_PORT: 5432 DB_NAME: medimanage_db DB_USER: postgres DB_PASSWORD: postgres JWT_SECRET: secret CORS_ORIGINS: http://localhost:3000
Additional Environment Variables:
CORS_ORIGIN=URLS_SEPARATE_BY_COMMAS
JWT_SECRET=SECRET_KEY
-
Run the Services
From the
server
directory, run:docker-compose up --build
This command will build the backend application and start both the PostgreSQL database and the backend service. The backend will be accessible at http://localhost:8080.
client/
βββ .idea
βββ node_modules
βββ public/
βββ src/
β βββ actions/
β βββ app/
β βββ components/
β βββ context/
β βββ hooks/
β βββ interfaces/
β βββ utils/
β βββ auth.ts
β βββ constants.ts
β βββ middleware.ts
βββ .env.local
βββ .eslintrc.json
βββ .gitignore
βββ .prettierrc
βββ next.config.mjs
βββ next-env.d.ts
βββ package.json
βββ package-lock.json
βββ postcss.config.mjs
βββ README.md
βββ tailwind.config.ts
βββ tsconfig.json
server/
βββ .idea
βββ .mvn/
βββ src/
β βββ main/
β βββ java/
β βββ com/barataribeiro/medimanage/
β βββ builders/
β βββ config/
β βββ constants/
β βββ controllers/
β βββ dtos/
β βββ entities/
β βββ exceptions/
β βββ repositories/
β βββ services/
β βββ MediManageApplication.java
βββ target/
βββ .gitignore
βββ docker-compose.yml
βββ Dockerfile
βββ HELP.md
βββ MediManage.iml
βββ mvnw
βββ mvnw.cmd
βββ pom.xml
TOKEN_NAME=TOKEN_NAME
JWT_BACKEND_SECRET=JWT_RANDOM_KEY
NEXT_PUBLIC_INSTITUTION_NAME=CLINIC_PUBLIC_NAME
AUTH_SECRET=AUTO_GEN_AUTH_JS_KEY # Added by npx auth. Read more: https://cli.authjs.dev
spring.application.name=MediManage
springdoc.api-docs.path=/api-docs
spring.threads.virtual.enabled=true
# Database Configuration
spring.datasource.url=jdbc:h2:file:~/data/medi_manage_db_test
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
# Hibernate
spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
# Security and Seed
api.security.token.secret=${JWT_SECRET}
api.security.cors.origins=${CORS_ORIGINS}
api.security.argon2.salt=${ENCODER_SALT:16}
api.security.argon2.length=${ENCODER_LENGTH:32}
api.security.argon2.parallelism=${ENCODER_PARALLELISM:2}
api.security.argon2.memory=${ENCODER_MEMORY:65536}
api.security.argon2.iterations=${ENCODER_ITERATIONS:4}
# Spring Docs
springdoc.swagger-ui.operationsSorter=alpha
springdoc.swagger-ui.tagsSorter=alpha
spring.application.name=MediManage
springdoc.api-docs.path=/api-docs
spring.threads.virtual.enabled=true
# Database Configuration
spring.datasource.url=jdbc:postgresql://${DB_ORIGIN:localhost}:${DB_PORT:5432}/${DB_NAME:medi_manage_db}
spring.datasource.username=${DB_USER:postgres}
spring.datasource.password=${DB_PASSWORD:postgres}
spring.datasource.driver-class-name=org.postgresql.Driver
# Hibernate
spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
# Security and Seed
api.security.token.secret=${JWT_SECRET}
api.security.cors.origins=${CORS_ORIGINS}
api.security.argon2.salt=${ENCODER_SALT:16}
api.security.argon2.length=${ENCODER_LENGTH:32}
api.security.argon2.parallelism=${ENCODER_PARALLELISM:2}
api.security.argon2.memory=${ENCODER_MEMORY:65536}
api.security.argon2.iterations=${ENCODER_ITERATIONS:4}
Contributions, issues, and feature requests are welcome! Feel free to check the issues page if you want to contribute.
This project is free software available under the GPLv3 license.