diff --git a/.env.example b/.env.example
index c3cd2caa3094daa00407959cfc222e7e39e601c5..56fb83cf836623dfeb1066754f2c5c2ef0994c03 100644
--- a/.env.example
+++ b/.env.example
@@ -35,3 +35,4 @@ ATTESTATION_SERVICE_HOST=0.0.0.0
 PROOF_SERVICE_TCP_PORT=8884
 PROOF_SERVICE_HOST=0.0.0.0
 
+SWAGGER=false
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b5b3a1641255965f670592a83632e66df25912c3..da116bd250cb57b50ccb05a0b40d4402bc0fab3b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,13 @@
 All notable changes to this project will be documented in this file. See
 [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
 
+## [1.11.1](https://code.vereign.com/gaiax/ocm/ocm-engine/compare/v1.11.0...v1.11.1) (2023-11-02)
+
+
+### Bug Fixes
+
+* separate swagger generation from server run ([efb63a9](https://code.vereign.com/gaiax/ocm/ocm-engine/commit/efb63a9b791e938df6cc782229f6b2d13a091d87))
+
 ## [1.11.0](https://code.vereign.com/gaiax/ocm/ocm-engine/compare/v1.10.0...v1.11.0) (2023-10-09)
 
 
diff --git a/apps/agent/src/main.ts b/apps/agent/src/main.ts
index c90dec25d6839829c3a93bda19a3a961587aced8..f4aac4d99469a92530fe172a62733bc5b573af3a 100644
--- a/apps/agent/src/main.ts
+++ b/apps/agent/src/main.ts
@@ -17,15 +17,19 @@ async function bootstrap() {
   const port = process.env.AGENT_PORT || 3001;
   app.enableShutdownHooks();
 
-  const config = new DocumentBuilder()
-    .setTitle("Agent")
-    .setDescription("Agent API")
-    .setVersion("1.0")
-    .build();
+  if (process.env.SWAGGER === "true") {
+    const config = new DocumentBuilder()
+      .setTitle("Agent")
+      .setDescription("Agent API")
+      .setVersion("1.0")
+      .build();
 
-  const document = SwaggerModule.createDocument(app, config);
-  fs.writeFileSync("./agent-swagger.json", JSON.stringify(document, null, 2));
-  SwaggerModule.setup("api", app, document);
+    const document = SwaggerModule.createDocument(app, config);
+    fs.writeFileSync("./agent-swagger.json", JSON.stringify(document, null, 2));
+    SwaggerModule.setup("api", app, document);
+    Logger.log(`Swagger file written`);
+    return process.kill(0);
+  }
 
   await app.listen(port, "0.0.0.0");
   Logger.log(
diff --git a/apps/gateway/src/main.ts b/apps/gateway/src/main.ts
index 434f11e19845229eb52fe42e3a68ef26ccef47f9..2e0f63771fb733ba6b07993cba9b59d80e0d8a8e 100644
--- a/apps/gateway/src/main.ts
+++ b/apps/gateway/src/main.ts
@@ -39,17 +39,21 @@ async function bootstrap() {
 
   app.enableShutdownHooks();
 
-  const config = new DocumentBuilder()
-    .setTitle("OCM Gateway")
-    .setDescription("OCM ENGINE GATEWAY API")
-    .setVersion("1.0")
-    .addServer(`http://${gatewayConfig.host}:${gatewayConfig.httpPort}`)
-    .build();
+  if (process.env.SWAGGER === "true") {
+    const config = new DocumentBuilder()
+      .setTitle("OCM Gateway")
+      .setDescription("OCM ENGINE GATEWAY API")
+      .setVersion("1.0")
+      .addServer(`http://${gatewayConfig.host}:${gatewayConfig.httpPort}`)
+      .build();
 
-  const document = SwaggerModule.createDocument(app, config);
-  fs.writeFileSync("./gateway-swagger.json", JSON.stringify(document, null, 2));
-  SwaggerModule.setup("api", app, document);
+    const document = SwaggerModule.createDocument(app, config);
+    fs.writeFileSync("./gateway-swagger.json", JSON.stringify(document, null, 2));
+    SwaggerModule.setup("api", app, document);
 
+    Logger.log(`Swagger file written`);
+    return process.kill(0);
+  }
   const port = gatewayConfig.httpPort || 3000;
 
   await app.listen(port, gatewayConfig.host);