diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..c4a2d1e
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,33 @@
+version: '3.8'
+services:
+ gateway:
+ build: gateway
+ container_name: shareit_gateway_container
+ ports:
+ - "8080:8080"
+ depends_on:
+ - server
+ environment:
+ - SHAREIT_SERVER_URL=http://server:9090
+
+ server:
+ build: server
+ container_name: shareit_server_container
+ ports:
+ - "9090:9090"
+ depends_on:
+ - db
+ environment:
+ - SPRING_DATASOURCE_URL=jdbc:postgresql://db:5432/shareit
+ - SPRING_DATASOURCE_USERNAME=shareit
+ - SPRING_DATASOURCE_PASSWORD=root
+
+ db:
+ image: postgres:13.7-alpine
+ container_name: shareit_db_container
+ ports:
+ - "6541:5432"
+ environment:
+ - POSTGRES_DB=shareit
+ - POSTGRES_USER=shareit
+ - POSTGRES_PASSWORD=root
diff --git a/gateway/Dockerfile b/gateway/Dockerfile
new file mode 100644
index 0000000..6bd71b7
--- /dev/null
+++ b/gateway/Dockerfile
@@ -0,0 +1,3 @@
+FROM amazoncorretto:11
+COPY target/*.jar app.jar
+ENTRYPOINT ["java","-jar","/app.jar"]
diff --git a/gateway/pom.xml b/gateway/pom.xml
new file mode 100644
index 0000000..05fbcdf
--- /dev/null
+++ b/gateway/pom.xml
@@ -0,0 +1,73 @@
+
+
+ 4.0.0
+
+ ru.practicum
+ shareit
+ 0.0.1-SNAPSHOT
+
+
+ shareit-gateway
+ 0.0.1-SNAPSHOT
+
+ ShareIt Gateway
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-validation
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+ org.apache.httpcomponents
+ httpclient
+
+
+
+ org.springframework.boot
+ spring-boot-configuration-processor
+ true
+
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ org.springframework.data
+ spring-data-commons
+
+
+ com.h2database
+ h2
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+
+
+
diff --git a/gateway/src/main/java/ru/practicum/shareit/ShareItGateway.java b/gateway/src/main/java/ru/practicum/shareit/ShareItGateway.java
new file mode 100644
index 0000000..0aa75c3
--- /dev/null
+++ b/gateway/src/main/java/ru/practicum/shareit/ShareItGateway.java
@@ -0,0 +1,12 @@
+package ru.practicum.shareit;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class ShareItGateway {
+ public static void main(String[] args) {
+ SpringApplication.run(ShareItGateway.class, args);
+ }
+
+}
diff --git a/gateway/src/main/java/ru/practicum/shareit/booking/client/BookingClient.java b/gateway/src/main/java/ru/practicum/shareit/booking/client/BookingClient.java
new file mode 100644
index 0000000..7f8243f
--- /dev/null
+++ b/gateway/src/main/java/ru/practicum/shareit/booking/client/BookingClient.java
@@ -0,0 +1,51 @@
+package ru.practicum.shareit.booking.client;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.web.client.RestTemplateBuilder;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.web.util.DefaultUriBuilderFactory;
+import ru.practicum.shareit.booking.dto.BookingRequestDto;
+import ru.practicum.shareit.booking.dto.State;
+import ru.practicum.shareit.client.BaseClient;
+
+import java.util.Map;
+
+@Service
+public class BookingClient extends BaseClient {
+ private static final String API_PREFIX = "/bookings";
+
+ @Autowired
+ public BookingClient(@Value("${shareit-server.url}") String serverUrl, RestTemplateBuilder builder) {
+ super(builder
+ .uriTemplateHandler(new DefaultUriBuilderFactory(serverUrl + API_PREFIX))
+ .requestFactory(HttpComponentsClientHttpRequestFactory::new)
+ .build());
+ }
+
+ public ResponseEntity