# Tutorial Build FHIR Server On Windows ###### tags: `fhir-project` `fhirserver` This tutorial is designed for FHIR developer wishing to build a FHIR Server in a Windows OS. In this tutorial, we will try to build the server in a localhost mode instead of public server. {%youtube 5ypS1XJm4YE %} ## Table of Contents [TOC] ## Prerequisite Basic Knowledge: * Java language Software Installation: | Type | Usage | Software Name | Version used in this tutorial | | -------- | -------- | -------- | -------- | | Database | Store FHIR Resouces data | [Postgresql](https://www.postgresql.org/about/) | 12.10 | | FHIR starter source code | Deploy a FHIR server using HAPI FHIR JPA | [hapi-fhir-jpaserver-starter](https://hapifhir.io/) | helm-v0.8.0 (*always strive for the latest-updated version*) | | Java Development Kit (JDK) | HAPI FHIR works on Java environment, so it'll requires a JDK in order to run | [Oracle Java (JDK)](https://www.oracle.com/java/technologies/downloads/) | 15.0.2 | | Web Server | Provide Java web server environment for the FHIR Server | [Apache Tomcat](https://tomcat.apache.org/) | 9.0 | | JAVA IDE | For developing Spring-based enterprise applications| [Spring tool suit 4(STS 4)](https://spring.io/tools#:~:text=Spring%20%7C%20Tools&text=Spring%20Tools%204%20is%20the,Studio%20Code%2C%20or%20Theia%20IDE.)| 4.14.1| ## Build HAPI FHIR Server Step We executed this tutorial on a Windows 10 x64-bit laptop ### A. Install Postgresql and Create Database Time: 5-10 mins 1. Install ![](https://i.imgur.com/IOKvYg8.png) * version: 12.10 * url: https://www.enterprisedb.com/downloads/postgres-postgresql-downloads 2. Create a new Role 2.1 Open PgAdmin 4 ![](https://i.imgur.com/zWIkCCB.png) 2.2 Right click on the [Login/Group Roles] -> Click [Create] -> Click [Login/Group Role] ![](https://i.imgur.com/bVPrVQp.png) 2.3 Input role name ![](https://i.imgur.com/3Hw42yP.png) 2.4 Input password ![](https://i.imgur.com/BXEbgZF.png) 2.5 Enable [Can Login?] setting -> Click [Save] ![](https://i.imgur.com/95bBehA.png) 3. Create a new Database 3.1 Right click on the [Databases] -> Click [Create] -> Click [Database] ![](https://i.imgur.com/uapkvQI.png) 3.2 Input database name -> Select the role created in step 2 -> Click [Save] ![](https://i.imgur.com/TKteCJE.png) 4. Enable TCP/IP connections in PostgreSQL 4.1. Edit file “postgresql.conf” (file path: /etc/postgresql/{version}/main) Add below line: <table class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0" style="margin-left:25.0pt;border-collapse:collapse;border:none;mso-border-alt: solid windowtext .5pt;mso-yfti-tbllook:1184;mso-padding-alt:0cm 5.4pt 0cm 5.4pt"><tbody><tr style="mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes"><td width="599" valign="top" style="width:449.0pt;border:solid windowtext 1.0pt; mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt">listen_addresses = '*'d></td></tr></tbody></table> 4.2. Edit file “pg\_hba.conf” (file path: /etc/postgresql/{version}/main) Add below line: (if needed to change file permission then cd /etc/postgresql/14/main -> sudo chmod 644 pg\_hba.conf) <table class="MsoTableGrid" border="1" cellspacing="0" cellpadding="0" style="margin-left:25.0pt;border-collapse:collapse;border:none;mso-border-alt: solid windowtext .5pt;mso-yfti-tbllook:1184;mso-padding-alt:0cm 5.4pt 0cm 5.4pt"><tbody><tr style="mso-yfti-irow:0;mso-yfti-firstrow:yes;mso-yfti-lastrow:yes"><td width="599" valign="top" style="width:449.0pt;border:solid windowtext 1.0pt; mso-border-alt:solid windowtext .5pt;padding:0cm 5.4pt 0cm 5.4pt">host all all 0.0.0.0/0 md5</td></tr></tbody></table> ### B. Download Java Development Kit (JDK) <!-- ![](https://i.imgur.com/SKYStVN.png) * version: 1.8 * url: https://www.java.com/en/download/--> ![](https://i.imgur.com/oatEZTd.png) * version: 15.0.2 * url: https://www.oracle.com/java/technologies/javase/jdk15-archive-downloads.html ### C. Install Apache Tomcat ![](https://i.imgur.com/idB2iBE.png) * version: 9.0 * url: https://tomcat.apache.org/download-90.cgi ### D. Download HAPI-FHIR Starter source code ![](https://i.imgur.com/Ia6rZvi.png) * version: helm-v0.8.0 * url: https://github.com/hapifhir/hapi-fhir-jpaserver-starter.git ### E. Install Spring tool suit 4 (STS 4) ![](https://i.imgur.com/UYnPprN.png) * version: 4.14.1 * url: spring.io/tools ### F. Debug hapi-fhir-starter-project in STS 4 1. Setting JDK 2. Setting Apache Tomcat 3. Import HAPI FHIR starter 3.1 Edit PostgreSQL 3.2 Edit server address 5. Debug ### G. Deploy a WAR File to Tomcat web service