{"id":15067727,"url":"https://github.com/wussh/hospital-management-system-api","last_synced_at":"2026-01-02T17:33:21.485Z","repository":{"id":142185750,"uuid":"611816817","full_name":"wussh/hospital-management-system-api","owner":"wussh","description":"This repository contains a RESTful API for managing various hospital-related operations such as authentication, clinic management, patient management, scheduling, and more. The API is built using the Go programming language and utilizes PostgreSQL as the database. Additionally, it includes CI/CD GitHub Actions and deployment to AWS.","archived":false,"fork":false,"pushed_at":"2024-02-10T04:54:38.000Z","size":71,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T18:24:03.163Z","etag":null,"topics":["docker-compose","github-actions","go","golang-examples","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wussh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-03-09T15:52:56.000Z","updated_at":"2024-02-10T04:52:16.000Z","dependencies_parsed_at":"2024-02-10T05:38:58.066Z","dependency_job_id":null,"html_url":"https://github.com/wussh/hospital-management-system-api","commit_stats":null,"previous_names":["wussh/hospital-management-system-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wussh%2Fhospital-management-system-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wussh%2Fhospital-management-system-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wussh%2Fhospital-management-system-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wussh%2Fhospital-management-system-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wussh","download_url":"https://codeload.github.com/wussh/hospital-management-system-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830911,"owners_count":20354850,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker-compose","github-actions","go","golang-examples","rest-api"],"created_at":"2024-09-25T01:26:48.418Z","updated_at":"2026-01-02T17:33:21.456Z","avatar_url":"https://github.com/wussh.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hospital Management System REST API\n\nThis project implements a RESTful API for managing hospital-related operations such as authentication, clinic management, patient management, scheduling, and more.\n\n## Usage\n\n1. Clone the repository:\n   ```bash\n   git clone https://github.com/wussh/hospital.git\n   ```\n\n2. Navigate to the project directory:\n   ```bash\n   cd hospital\n   ```\n\n3. Install dependencies:\n   ```bash\n   go mod tidy\n   ```\n\n4. Run the application:\n   ```bash\n   go run main.go\n   ```\n\n## Running with Docker Compose\n\n1. Make sure you have Docker and Docker Compose installed on your machine.\n\n2. Create a `.env` file based on the provided `.env.example` file and customize the environment variables as needed.\n\n3. Build and run the Docker containers:\n   ```bash\n   docker-compose up -d\n   ```\n\n4. Access the API at `http://localhost:9000`.\n\n## Shutting Down\n\nTo shut down the application and Docker containers, run:\n```bash\ndocker-compose down\n```\n\n## Changing Environment Variables\n\nYou can customize environment variables by editing the `.env` file. Refer to the provided `.env.example` file for a list of required variables.\n\n## Database Design\n\nThe project uses PostgreSQL as the database. You can find the database schema and design in the `src/repository/postgres` directory.\n\n## Project Structure\n\nThe project follows a standard Go project structure:\n- `src`: Contains all source code files.\n  - `delivery/http/echo`: HTTP delivery layer with Echo framework.\n  - `domain`: Domain layer containing business logic interfaces and models.\n  - `entity`: Entity layer containing database models.\n  - `repository/postgres`: Repository layer for PostgreSQL database operations.\n  - `service`: Service layer for application-specific logic.\n  - `usecase`: Usecase layer for orchestrating business logic.\n  - `util`: Utility functions and helpers.\n- `docker-compose.yml`: Docker Compose configuration file.\n- `Dockerfile`: Dockerfile for building the application image.\n- `go.mod` and `go.sum`: Go module files.\n- `Makefile`: Makefile for common tasks.\n- `.env.example`: Example environment variable file.\n- `main.go`: Entry point of the application.\n\n## Routes\n\n### Authentication\n\n- `POST /login`: User login.\n- `POST /logout`: User logout (requires JWT token).\n- `PUT /authentications`: Update authentication information (requires JWT token).\n\n### Clinic\n\n- `POST /clinics`: Add a new clinic (requires JWT token).\n- `GET /clinics`: Get all clinics (requires JWT token).\n- `GET /clinics/:clinicID`: Get clinic by ID (requires JWT token).\n- `PUT /clinics/:clinicID`: Update clinic by ID (requires JWT token).\n- `DELETE /clinics/:clinicID`: Delete clinic by ID (requires JWT token).\n\n### Doctor\n\n- `POST /doctors`: Add a new doctor (requires JWT token).\n- `GET /doctors`: Get all doctors (requires JWT token).\n- `GET /doctors/:doctorID`: Get doctor by ID (requires JWT token).\n- `PUT /doctors/:doctorID`: Update doctor by ID (requires JWT token).\n- `DELETE /doctors/:doctorID`: Delete doctor by ID (requires JWT token).\n\n### Hello\n\n- `GET /hello`: Hello World endpoint.\n\n### Medical Record\n\n- `POST /sessions/:sessionID/records`: Add a new medical record to a session (requires JWT token).\n\n### Patient\n\n- `POST /patients`: Add a new patient (requires JWT token).\n- `GET /patients`: Get all patients (requires JWT token).\n- `GET /patients/:patientID`: Get patient by ID (requires JWT token).\n- `PUT /patients/:patientID`: Update patient by ID (requires JWT token).\n- `DELETE /patients/:patientID`: Delete patient by ID (requires JWT token).\n- `GET /nik/:nik`: Get patient by National Identification Number (requires JWT token).\n\n### Schedule\n\n- `POST /users/:userID/schedules`: Add a new schedule for a user (requires JWT token).\n- `GET /users/:userID/schedules`: Get all schedules for a user (requires JWT token).\n- `GET /users/:userID/schedules/:scheduleID`: Get schedule by ID for a user (requires JWT token).\n- `PUT /users/:userID/schedules/:scheduleID`: Update schedule by ID for a user (requires JWT token).\n- `DELETE /users/:userID/schedules/:scheduleID`: Delete schedule by ID for a user (requires JWT token).\n\n### Session\n\n- `POST /sessions`: Add a new session (requires JWT token).\n- `GET /sessions`: Get all sessions (requires JWT token).\n- `POST /sessions/:sessionID/complete`: Complete a session (requires JWT token).\n- `POST /sessions/:sessionID/cancel`: Cancel a session (requires JWT token).\n- `POST /sessions/:sessionID/activate`: Activate a session (requires JWT token).\n\n### Staff\n\n- `POST /staffs`: Add a new staff member.\n\n### Static Files\n\n- `GET /avatar/:avatar`: Serve avatar images.\n\n### User\n\n- `POST /users`: Add a new user (requires JWT token).\n- `PUT /users/:userID/avatar`: Update user avatar (requires JWT token).\n- `DELETE /users/:userID/avatar`: Delete user avatar (requires JWT token).\n- `GET /users/:userID`: Get user by ID (requires JWT token).\n- `GET /users/current`: Get currently authenticated user (requires JWT token).\n\n## Continuous Integration and Continuous Deployment (CI/CD) with GitHub Actions\n\nThe repository includes CI/CD workflows using GitHub Actions. Below are the workflows defined:\n\n### CI Test (ci-test.yml)\n\nThis workflow runs tests on push or pull requests made to the main branch. It ensures the code quality and functionality are maintained.\n\n### Deploy to AWS (deploy-aws.yml)\n\nThis workflow triggers on push events to the main branch. It deploys the application to an AWS EC2 instance using SSH. You need to provide the necessary secrets for SSH authentication and server details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwussh%2Fhospital-management-system-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwussh%2Fhospital-management-system-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwussh%2Fhospital-management-system-api/lists"}