From 3c144c140b337821d56ff65e81b62b2066719025 Mon Sep 17 00:00:00 2001
From: hiento09 <136591877+hiento09@users.noreply.github.com>
Date: Thu, 12 Sep 2024 02:38:06 +0700
Subject: [PATCH] Feat Installer and CICD nightly, beta, stable for cortexcpp
 (#1122)

Co-authored-by: Hien To <tominhhien97@gmail.com>
Co-authored-by: Service Account <service@jan.ai>
---
 .github/workflows/beta-build.yml              | 114 ++++++++
 .github/workflows/cortex-build.yml            | 250 -----------------
 .github/workflows/cortex-cpp-quality-gate.yml |   6 +-
 .github/workflows/nightly-build.yml           | 255 +++++++-----------
 .github/workflows/nightly.yml                 | 174 ------------
 .github/workflows/stable-build.yml            | 114 ++++++++
 .../workflows/template-build-linux-x64.yml    | 187 +++++++++++++
 .github/workflows/template-build-macos.yml    | 236 ++++++++++++++++
 .../workflows/template-build-windows-x64.yml  | 251 +++++++++++++++++
 .../workflows/template-get-update-version.yml |  60 +++++
 engine/CMakeLists.txt                         |   2 +-
 engine/Makefile                               |  69 +++--
 engine/binding/index.d.ts                     |   7 -
 engine/binding/index.js                       |   3 -
 engine/package.json                           |  46 ----
 engine/templates/linux/control                |   9 +
 engine/templates/linux/create_deb.sh          |  35 +++
 engine/templates/linux/postinst               |   5 +
 engine/templates/linux/postrm                 |  30 +++
 engine/templates/linux/prerm                  |   6 +
 engine/templates/macos/cortex-uninstall.sh    |  40 +++
 engine/templates/macos/create_pkg.sh          |  25 ++
 .../templates/macos}/entitlements.plist       |   0
 engine/templates/macos/post-installer.sh      |   5 +
 .../templates/windows}/cortex.ico             | Bin
 engine/templates/windows/installer-beta.iss   | 113 ++++++++
 .../templates/windows/installer-nightly.iss   | 113 ++++++++
 engine/templates/windows/installer.iss        | 113 ++++++++
 .../launchpad/cortexso/debian/changelog       |  11 -
 .../launchpad/cortexso/debian/control         |  12 -
 .../launchpad/cortexso/debian/copyright       |  19 --
 .../launchpad/cortexso/debian/install         |   1 -
 .../launchpad/cortexso/debian/postrm          |  10 -
 .../launchpad/cortexso/debian/prerm           |   6 -
 .../launchpad/cortexso/debian/rules           |   7 -
 platform/control.template                     |   9 -
 platform/installer.iss                        |  86 ------
 37 files changed, 1602 insertions(+), 827 deletions(-)
 create mode 100644 .github/workflows/beta-build.yml
 delete mode 100644 .github/workflows/cortex-build.yml
 delete mode 100644 .github/workflows/nightly.yml
 create mode 100644 .github/workflows/stable-build.yml
 create mode 100644 .github/workflows/template-build-linux-x64.yml
 create mode 100644 .github/workflows/template-build-macos.yml
 create mode 100644 .github/workflows/template-build-windows-x64.yml
 create mode 100644 .github/workflows/template-get-update-version.yml
 delete mode 100644 engine/binding/index.d.ts
 delete mode 100644 engine/binding/index.js
 delete mode 100644 engine/package.json
 create mode 100644 engine/templates/linux/control
 create mode 100644 engine/templates/linux/create_deb.sh
 create mode 100644 engine/templates/linux/postinst
 create mode 100644 engine/templates/linux/postrm
 create mode 100644 engine/templates/linux/prerm
 create mode 100644 engine/templates/macos/cortex-uninstall.sh
 create mode 100644 engine/templates/macos/create_pkg.sh
 rename {platform => engine/templates/macos}/entitlements.plist (100%)
 create mode 100644 engine/templates/macos/post-installer.sh
 rename {platform => engine/templates/windows}/cortex.ico (100%)
 create mode 100644 engine/templates/windows/installer-beta.iss
 create mode 100644 engine/templates/windows/installer-nightly.iss
 create mode 100644 engine/templates/windows/installer.iss
 delete mode 100644 package-managers-template/launchpad/cortexso/debian/changelog
 delete mode 100644 package-managers-template/launchpad/cortexso/debian/control
 delete mode 100644 package-managers-template/launchpad/cortexso/debian/copyright
 delete mode 100644 package-managers-template/launchpad/cortexso/debian/install
 delete mode 100644 package-managers-template/launchpad/cortexso/debian/postrm
 delete mode 100644 package-managers-template/launchpad/cortexso/debian/prerm
 delete mode 100644 package-managers-template/launchpad/cortexso/debian/rules
 delete mode 100644 platform/control.template
 delete mode 100644 platform/installer.iss

diff --git a/.github/workflows/beta-build.yml b/.github/workflows/beta-build.yml
new file mode 100644
index 000000000..6c880c1fd
--- /dev/null
+++ b/.github/workflows/beta-build.yml
@@ -0,0 +1,114 @@
+name: CI Cortex CPP Beta Build
+
+on:
+  push:
+    tags: ["v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+"]
+
+jobs:
+  # Job create Update app version based on latest release tag with build number and save to output
+  get-update-version:
+    uses: ./.github/workflows/template-get-update-version.yml
+
+  create-draft-release:
+    runs-on: ubuntu-latest
+    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
+    outputs:
+      upload_url: ${{ steps.create_release.outputs.upload_url }}
+      version: ${{ steps.get_version.outputs.version }}
+    permissions:
+      contents: write
+    steps:
+      - name: Extract tag name without v prefix
+        id: get_version
+        run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV && echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
+        env:
+          GITHUB_REF: ${{ github.ref }}
+      - name: Create Draft Release
+        id: create_release
+        uses: softprops/action-gh-release@v2
+        with:
+          tag_name: ${{ github.ref_name }}
+          token: ${{ secrets.GITHUB_TOKEN }}
+          name: "${{ env.VERSION }}"
+          draft: true
+          prerelease: false
+
+  build-macos-x64:
+    uses: ./.github/workflows/template-build-macos.yml
+    needs: [get-update-version, create-draft-release]
+    secrets: inherit
+    with:
+      ref: ${{ github.ref }}
+      public_provider: github
+      new_version: ${{ needs.get-update-version.outputs.new_version }}
+      runs-on: macos-12
+      cmake-flags: "-DCORTEX_VARIANT=beta -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
+      channel: beta
+      arch: amd64
+      upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
+
+  build-macos-arm64:
+    uses: ./.github/workflows/template-build-macos.yml
+    needs: [get-update-version, create-draft-release]
+    secrets: inherit
+    with:
+      ref: ${{ github.ref }}
+      public_provider: github
+      new_version: ${{ needs.get-update-version.outputs.new_version }}
+      runs-on: macos-latest
+      cmake-flags: "-DCORTEX_VARIANT=beta -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DMAC_ARM64=ON -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
+      channel: beta
+      arch: arm64
+      upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
+
+  build-windows-x64:
+    uses: ./.github/workflows/template-build-windows-x64.yml
+    secrets: inherit
+    needs: [get-update-version, create-draft-release]
+    with:
+      ref: ${{ github.ref }}
+      public_provider: github
+      new_version: ${{ needs.get-update-version.outputs.new_version }}
+      runs-on: windows-cuda-11-7
+      cmake-flags: "-DCORTEX_VARIANT=beta -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=C:/w/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
+      build-deps-cmake-flags: "-DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
+      ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
+      channel: beta
+      upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
+          
+  build-linux-x64:
+    uses: ./.github/workflows/template-build-linux-x64.yml
+    secrets: inherit
+    needs: [get-update-version, create-draft-release]
+    with:
+      ref: ${{ github.ref }}
+      public_provider: github
+      new_version: ${{ needs.get-update-version.outputs.new_version }}
+      runs-on: ubuntu-20-04
+      cmake-flags: "-DCORTEX_VARIANT=beta -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DCMAKE_TOOLCHAIN_FILE=/home/runner/actions-runner/_work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
+      channel: beta
+      upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
+
+  update_release_draft:
+    needs: [build-macos-x64, build-macos-arm64, build-windows-x64, build-linux-x64]
+    permissions:
+      # write permission is required to create a github release
+      contents: write
+      # write permission is required for autolabeler
+      # otherwise, read permission is required at least
+      pull-requests: write
+    runs-on: ubuntu-latest
+    steps:
+      # (Optional) GitHub Enterprise requires GHE_HOST variable set
+      #- name: Set GHE_HOST
+      #  run: |
+      #    echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
+
+      # Drafts your next Release notes as Pull Requests are merged into "master"
+      - uses: release-drafter/release-drafter@v5
+        # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
+        # with:
+        #   config-name: my-config.yml
+        #   disable-autolabeler: true
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/cortex-build.yml b/.github/workflows/cortex-build.yml
deleted file mode 100644
index 307a53dfe..000000000
--- a/.github/workflows/cortex-build.yml
+++ /dev/null
@@ -1,250 +0,0 @@
-name: CI Cortex Release
-
-on:
-  push:
-    tags: ["v[0-9]+.[0-9]+.[0-9]+", "v[0-9]+.[0-9]+.[0-9]+-*", "!v[0-9]+.[0-9]+.[0-9]+-platform", "!v[0-9]+.[0-9]+.[0-9]+-[0-9]+-platform"]
-    paths: ["cortex-cpp/**", "platform/**"]
-  workflow_dispatch:
-
-jobs:
-  create-draft-release:
-    runs-on: ubuntu-latest
-    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
-    outputs:
-      upload_url: ${{ steps.create_release.outputs.upload_url }}
-      version: ${{ steps.get_version.outputs.version }}
-    permissions:
-      contents: write
-    steps:
-      - name: Extract tag name without v prefix
-        id: get_version
-        run: |
-          echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV && echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
-        env:
-          GITHUB_REF: ${{ github.ref }}
-      - name: Create Draft Release
-        id: create_release
-        uses: softprops/action-gh-release@v2
-        with:
-          tag_name: ${{ github.ref_name }}
-          token: ${{ secrets.GITHUB_TOKEN }}
-          name: "${{ env.VERSION }}"
-          draft: true
-          prerelease: false
-
-  build-and-test:
-    runs-on: ${{ matrix.runs-on }}
-    needs: [create-draft-release]
-    timeout-minutes: 40
-    strategy:
-      fail-fast: false
-      matrix:
-        include:
-          - os: "linux"
-            name: "amd64"
-            runs-on: "ubuntu-20-04"
-            cmake-flags: "-DCORTEX_CPP_VERSION=${{needs.create-draft-release.outputs.version}}"
-            build-deps-cmake-flags: ""
-            arch: "x64"
-            platform: "linux"
-          - os: "mac"
-            name: "amd64"
-            runs-on: "macos-13"
-            cmake-flags: "-DCORTEX_CPP_VERSION=${{needs.create-draft-release.outputs.version}}"
-            build-deps-cmake-flags: ""
-            arch: "x64"
-            platform: "darwin"
-          - os: "mac"
-            name: "arm64"
-            runs-on: "macos-latest"
-            cmake-flags: "-DCORTEX_CPP_VERSION=${{needs.create-draft-release.outputs.version}} -DMAC_ARM64=ON"
-            build-deps-cmake-flags: ""
-            arch: "arm64"
-            platform: "darwin"
-          - os: "windows"
-            name: "amd64"
-            runs-on: "windows-cuda-12-0"
-            cmake-flags: "-DCORTEX_CPP_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
-            build-deps-cmake-flags: "-DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
-            arch: "x64"
-            platform: "win32"
-
-    steps:
-      - name: Clone
-        id: checkout
-        uses: actions/checkout@v3
-        with:
-          submodules: recursive
-
-      - uses: actions/setup-dotnet@v3
-        if: runner.os == 'Windows'
-        with:
-          dotnet-version: "8.0.x"
-
-      - uses: actions/setup-node@v3
-        with:
-          node-version: "20.x"
-          registry-url: "https://registry.npmjs.org"
-
-      - name: Install choco on Windows
-        if: runner.os == 'Windows'
-        run: |
-          choco install make pkgconfiglite ccache awscli 7zip ninja -y
-
-      - name: Download ccache from s3
-        if: runner.os == 'Windows'
-        continue-on-error: true
-        run: |
-          Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
-          refreshenv
-          aws s3 cp s3://${{ secrets.MINIO_BUCKET_NAME }}/cortex-cpp-${{ matrix.os }}-${{ matrix.name }} ${{ matrix.ccache-dir }} --recursive --endpoint ${{ secrets.MINIO_ENDPOINT }}
-        env:
-          AWS_ACCESS_KEY_ID: "${{ secrets.MINIO_ACCESS_KEY_ID }}"
-          AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
-          AWS_DEFAULT_REGION: "${{ secrets.MINIO_REGION }}"
-
-      - name: Get Cer for code signing
-        if: runner.os == 'macOS'
-        run: base64 -d <<< "$CODE_SIGN_P12_BASE64" > /tmp/codesign.p12
-        shell: bash
-        env:
-          CODE_SIGN_P12_BASE64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
-
-      - uses: apple-actions/import-codesign-certs@v2
-        if: runner.os == 'macOS'
-        with:
-          p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
-          p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
-
-      - name: Build
-        run: |
-          cd cortex-cpp
-          make build CMAKE_EXTRA_FLAGS="${{ matrix.cmake-flags }}" BUILD_DEPS_CMAKE_EXTRA_FLAGS="${{ matrix.build-deps-cmake-flags }}"
-
-      - name: Pre-package
-        run: |
-          cd cortex-cpp
-          make pre-package
-
-      - name: Code Signing macOS
-        if: runner.os == 'macOS'
-        run: |
-          cd cortex-cpp
-          make codesign CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}"
-
-      - uses: nick-fields/retry@v3
-        with:
-          continue_on_error: true
-          retry_wait_seconds: 10
-          timeout_minutes: 10
-          max_attempts: 3
-          shell: cmd
-          command: |
-            cd cortex-cpp
-            set PATH=%PATH%;%USERPROFILE%\.dotnet\tools
-            make codesign CODE_SIGN=true AZURE_KEY_VAULT_URI="${{ secrets.AZURE_KEY_VAULT_URI }}" AZURE_CLIENT_ID="${{ secrets.AZURE_CLIENT_ID }}" AZURE_TENANT_ID="${{ secrets.AZURE_TENANT_ID }}" AZURE_CLIENT_SECRET="${{ secrets.AZURE_CLIENT_SECRET }}" AZURE_CERT_NAME="${{ secrets.AZURE_CERT_NAME }}"
-        name: Code Signing Windows
-        if: runner.os == 'Windows'
-
-      - name: Package
-        run: |
-          cd cortex-cpp
-          make package
-
-      - uses: actions/upload-release-asset@v1.0.1
-        if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        with:
-          upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
-          asset_path: ./cortex-cpp/cortex-cpp.tar.gz
-          asset_name: cortex-cpp-${{ needs.create-draft-release.outputs.version }}-${{ matrix.os }}-${{ matrix.name }}.tar.gz
-          asset_content_type: application/gzip
-      - name: Upload ccache to s3
-        continue-on-error: true
-        if: always() && runner.os == 'Windows'
-        run: |
-          Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
-          refreshenv
-          aws s3 cp ${{ matrix.ccache-dir }} s3://${{ secrets.MINIO_BUCKET_NAME }}/cortex-cpp-${{ matrix.os }}-${{ matrix.name }} --recursive --endpoint ${{ secrets.MINIO_ENDPOINT }}
-        env:
-          AWS_ACCESS_KEY_ID: "${{ secrets.MINIO_ACCESS_KEY_ID }}"
-          AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
-          AWS_DEFAULT_REGION: "${{ secrets.MINIO_REGION }}"
-
-      ## cortex-cpp node binding
-
-      # update version in package.json
-      - name: Install jq
-        uses: dcarbone/install-jq-action@v2.0.1
-
-      - name: "Update version by tag"
-        working-directory: cortex-cpp
-        run: |
-          echo "Version: ${{ needs.create-draft-release.outputs.version }}"
-          # Update the version in package.json
-          jq --arg version "${{ needs.create-draft-release.outputs.version }}" '.version = $version' package.json > package-tmp.json
-          rm package.json
-          mv package-tmp.json package.json
-
-      - name: Remove build build-deps and build folder for windows
-        if: runner.os == 'Windows'
-        run: |
-          cd cortex-cpp
-          Remove-Item -Recurse -Force build
-          Remove-Item -Recurse -Force build-deps
-
-      # build prebuilds
-      - name: Build Prebuilds
-        working-directory: cortex-cpp
-        run: |
-          npm install -g yarn
-          yarn && yarn prebuild
-
-      # upload prebuilds
-      - name: Upload Prebuilds Darwin
-        uses: actions/upload-release-asset@v1.0.1
-        if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        with:
-          upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
-          asset_path: ./cortex-cpp/prebuilds/cortex-cpp-v${{ needs.create-draft-release.outputs.version }}-napi-v8-${{matrix.platform}}-${{ matrix.arch }}.tar.gz
-          asset_name: cortex-cpp-v${{ needs.create-draft-release.outputs.version }}-napi-v8-${{matrix.platform}}-${{ matrix.arch }}.tar.gz
-          asset_content_type: application/gzip
-
-      # Setup .npmrc file to publish to npm - upload only once
-      - run: rm -rf build-deps && rm -rf build && rm -rf prebuilds && npm publish --access public
-        continue-on-error: true
-        if: runner.os == 'linux'
-        env:
-          NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
-        working-directory: ./cortex-cpp
-
-      ## cortex-cpp node binding
-
-  update_release_draft:
-    needs: [build-and-test]
-    permissions:
-      # write permission is required to create a github release
-      contents: write
-      # write permission is required for autolabeler
-      # otherwise, read permission is required at least
-      pull-requests: write
-    runs-on: ubuntu-latest
-    steps:
-      # (Optional) GitHub Enterprise requires GHE_HOST variable set
-      #- name: Set GHE_HOST
-      #  run: |
-      #    echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
-
-      # Drafts your next Release notes as Pull Requests are merged into "master"
-      - uses: release-drafter/release-drafter@v5
-        # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
-        # with:
-        #   config-name: my-config.yml
-        #   disable-autolabeler: true
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-
-      
\ No newline at end of file
diff --git a/.github/workflows/cortex-cpp-quality-gate.yml b/.github/workflows/cortex-cpp-quality-gate.yml
index b10bbff2f..b1b3a770c 100644
--- a/.github/workflows/cortex-cpp-quality-gate.yml
+++ b/.github/workflows/cortex-cpp-quality-gate.yml
@@ -92,8 +92,8 @@ jobs:
       - name: Upload Artifact
         uses: actions/upload-artifact@v4
         with:
-          name: cortex-cpp-${{ matrix.os }}-${{ matrix.name }}
-          path: ./engine/cortex-cpp
+          name: cortex-${{ matrix.os }}-${{ matrix.name }}
+          path: ./engine/cortex
 
       - name: Upload ccache to s3
         continue-on-error: true
@@ -101,7 +101,7 @@ jobs:
         run: |
           Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
           refreshenv
-          aws s3 cp ${{ matrix.ccache-dir }} s3://${{ secrets.MINIO_BUCKET_NAME }}/cortex-cpp-${{ matrix.os }}-${{ matrix.name }} --recursive --endpoint ${{ secrets.MINIO_ENDPOINT }}
+          aws s3 cp ${{ matrix.ccache-dir }} s3://${{ secrets.MINIO_BUCKET_NAME }}/cortex-${{ matrix.os }}-${{ matrix.name }} --recursive --endpoint ${{ secrets.MINIO_ENDPOINT }}
         env:
           AWS_ACCESS_KEY_ID: "${{ secrets.MINIO_ACCESS_KEY_ID }}"
           AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
diff --git a/.github/workflows/nightly-build.yml b/.github/workflows/nightly-build.yml
index 1d68b129a..a242c699f 100644
--- a/.github/workflows/nightly-build.yml
+++ b/.github/workflows/nightly-build.yml
@@ -1,178 +1,111 @@
 name: CI Cortex CPP Nightly Build
 
 on:
-  push:
-    tags: ["v[0-9]+.[0-9]+.[0-9]+-[0-9]+.[0-9]+.[0-9]+"]
-    paths:
-      [
-        "cortex-cpp/**",
-      ]
+  schedule:
+      - cron: '0 20 * * *' # At 8 PM UTC everyday
   workflow_dispatch:
-
-env:
-  LLM_MODEL_URL: https://delta.jan.ai/tinyllama-1.1b-chat-v0.3.Q2_K.gguf
-  EMBEDDING_MODEL_URL: https://catalog.jan.ai/dist/models/embeds/nomic-embed-text-v1.5.f16.gguf
+    inputs:
+      public_provider:
+        type: choice
+        description: 'Public Provider'
+        options:
+          - none
+          - aws-s3
+        default: none
 
 jobs:
-  create-draft-release:
+  set-public-provider:
     runs-on: ubuntu-latest
-    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
     outputs:
-      upload_url: ${{ steps.create_release.outputs.upload_url }}
-      version: ${{ steps.get_version.outputs.version }}
-    permissions:
-      contents: write
-    steps:
-      - name: Extract tag name without v prefix
-        id: get_version
-        run: |
-          echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV && echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
-        env:
-          GITHUB_REF: ${{ github.ref }}
-      - name: Create Draft Release
-        id: create_release
-        uses: softprops/action-gh-release@v2
-        with:
-          tag_name: ${{ github.ref_name }}
-          token: ${{ secrets.GITHUB_TOKEN }}
-          name: "${{ env.VERSION }}"
-          draft: false
-          generate_release_notes: true
-          prerelease: true
-
-  build-and-test:
-    runs-on: ${{ matrix.runs-on }}
-    needs: [create-draft-release]
-    timeout-minutes: 40
-    strategy:
-      fail-fast: false
-      matrix:
-        include:
-          - os: "linux"
-            name: "amd64"
-            runs-on: "ubuntu-20-04"
-            cmake-flags: "-DCORTEX_CPP_VERSION=${{needs.create-draft-release.outputs.version}}"
-            build-deps-cmake-flags: ""
-            ccache-dir: ''
-          - os: "mac"
-            name: "amd64"
-            runs-on: "macos-13"
-            cmake-flags: "-DCORTEX_CPP_VERSION=${{needs.create-draft-release.outputs.version}}"
-            build-deps-cmake-flags: ""
-            ccache-dir: ''
-          - os: "mac"
-            name: "arm64"
-            runs-on: "mac-silicon"
-            cmake-flags: "-DCORTEX_CPP_VERSION=${{needs.create-draft-release.outputs.version}} -DMAC_ARM64=ON"
-            build-deps-cmake-flags: ""
-            ccache-dir: ''
-          - os: "windows"
-            name: "amd64"
-            runs-on: "windows-cuda-12-0"
-            cmake-flags: "-DCORTEX_CPP_VERSION=${{needs.create-draft-release.outputs.version}} -DBUILD_SHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
-            build-deps-cmake-flags: "-DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
-            ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
-
+      public_provider: ${{ steps.set-public-provider.outputs.public_provider }}
+      ref: ${{ steps.set-public-provider.outputs.ref }}
     steps:
-      - name: Clone
-        id: checkout
-        uses: actions/checkout@v3
-        with:
-          submodules: recursive
-
-      - uses: actions/setup-dotnet@v3
-        if: runner.os == 'Windows'
-        with:
-          dotnet-version: "8.0.x"
-
-      - name: Install choco on Windows
-        if: runner.os == 'Windows'
+      - name: Set public provider
+        id: set-public-provider
         run: |
-          choco install make pkgconfiglite ccache awscli 7zip ninja -y
+          if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
+            echo "::set-output name=public_provider::${{ github.event.inputs.public_provider }}"
+            echo "::set-output name=ref::${{ github.ref }}"
+          else
+            if [ "${{ github.event_name }}" == "schedule" ]; then
+              echo "::set-output name=public_provider::aws-s3"
+              echo "::set-output name=ref::refs/heads/dev"
+            elif [ "${{ github.event_name }}" == "push" ]; then
+              echo "::set-output name=public_provider::aws-s3"
+              echo "::set-output name=ref::${{ github.ref }}"
+            else
+              echo "::set-output name=public_provider::none"
+              echo "::set-output name=ref::${{ github.ref }}"
+            fi
+          fi
 
-      - name: Download ccache from s3
-        if: runner.os == 'Windows'
-        continue-on-error: true
-        run: |
-          Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
-          refreshenv
-          aws s3 cp s3://${{ secrets.MINIO_BUCKET_NAME }}/cortex-cpp-${{ matrix.os }}-${{ matrix.name }} ${{ matrix.ccache-dir }} --recursive --endpoint ${{ secrets.MINIO_ENDPOINT }}
-        env:
-          AWS_ACCESS_KEY_ID: "${{ secrets.MINIO_ACCESS_KEY_ID }}"
-          AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
-          AWS_DEFAULT_REGION: "${{ secrets.MINIO_REGION }}"
+  # Job create Update app version based on latest release tag with build number and save to output
+  get-update-version:
+    uses: ./.github/workflows/template-get-update-version.yml
 
-      - name: Get Cer for code signing
-        if: runner.os == 'macOS'
-        run: base64 -d <<< "$CODE_SIGN_P12_BASE64" > /tmp/codesign.p12
-        shell: bash
-        env:
-          CODE_SIGN_P12_BASE64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
-  
-      - uses: apple-actions/import-codesign-certs@v2
-        if: runner.os == 'macOS'
-        with:
-          p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
-          p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
+  build-macos-x64:
+    uses: ./.github/workflows/template-build-macos.yml
+    needs: [get-update-version, set-public-provider]
+    secrets: inherit
+    with:
+      ref: ${{ needs.set-public-provider.outputs.ref }}
+      public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
+      new_version: ${{ needs.get-update-version.outputs.new_version }}
+      runs-on: macos-12
+      cmake-flags: "-DCORTEX_VARIANT=nightly -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
+      channel: nightly
+      arch: amd64
 
-      - name: Build
-        run: |
-          cd cortex-cpp
-          make build CMAKE_EXTRA_FLAGS="${{ matrix.cmake-flags }}" BUILD_DEPS_CMAKE_EXTRA_FLAGS="${{ matrix.build-deps-cmake-flags }}"
+  build-macos-arm64:
+    uses: ./.github/workflows/template-build-macos.yml
+    needs: [get-update-version, set-public-provider]
+    secrets: inherit
+    with:
+      ref: ${{ needs.set-public-provider.outputs.ref }}
+      public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
+      new_version: ${{ needs.get-update-version.outputs.new_version }}
+      runs-on: macos-latest
+      cmake-flags: "-DCORTEX_VARIANT=nightly -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DMAC_ARM64=ON -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
+      channel: nightly
+      arch: arm64
 
-      - name: Pre-package
-        run: |
-          cd cortex-cpp
-          make pre-package
+  build-windows-x64:
+    uses: ./.github/workflows/template-build-windows-x64.yml
+    secrets: inherit
+    needs: [get-update-version, set-public-provider]
+    with:
+      ref: ${{ needs.set-public-provider.outputs.ref }}
+      public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
+      new_version: ${{ needs.get-update-version.outputs.new_version }}
+      runs-on: windows-cuda-11-7
+      cmake-flags: "-DCORTEX_VARIANT=nightly -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=C:/w/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
+      build-deps-cmake-flags: "-DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
+      ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
+      channel: nightly
           
-      - name: Code Signing macOS
-        if: runner.os == 'macOS'
-        run: |
-          cd cortex-cpp
-          make codesign CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}"
-
-      - uses: nick-fields/retry@v3
-        with:
-          continue_on_error: true
-          retry_wait_seconds: 10
-          timeout_minutes: 10
-          max_attempts: 3
-          shell: cmd
-          command: |
-            cd cortex-cpp
-            set PATH=%PATH%;%USERPROFILE%\.dotnet\tools
-            make codesign CODE_SIGN=true AZURE_KEY_VAULT_URI="${{ secrets.AZURE_KEY_VAULT_URI }}" AZURE_CLIENT_ID="${{ secrets.AZURE_CLIENT_ID }}" AZURE_TENANT_ID="${{ secrets.AZURE_TENANT_ID }}" AZURE_CLIENT_SECRET="${{ secrets.AZURE_CLIENT_SECRET }}" AZURE_CERT_NAME="${{ secrets.AZURE_CERT_NAME }}"
-        name: Code Signing Windows
-        if: runner.os == 'Windows'
-
-      - name: Package
-        run: |
-          cd cortex-cpp
-          make package      
-
-      - name: Upload Artifact
-        uses: actions/upload-artifact@v4
-        with:
-          name: cortex-cpp-${{ matrix.os }}-${{ matrix.name }}
-          path: ./cortex-cpp/cortex-cpp
-
-      - uses: actions/upload-release-asset@v1.0.1
-        if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-        with:
-          upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
-          asset_path: ./cortex-cpp/cortex-cpp.tar.gz
-          asset_name: cortex-cpp-${{ needs.create-draft-release.outputs.version }}-${{ matrix.os }}-${{ matrix.name }}.tar.gz
-          asset_content_type: application/gzip
-      - name: Upload ccache to s3
-        continue-on-error: true
-        if: always() && runner.os == 'Windows'
+  build-linux-x64:
+    uses: ./.github/workflows/template-build-linux-x64.yml
+    secrets: inherit
+    needs: [get-update-version, set-public-provider]
+    with:
+      ref: ${{ needs.set-public-provider.outputs.ref }}
+      public_provider: ${{ needs.set-public-provider.outputs.public_provider }}
+      new_version: ${{ needs.get-update-version.outputs.new_version }}
+      runs-on: ubuntu-20-04
+      cmake-flags: "-DCORTEX_VARIANT=nightly -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DCMAKE_TOOLCHAIN_FILE=/home/runner/actions-runner/_work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
+      channel: nightly
+  
+  update-latest-version:
+    runs-on: ubuntu-latest
+    needs: [get-update-version, set-public-provider, build-linux-x64, build-macos-x64, build-macos-arm64, build-windows-x64]
+    steps:
+      - name: Update latest version
+        id: update-latest-version
         run: |
-          Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
-          refreshenv
-          aws s3 cp ${{ matrix.ccache-dir }} s3://${{ secrets.MINIO_BUCKET_NAME }}/cortex-cpp-${{ matrix.os }}-${{ matrix.name }} --recursive --endpoint ${{ secrets.MINIO_ENDPOINT }}
+          echo "{\"tag_name\": \"${{ needs.get-update-version.outputs.new_version }}\"}" > version.json
+          aws s3 cp version.json s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/version.json
         env:
-          AWS_ACCESS_KEY_ID: "${{ secrets.MINIO_ACCESS_KEY_ID }}"
-          AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
-          AWS_DEFAULT_REGION: "${{ secrets.MINIO_REGION }}"
+          AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
+          AWS_SECRET_ACCESS_KEY: ${{ secrets.DELTA_AWS_SECRET_ACCESS_KEY }}
+          AWS_DEFAULT_REGION: ${{ secrets.DELTA_AWS_REGION }}
+          AWS_EC2_METADATA_DISABLED: "true"
\ No newline at end of file
diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml
deleted file mode 100644
index 5fadcae59..000000000
--- a/.github/workflows/nightly.yml
+++ /dev/null
@@ -1,174 +0,0 @@
-name: Nightly Update cortex.llamacpp
-
-on:
-  schedule:
-    - cron: '30 18 * * 1-5' # At 01:30 on every day-of-week from Monday through Friday UTC +7
-  workflow_dispatch:
-
-jobs:
-  update-submodule:
-    runs-on: ubuntu-latest
-    permissions:
-      contents: write
-      pull-requests: write
-      actions: write
-
-    outputs:
-      pr_number: ${{ steps.check-update.outputs.pr_number }}
-      pr_created: ${{ steps.check-update.outputs.pr_created }}
-
-    steps:
-    - name: Checkout repository
-      uses: actions/checkout@v3
-      with:
-        submodules: recursive
-        ref: dev
-        fetch-depth: 0
-        token: ${{ secrets.PAT_SERVICE_ACCOUNT }}
-
-    - name: Configure Git
-      run: |
-        git config --global user.name 'github-actions[bot]'
-        git config --global user.email 'github-actions[bot]@users.noreply.github.com'
-
-    - name: Update submodule to latest release
-      id: check-update
-      env:
-        GITHUB_TOKEN: ${{ secrets.PAT_SERVICE_ACCOUNT }}
-      run: |
-        cd cortex-cpp
-        curl -s https://api.github.com/repos/janhq/cortex.llamacpp/releases > /tmp/github_api_releases.json
-        latest_prerelease_name=$(cat /tmp/github_api_releases.json | jq -r '.[] | select(.prerelease) | .name' | head -n 1)
-
-        get_asset_count() {
-          local version_name=$1
-          cat /tmp/github_api_releases.json | jq -r --arg version_name "$version_name" '.[] | select(.name == $version_name) | .assets | length'
-        }
-
-        engine_cmake_path="engines/cortex.llamacpp/engine.cmake"
-        current_version=$(grep -oP 'set\(VERSION \K[^\)]+' "$engine_cmake_path")
-
-        current_version_asset_count=$(get_asset_count "$current_version")
-        latest_prerelease_asset_count=$(get_asset_count "$latest_prerelease_name")
-
-        if [ "$current_version" = "$latest_prerelease_name" ]; then
-          echo "cortex.llamacpp remote repo doesn't have update today, skip nightly build"
-          echo "::set-output name=pr_created::false"
-          exit 0
-        fi
-
-        if [ "$current_version_asset_count" != "$latest_prerelease_asset_count" ]; then
-          echo "Latest prerelease version has different number of assets, somethink went wrong, skip update cortex-cpp for today nightly build"
-          echo "::set-output name=pr_created::false"
-          exit 1
-        fi
-
-        sed -i "s/set(VERSION $current_version)/set(VERSION $latest_prerelease_name)/" "$engine_cmake_path"
-        echo "Updated version from $current_version to $latest_prerelease_name."
-        echo "::set-output name=pr_created::true"
-        cd -
-        git add cortex-cpp/$engine_cmake_path
-        git commit -m "Update cortex.llamacpp nightly to version $latest_prerelease_name"
-        branch_name="update-nightly-$(date +'%Y-%m-%d-%H-%M')"
-        git checkout -b $branch_name
-        git push origin $branch_name
-
-        pr_title="Update cortex.llamacpp nightly to version $latest_prerelease_name"
-        pr_body="This PR updates the Update cortex.llamacpp nightly to version $latest_prerelease_name"
-
-        gh pr create --title "$pr_title" --body "$pr_body" --head $branch_name --base dev --reviewer vansangpfiev
-        
-        pr_number=$(gh pr list --head $branch_name --json number --jq '.[0].number')
-        echo "::set-output name=pr_number::$pr_number"
-
-  check-and-merge-pr:
-    needs: update-submodule
-    if: needs.update-submodule.outputs.pr_created == 'true'
-    runs-on: ubuntu-latest
-    permissions:
-      contents: write
-      pull-requests: write
-
-    steps:
-    - name: Checkout repository
-      uses: actions/checkout@v3
-      with:
-        submodules: recursive
-        fetch-depth: 0
-        token: ${{ secrets.PAT_SERVICE_ACCOUNT }}
-
-    - name: Wait for CI to pass
-      env:
-          GITHUB_TOKEN: ${{ secrets.PAT_SERVICE_ACCOUNT }}
-      run: |
-        pr_number=${{ needs.update-submodule.outputs.pr_number }}
-        while true; do
-          ci_completed=$(gh pr checks $pr_number --json completedAt --jq '.[].completedAt')
-          if echo "$ci_completed" | grep -q "0001-01-01T00:00:00Z"; then
-            echo "CI is still running, waiting..."
-            sleep 60
-          else
-            echo "CI has completed, checking states..."
-            ci_states=$(gh pr checks $pr_number --json state --jq '.[].state')
-            if echo "$ci_states" | grep -vqE "SUCCESS|SKIPPED"; then
-              echo "CI failed, exiting..."
-              exit 1
-            else
-              echo "CI passed, merging PR..."
-              break
-            fi
-          fi
-        done
-
-    - name: Merge the PR
-      env:
-          GITHUB_TOKEN: ${{ secrets.PAT_SERVICE_ACCOUNT }}
-      run: |
-        pr_number=${{ needs.update-submodule.outputs.pr_number }}
-        gh pr merge $pr_number --merge --admin
-
-  create-tag:
-    needs: [update-submodule, check-and-merge-pr]
-    if: needs.update-submodule.outputs.pr_created == 'true'
-    runs-on: ubuntu-latest
-    steps:
-    - name: Checkout repository
-      uses: actions/checkout@v3
-      with:
-        submodules: recursive
-        ref: dev
-        fetch-depth: 0
-        token: ${{ secrets.PAT_SERVICE_ACCOUNT }}
-
-    - name: Configure Git
-      run: |
-        git config --global user.name 'github-actions[bot]'
-        git config --global user.email 'github-actions[bot]@users.noreply.github.com'
-
-    - name: Create and push a new tag
-      run: |
-        # Function to get the latest release tag
-        get_latest_tag() {
-          local retries=0
-          local max_retries=3
-          local tag
-          while [ $retries -lt $max_retries ]; do
-            tag=$(curl -s https://api.github.com/repos/janhq/cortex/releases/latest | jq -r .tag_name)
-            if [ -n "$tag" ] && [ "$tag" != "null" ]; then
-              echo $tag
-              return
-            else
-              let retries++
-              echo "Retrying... ($retries/$max_retries)"
-              sleep 2
-            fi
-          done
-          echo "Failed to fetch latest tag after $max_retries attempts."
-          exit 1
-        }
-
-        LATEST_TAG=$(get_latest_tag)
-        date_suffix=$(date +'%d.%m.%y')
-        new_tag="${LATEST_TAG}-${date_suffix}"
-        git tag $new_tag
-        git push origin $new_tag
diff --git a/.github/workflows/stable-build.yml b/.github/workflows/stable-build.yml
new file mode 100644
index 000000000..c80388f96
--- /dev/null
+++ b/.github/workflows/stable-build.yml
@@ -0,0 +1,114 @@
+name: CI Cortex CPP Stable Build
+
+on:
+  push:
+    tags: ["v[0-9]+.[0-9]+.[0-9]+"]
+
+jobs:
+  # Job create Update app version based on latest release tag with build number and save to output
+  get-update-version:
+    uses: ./.github/workflows/template-get-update-version.yml
+
+  create-draft-release:
+    runs-on: ubuntu-latest
+    if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
+    outputs:
+      upload_url: ${{ steps.create_release.outputs.upload_url }}
+      version: ${{ steps.get_version.outputs.version }}
+    permissions:
+      contents: write
+    steps:
+      - name: Extract tag name without v prefix
+        id: get_version
+        run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV && echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
+        env:
+          GITHUB_REF: ${{ github.ref }}
+      - name: Create Draft Release
+        id: create_release
+        uses: softprops/action-gh-release@v2
+        with:
+          tag_name: ${{ github.ref_name }}
+          token: ${{ secrets.GITHUB_TOKEN }}
+          name: "${{ env.VERSION }}"
+          draft: true
+          prerelease: false
+
+  build-macos-x64:
+    uses: ./.github/workflows/template-build-macos.yml
+    needs: [get-update-version, create-draft-release]
+    secrets: inherit
+    with:
+      ref: ${{ github.ref }}
+      public_provider: github
+      new_version: ${{ needs.get-update-version.outputs.new_version }}
+      runs-on: macos-12
+      cmake-flags: "-DCORTEX_VARIANT=prod -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
+      channel: stable
+      arch: amd64
+      upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
+
+  build-macos-arm64:
+    uses: ./.github/workflows/template-build-macos.yml
+    needs: [get-update-version, create-draft-release]
+    secrets: inherit
+    with:
+      ref: ${{ github.ref }}
+      public_provider: github
+      new_version: ${{ needs.get-update-version.outputs.new_version }}
+      runs-on: macos-latest
+      cmake-flags: "-DCORTEX_VARIANT=prod -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DMAC_ARM64=ON -DCMAKE_TOOLCHAIN_FILE=/Users/runner/work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
+      channel: stable
+      arch: arm64
+      upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
+
+  build-windows-x64:
+    uses: ./.github/workflows/template-build-windows-x64.yml
+    secrets: inherit
+    needs: [get-update-version, create-draft-release]
+    with:
+      ref: ${{ github.ref }}
+      public_provider: github
+      new_version: ${{ needs.get-update-version.outputs.new_version }}
+      runs-on: windows-cuda-11-7
+      cmake-flags: "-DCORTEX_VARIANT=prod -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DBUILD_SHARED_LIBS=OFF -DCMAKE_TOOLCHAIN_FILE=C:/w/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=x64-windows-static -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
+      build-deps-cmake-flags: "-DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache -GNinja"
+      ccache-dir: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
+      channel: stable
+      upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
+          
+  build-linux-x64:
+    uses: ./.github/workflows/template-build-linux-x64.yml
+    secrets: inherit
+    needs: [get-update-version, create-draft-release]
+    with:
+      ref: ${{ github.ref }}
+      public_provider: github
+      new_version: ${{ needs.get-update-version.outputs.new_version }}
+      runs-on: ubuntu-20-04
+      cmake-flags: "-DCORTEX_VARIANT=prod -DCORTEX_CPP_VERSION=${{ needs.get-update-version.outputs.new_version }} -DCMAKE_TOOLCHAIN_FILE=/home/runner/actions-runner/_work/cortex.cpp/cortex.cpp/engine/vcpkg/scripts/buildsystems/vcpkg.cmake"
+      channel: stable
+      upload_url: ${{ needs.create-draft-release.outputs.upload_url }}
+
+  update_release_draft:
+    needs: [build-macos-x64, build-macos-arm64, build-windows-x64, build-linux-x64]
+    permissions:
+      # write permission is required to create a github release
+      contents: write
+      # write permission is required for autolabeler
+      # otherwise, read permission is required at least
+      pull-requests: write
+    runs-on: ubuntu-latest
+    steps:
+      # (Optional) GitHub Enterprise requires GHE_HOST variable set
+      #- name: Set GHE_HOST
+      #  run: |
+      #    echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
+
+      # Drafts your next Release notes as Pull Requests are merged into "master"
+      - uses: release-drafter/release-drafter@v5
+        # (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
+        # with:
+        #   config-name: my-config.yml
+        #   disable-autolabeler: true
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/template-build-linux-x64.yml b/.github/workflows/template-build-linux-x64.yml
new file mode 100644
index 000000000..fdb7801f4
--- /dev/null
+++ b/.github/workflows/template-build-linux-x64.yml
@@ -0,0 +1,187 @@
+name: build-linux-x64
+on:
+  workflow_call:
+    inputs:
+      ref:
+        required: true
+        type: string
+        default: 'refs/heads/main'
+      public_provider:
+        required: true
+        type: string
+        default: none
+        description: 'none: build only, github: build and publish to github, aws s3: build and publish to aws s3'
+      new_version:
+        required: true
+        type: string
+        default: ''
+      upload_url:
+        required: false
+        type: string
+        default: ''
+      runs-on:
+        required: false
+        type: string
+        default: 'ubuntu-20-04-cuda-12-0'
+        description: 'The runner to use for this job'
+      cmake-flags:
+        required: false
+        type: string
+        default: ''
+        description: 'The cmake flags to use for this job'
+      build-deps-cmake-flags:
+        required: false
+        type: string
+        default: ''
+        description: 'The cmake flags to use for this job'
+      ccache-dir:
+        required: false
+        type: string
+        default: ''
+        description: 'The ccache directory to use for this job'
+      channel:
+        required: true
+        type: string
+        default: 'nightly'
+        description: 'The channel to use for this job'
+    secrets:
+      DELTA_AWS_S3_BUCKET_NAME:
+        required: false
+      DELTA_AWS_ACCESS_KEY_ID:
+        required: false
+      DELTA_AWS_SECRET_ACCESS_KEY:
+        required: false
+      DELTA_AWS_REGION:
+        required: false
+
+jobs:
+  build-linux-x64:
+    runs-on: ${{ inputs.runs-on }}
+    permissions:
+      contents: write
+    steps:
+      - name: Getting the repo
+        uses: actions/checkout@v3
+        with:
+          ref: ${{ inputs.ref }}
+          submodules: 'recursive'
+
+      - name: use python 3.9
+        uses: actions/setup-python@v4
+        with:
+          python-version: '3.9'
+
+      - name: Set output params for each channel
+        id : set-output-params
+        shell: bash
+        run: |
+          # Set output for stable channel
+          if [ "${{ inputs.channel }}" == "stable" ]; then
+            echo "::set-output name=package_name::cortexcpp"
+            echo "::set-output name=destination_binary_name::cortex"
+            echo "::set-output name=data_folder_name::cortexcpp"
+            echo "::set-output name=configuration_file_name::.cortexrc"
+            echo "::set-output name=uninstaller_file_name::cortex-uninstall.sh"
+            echo "::set-output name=iss_file_name::installer.iss"
+          fi
+
+          # Set output for beta channel
+          if [ "${{ inputs.channel }}" == "beta" ]; then
+            echo "::set-output name=package_name::cortexcpp-beta"
+            echo "::set-output name=destination_binary_name::cortex-beta"
+            echo "::set-output name=data_folder_name::cortexcpp-beta"
+            echo "::set-output name=configuration_file_name::.cortexrc-beta"
+            echo "::set-output name=uninstaller_file_name::cortex-beta-uninstall.sh"
+            echo "::set-output name=iss_file_name::installer-beta.iss"
+          fi
+
+          # Set output for nightly channel
+          if [ "${{ inputs.channel }}" == "nightly" ]; then
+            echo "::set-output name=package_name::cortexcpp-nightly"
+            echo "::set-output name=destination_binary_name::cortex-nightly"
+            echo "::set-output name=data_folder_name::cortexcpp-nightly"
+            echo "::set-output name=configuration_file_name::.cortexrc-nightly"
+            echo "::set-output name=uninstaller_file_name::cortex-nightly-uninstall.sh"
+            echo "::set-output name=iss_file_name::installer-nightly.iss"
+          fi
+
+      - name: Install jq
+        uses: dcarbone/install-jq-action@v2.0.1
+
+      - name: Install dependencies linux
+        run: |
+          sudo apt update && sudo apt install gettext-base -y
+          python3 -m pip install awscli
+
+      - name: Configure vcpkg
+        run: |
+          cd engine
+          make configure-vcpkg
+
+      - name: Build
+        run: |
+          cd engine
+          make build CMAKE_EXTRA_FLAGS="${{ inputs.cmake-flags }}" BUILD_DEPS_CMAKE_EXTRA_FLAGS="${{ inputs.build-deps-cmake-flags }}"
+
+      - name: Pre-package
+        run: |
+          cd engine
+          make pre-package
+
+      - name: Build Installers
+        shell: bash
+        run: |
+          cd engine
+          make build-installer PACKAGE_NAME="${{ steps.set-output-params.outputs.package_name }}" VERSION=${{ inputs.new_version }} DESTINATION_BINARY_NAME="${{ steps.set-output-params.outputs.destination_binary_name }}" DATA_FOLDER_NAME="${{ steps.set-output-params.outputs.data_folder_name }}" CONFIGURATION_FILE_NAME="${{ steps.set-output-params.outputs.configuration_file_name }}" UNINSTALLER_FILE_NAME="${{ steps.set-output-params.outputs.uninstaller_file_name }}"
+
+      - name: Package
+        run: |
+          cd engine
+          make package
+
+      - name: Upload Artifact
+        uses: actions/upload-artifact@v4
+        with:
+          name: cortex-${{ inputs.new_version }}-linux-amd64
+          path: ./engine/cortex
+
+      - name: Upload Artifact
+        uses: actions/upload-artifact@v4
+        with:
+          name: cortex-${{ inputs.new_version }}-linux-amd64-installer
+          path: ./engine/${{ steps.set-output-params.outputs.package_name }}.deb
+
+      - name: upload to aws s3 if public provider is aws
+        if: inputs.public_provider == 'aws-s3'
+        run: |
+          aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/linux-amd64/cortex-nightly.tar.gz
+
+          aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/linux-amd64/cortex-nightly-${{ inputs.new_version }}.tar.gz
+          aws s3 cp ./engine/${{ steps.set-output-params.outputs.package_name }}.deb s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/linux-amd64/cortex-linux-amd64-installer-${{ inputs.new_version }}.deb
+        env:
+          AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
+          AWS_SECRET_ACCESS_KEY: ${{ secrets.DELTA_AWS_SECRET_ACCESS_KEY }}
+          AWS_DEFAULT_REGION: ${{ secrets.DELTA_AWS_REGION }}
+          AWS_EC2_METADATA_DISABLED: "true"
+
+      - name: Upload release assert if public provider is github
+        if: inputs.public_provider == 'github'
+        uses: actions/upload-release-asset@v1.0.1
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        with:
+          upload_url: ${{ inputs.upload_url }}
+          asset_path: ./engine/cortex.tar.gz
+          asset_name: cortex-${{ inputs.new_version }}-linux-amd64.tar.gz
+          asset_content_type: application/zip
+
+      - name: Upload release assert if public provider is github
+        if: inputs.public_provider == 'github'
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        uses: actions/upload-release-asset@v1.0.1
+        with:
+          upload_url: ${{ inputs.upload_url }}
+          asset_path: ./engine/${{ steps.set-output-params.outputs.package_name }}.deb
+          asset_name: cortex-${{ inputs.new_version }}-linux-amd64-installer.deb
+          asset_content_type: application/octet-stream
\ No newline at end of file
diff --git a/.github/workflows/template-build-macos.yml b/.github/workflows/template-build-macos.yml
new file mode 100644
index 000000000..209a50f33
--- /dev/null
+++ b/.github/workflows/template-build-macos.yml
@@ -0,0 +1,236 @@
+name: build-mac-x64
+on:
+  workflow_call:
+    inputs:
+      ref:
+        required: true
+        type: string
+        default: 'refs/heads/main'
+      public_provider:
+        required: true
+        type: string
+        default: none
+        description: 'none: build only, github: build and publish to github, aws s3: build and publish to aws s3'
+      new_version:
+        required: true
+        type: string
+        default: ''
+      upload_url:
+        required: false
+        type: string
+        default: ''
+      runs-on:
+        required: false
+        type: string
+        default: 'macos-latest'
+        description: 'The runner to use for this job'
+      cmake-flags:
+        required: false
+        type: string
+        default: ''
+        description: 'The cmake flags to use for this job'
+      build-deps-cmake-flags:
+        required: false
+        type: string
+        default: ''
+        description: 'The cmake flags to use for this job'
+      ccache-dir:
+        required: false
+        type: string
+        default: ''
+        description: 'The ccache directory to use for this job'
+      channel:
+        required: true
+        type: string
+        default: 'nightly'
+        description: 'The channel to use for this job'
+      arch:
+        required: true
+        type: string
+        default: 'arm64'
+        description: 'The architecture to use for this job'
+    secrets:
+      DELTA_AWS_S3_BUCKET_NAME:
+        required: false
+      DELTA_AWS_ACCESS_KEY_ID:
+        required: false
+      DELTA_AWS_SECRET_ACCESS_KEY:
+        required: false
+      DELTA_AWS_REGION:
+        required: false
+      NOTARIZE_P8_BASE64:
+        required: false
+      CODE_SIGN_P12_BASE64:
+        required: false
+      CODE_SIGN_P12_PASSWORD:
+        required: false
+      DEVELOPER_ID:
+        required: false
+      NOTARY_KEY_ID:
+        required: false
+      NOTARY_ISSUER:
+        required: false
+      APPLE_ID:
+        required: false
+      APPLE_APP_SPECIFIC_PASSWORD:
+        required: false
+      APPLE_TEAM_ID:
+        required: false
+
+jobs:
+  build-mac-x64:
+    runs-on: ${{ inputs.runs-on }}
+    permissions:
+      contents: write
+    steps:
+      - name: Getting the repo
+        uses: actions/checkout@v3
+        with:
+          ref: ${{ inputs.ref }}
+          submodules: 'recursive'
+
+      - name: Set output params for each channel
+        id : set-output-params
+        shell: bash
+        run: |
+          # Set output for stable channel
+          if [ "${{ inputs.channel }}" == "stable" ]; then
+            echo "::set-output name=package_name::cortexcpp"
+            echo "::set-output name=destination_binary_name::cortex"
+            echo "::set-output name=data_folder_name::cortexcpp"
+            echo "::set-output name=configuration_file_name::.cortexrc"
+            echo "::set-output name=uninstaller_file_name::cortex-uninstall.sh"
+            echo "::set-output name=iss_file_name::installer.iss"
+          fi
+
+          # Set output for beta channel
+          if [ "${{ inputs.channel }}" == "beta" ]; then
+            echo "::set-output name=package_name::cortexcpp-beta"
+            echo "::set-output name=destination_binary_name::cortex-beta"
+            echo "::set-output name=data_folder_name::cortexcpp-beta"
+            echo "::set-output name=configuration_file_name::.cortexrc-beta"
+            echo "::set-output name=uninstaller_file_name::cortex-beta-uninstall.sh"
+            echo "::set-output name=iss_file_name::installer-beta.iss"
+          fi
+
+          # Set output for nightly channel
+          if [ "${{ inputs.channel }}" == "nightly" ]; then
+            echo "::set-output name=package_name::cortexcpp-nightly"
+            echo "::set-output name=destination_binary_name::cortex-nightly"
+            echo "::set-output name=data_folder_name::cortexcpp-nightly"
+            echo "::set-output name=configuration_file_name::.cortexrc-nightly"
+            echo "::set-output name=uninstaller_file_name::cortex-nightly-uninstall.sh"
+            echo "::set-output name=iss_file_name::installer-nightly.iss"
+          fi
+
+      - name: Install jq
+        uses: dcarbone/install-jq-action@v2.0.1
+
+      - name: Get Cer for code signing
+        run: base64 -d <<< "$NOTARIZE_P8_BASE64" > /tmp/notary-key.p8
+        shell: bash
+        env:
+          NOTARIZE_P8_BASE64: ${{ secrets.NOTARIZE_P8_BASE64 }}
+
+      - uses: apple-actions/import-codesign-certs@v2
+        continue-on-error: true
+        with:
+          p12-file-base64: ${{ secrets.CODE_SIGN_P12_BASE64 }}
+          p12-password: ${{ secrets.CODE_SIGN_P12_PASSWORD }}
+
+      - name: Configure vcpkg
+        run: |
+          cd engine
+          make configure-vcpkg
+      
+      - name: Build
+        run: |
+          cd engine
+          make build CMAKE_EXTRA_FLAGS="${{ inputs.cmake-flags }}" BUILD_DEPS_CMAKE_EXTRA_FLAGS="${{ inputs.build-deps-cmake-flags }}"
+
+      - name: Pre-package
+        run: |
+          cd engine
+          make pre-package
+
+      - name: Code Signing binaries
+        run: |
+          cd engine
+          make codesign-binary CODE_SIGN=true DEVELOPER_ID="${{ secrets.DEVELOPER_ID }}"
+
+      - name: Notary macOS Binary
+        run: |
+          curl -sSfL https://raw.githubusercontent.com/anchore/quill/main/install.sh | sh -s -- -b /usr/local/bin
+          cd engine/cortex
+          # Notarize the binary
+          quill notarize ./cortex
+        env:
+          QUILL_NOTARY_KEY_ID: ${{ secrets.NOTARY_KEY_ID }}
+          QUILL_NOTARY_ISSUER: ${{ secrets.NOTARY_ISSUER }}
+          QUILL_NOTARY_KEY: "/tmp/notary-key.p8"
+
+      - name: Build Installers
+        shell: bash
+        run: |
+          cd engine
+          make build-installer PACKAGE_NAME="${{ steps.set-output-params.outputs.package_name }}" VERSION=${{ inputs.new_version }} DESTINATION_BINARY_NAME="${{ steps.set-output-params.outputs.destination_binary_name }}" DATA_FOLDER_NAME="${{ steps.set-output-params.outputs.data_folder_name }}" CONFIGURATION_FILE_NAME="${{ steps.set-output-params.outputs.configuration_file_name }}" UNINSTALLER_FILE_NAME="${{ steps.set-output-params.outputs.uninstaller_file_name }}"
+
+      - name: Codesign and notary for macos installer
+        run: |
+          cd engine
+          productsign --sign "Developer ID Installer: ${{ secrets.DEVELOPER_ID }}" ${{ steps.set-output-params.outputs.package_name }}.pkg ${{ steps.set-output-params.outputs.package_name }}$-signed.pkg
+          rm ${{ steps.set-output-params.outputs.package_name }}.pkg
+          mv ${{ steps.set-output-params.outputs.package_name }}$-signed.pkg ${{ steps.set-output-params.outputs.package_name }}.pkg
+          xcrun notarytool submit ${{ steps.set-output-params.outputs.package_name }}.pkg --apple-id ${{ secrets.APPLE_ID }} --password ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} --team-id ${{ secrets.APPLE_TEAM_ID }} --wait
+
+      - name: Package
+        run: |
+          cd engine
+          make package
+
+      - name: Upload Artifact
+        uses: actions/upload-artifact@v4
+        with:
+          name: cortex-${{ inputs.new_version }}-mac-${{ inputs.arch}}
+          path: ./engine/cortex
+  
+      - name: Upload Artifact
+        uses: actions/upload-artifact@v4
+        with:
+          name: cortex-${{ inputs.new_version }}-mac-${{ inputs.arch}}-installer
+          path: ./engine/${{ steps.set-output-params.outputs.package_name }}.pkg
+
+      - name: upload to aws s3 if public provider is aws
+        if: inputs.public_provider == 'aws-s3'
+        run: |
+          aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/mac-${{ inputs.arch}}/cortex-nightly.tar.gz
+
+          aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/mac-${{ inputs.arch}}/cortex-nightly-${{ inputs.new_version }}.tar.gz
+          aws s3 cp ./engine/${{ steps.set-output-params.outputs.package_name }}.pkg s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/mac-${{ inputs.arch}}/cortex-mac-${{ inputs.arch}}-installer-${{ inputs.new_version }}.pkg
+        env:
+          AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
+          AWS_SECRET_ACCESS_KEY: ${{ secrets.DELTA_AWS_SECRET_ACCESS_KEY }}
+          AWS_DEFAULT_REGION: ${{ secrets.DELTA_AWS_REGION }}
+          AWS_EC2_METADATA_DISABLED: "true"
+
+      - name: Upload release assert if public provider is github
+        if: inputs.public_provider == 'github'
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        uses: actions/upload-release-asset@v1.0.1
+        with:
+          upload_url: ${{ inputs.upload_url }}
+          asset_path: ./engine/cortex.tar.gz
+          asset_name: cortex-${{ inputs.new_version }}-mac-${{ inputs.arch}}.tar.gz
+          asset_content_type: application/zip
+
+      - name: Upload release assert if public provider is github
+        if: inputs.public_provider == 'github'
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        uses: actions/upload-release-asset@v1.0.1
+        with:
+          upload_url: ${{ inputs.upload_url }}
+          asset_path: ./engine/${{ steps.set-output-params.outputs.package_name }}.pkg
+          asset_name: cortex-${{ inputs.new_version }}-mac-${{ inputs.arch}}-installer.pkg
+          asset_content_type: application/octet-stream
diff --git a/.github/workflows/template-build-windows-x64.yml b/.github/workflows/template-build-windows-x64.yml
new file mode 100644
index 000000000..93fcf053f
--- /dev/null
+++ b/.github/workflows/template-build-windows-x64.yml
@@ -0,0 +1,251 @@
+name: build-windows-x64
+on:
+  workflow_call:
+    inputs:
+      ref:
+        required: true
+        type: string
+        default: 'refs/heads/main'
+      public_provider:
+        required: true
+        type: string
+        default: none
+        description: 'none: build only, github: build and publish to github, aws s3: build and publish to aws s3'
+      new_version:
+        required: true
+        type: string
+        default: ''
+      upload_url:
+        required: false
+        type: string
+        default: ''
+      runs-on:
+        required: false
+        type: string
+        default: 'windows-cuda-12-0'
+        description: 'The runner to use for this job'
+      cmake-flags:
+        required: false
+        type: string
+        default: ''
+        description: 'The cmake flags to use for this job'
+      build-deps-cmake-flags:
+        required: false
+        type: string
+        default: ''
+        description: 'The cmake flags to use for this job'
+      ccache-dir:
+        required: false
+        type: string
+        default: 'C:\Users\ContainerAdministrator\AppData\Local\ccache'
+        description: 'The ccache directory to use for this job'
+      channel:
+        required: true
+        type: string
+        default: 'nightly'
+        description: 'The channel to use for this job'
+    secrets:
+      MINIO_BUCKET_NAME:
+        required: false
+      MINIO_ENDPOINT:
+        required: false
+      MINIO_ACCESS_KEY_ID:
+        required: false
+      MINIO_SECRET_ACCESS_KEY:
+        required: false
+      MINIO_REGION:
+        required: false
+      DEVELOPER_ID:
+        required: false
+      AZURE_KEY_VAULT_URI:
+        required: false
+      AZURE_CLIENT_ID:
+        required: false
+      AZURE_TENANT_ID:
+        required: false
+      AZURE_CLIENT_SECRET:
+        required: false
+      AZURE_CERT_NAME:
+        required: false
+      DELTA_AWS_S3_BUCKET_NAME:
+        required: false
+      DELTA_AWS_ACCESS_KEY_ID:
+        required: false
+      DELTA_AWS_SECRET_ACCESS_KEY:
+        required: false
+      DELTA_AWS_REGION:
+        required: false
+
+jobs:
+  build-windows-x64:
+    runs-on: ${{ inputs.runs-on }}
+    permissions:
+      contents: write
+    steps:
+      - name: Getting the repo
+        uses: actions/checkout@v3
+        with:
+          ref: ${{ inputs.ref }}
+          submodules: 'recursive'
+
+      - uses: actions/setup-dotnet@v3
+        with:
+          dotnet-version: "8.0.x"
+
+      - name: Set output params for each channel
+        id : set-output-params
+        shell: bash
+        run: |
+          # Set output for stable channel
+          if [ "${{ inputs.channel }}" == "stable" ]; then
+            echo "::set-output name=package_name::cortexcpp"
+            echo "::set-output name=destination_binary_name::cortex"
+            echo "::set-output name=data_folder_name::cortexcpp"
+            echo "::set-output name=configuration_file_name::.cortexrc"
+            echo "::set-output name=uninstaller_file_name::cortex-uninstall.sh"
+            echo "::set-output name=iss_file_name::installer.iss"
+          fi
+
+          # Set output for beta channel
+          if [ "${{ inputs.channel }}" == "beta" ]; then
+            echo "::set-output name=package_name::cortexcpp-beta"
+            echo "::set-output name=destination_binary_name::cortex-beta"
+            echo "::set-output name=data_folder_name::cortexcpp-beta"
+            echo "::set-output name=configuration_file_name::.cortexrc-beta"
+            echo "::set-output name=uninstaller_file_name::cortex-beta-uninstall.sh"
+            echo "::set-output name=iss_file_name::installer-beta.iss"
+          fi
+
+          # Set output for nightly channel
+          if [ "${{ inputs.channel }}" == "nightly" ]; then
+            echo "::set-output name=package_name::cortexcpp-nightly"
+            echo "::set-output name=destination_binary_name::cortex-nightly"
+            echo "::set-output name=data_folder_name::cortexcpp-nightly"
+            echo "::set-output name=configuration_file_name::.cortexrc-nightly"
+            echo "::set-output name=uninstaller_file_name::cortex-nightly-uninstall.sh"
+            echo "::set-output name=iss_file_name::installer-nightly.iss"
+          fi
+
+      - name: Install jq
+        uses: dcarbone/install-jq-action@v2.0.1
+
+      - name: Install dependencies on Windows
+        run: |
+          choco install make pkgconfiglite ccache awscli 7zip ninja -y
+          dotnet tool install --global AzureSignTool
+
+      - name: Download ccache from s3
+        continue-on-error: true
+        run: |
+          Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
+          refreshenv
+          aws s3 cp s3://${{ secrets.MINIO_BUCKET_NAME }}/cortex-cpp-windows-amd64 ${{ inputs.ccache-dir }} --recursive --endpoint ${{ secrets.MINIO_ENDPOINT }}
+        env:
+          AWS_ACCESS_KEY_ID: "${{ secrets.MINIO_ACCESS_KEY_ID }}"
+          AWS_SECRET_ACCESS_KEY: "${{ secrets.MINIO_SECRET_ACCESS_KEY }}"
+          AWS_DEFAULT_REGION: "${{ secrets.MINIO_REGION }}"
+
+      - name: Configure vcpkg
+        shell: cmd
+        run: |
+          cd engine
+          make configure-vcpkg
+
+      - name: Build
+        run: |
+          cd engine
+          make build CMAKE_EXTRA_FLAGS="${{ inputs.cmake-flags }}" BUILD_DEPS_CMAKE_EXTRA_FLAGS="${{ inputs.build-deps-cmake-flags }}"
+
+      - name: Pre-package
+        run: |
+          cd engine
+          make pre-package
+
+      - name: Code Signing binaries
+        run: |
+          cd engine
+          make codesign-binary AZURE_KEY_VAULT_URI="${{ secrets.AZURE_KEY_VAULT_URI }}" AZURE_CLIENT_ID="${{ secrets.AZURE_CLIENT_ID }}" AZURE_TENANT_ID="${{ secrets.AZURE_TENANT_ID }}" AZURE_CLIENT_SECRET="${{ secrets.AZURE_CLIENT_SECRET }}" AZURE_CERT_NAME="${{ secrets.AZURE_CERT_NAME }}"
+
+      - name: Update version in installer.iss using sed
+        shell: bash
+        run: |
+          cd engine/templates/windows
+          sed -i "s/AppVersion=1.0/AppVersion=${{ inputs.new_version }}/g" ${{ steps.set-output-params.outputs.iss_file_name }}
+          cat ${{ steps.set-output-params.outputs.iss_file_name }}
+          cp ${{ steps.set-output-params.outputs.iss_file_name }} ../../../
+          ls ../../../
+
+      - name: Build Installers
+        shell: bash
+        run: |
+          cd engine
+          make build-installer PACKAGE_NAME=${{ steps.set-output-params.outputs.package_name }} VERSION=${{ inputs.new_version }} DESTINATION_BINARY_NAME="${{ steps.set-output-params.outputs.destination_binary_name }}"
+          ls ../
+
+      - name: Enable long paths
+        run: |
+          reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem" /v LongPathsEnabled /t REG_DWORD /d 1 /f
+
+      - name: Compile .ISS to .EXE Installer
+        uses: nadeemjazmawe/inno-setup-action-cli@v6.0.5
+        with:
+          filepath: ./${{ steps.set-output-params.outputs.iss_file_name }}
+
+      - name: Codesign for windows installer
+        shell: pwsh
+        run: |
+          ~\.dotnet\tools\azuresigntool.exe sign -kvu ${{ secrets.AZURE_KEY_VAULT_URI }} -kvi ${{ secrets.AZURE_CLIENT_ID }} -kvt ${{ secrets.AZURE_TENANT_ID }} -kvs ${{ secrets.AZURE_CLIENT_SECRET }} -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\setup.exe"
+
+      - name: Package
+        run: |
+          cd engine
+          make package
+
+      - name: Upload Artifact 
+        uses: actions/upload-artifact@v4
+        with:
+          name: cortex-${{ inputs.new_version }}-windows-amd64
+          path: ./engine/cortex
+
+      - name: Upload Artifact
+        uses: actions/upload-artifact@v4
+        with:
+          name: cortex-${{ inputs.new_version }}-windows-amd64-installer
+          path: ./setup.exe
+
+      - name: upload to aws s3 if public provider is aws
+        if: inputs.public_provider == 'aws-s3'
+        run: |
+          Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
+          refreshenv
+          aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/latest/windows-amd64/cortex-nightly.tar.gz
+
+          aws s3 cp ./engine/cortex.tar.gz s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/windows-amd64/cortex-nightly-${{ inputs.new_version }}.tar.gz
+          aws s3 cp ./setup.exe s3://${{ secrets.DELTA_AWS_S3_BUCKET_NAME }}/cortex/${{ inputs.new_version }}/windows-amd64/cortex-${{ inputs.new_version }}-windows-amd64-installer.exe
+        env:
+          AWS_ACCESS_KEY_ID: ${{ secrets.DELTA_AWS_ACCESS_KEY_ID }}
+          AWS_SECRET_ACCESS_KEY: ${{ secrets.DELTA_AWS_SECRET_ACCESS_KEY }}
+          AWS_DEFAULT_REGION: ${{ secrets.DELTA_AWS_REGION }}
+          AWS_EC2_METADATA_DISABLED: "true"
+
+      - name: Upload release assert if public provider is github
+        if: inputs.public_provider == 'github'
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        uses: actions/upload-release-asset@v1.0.1
+        with:
+          upload_url: ${{ inputs.upload_url }}
+          asset_path: ./engine/cortex.tar.gz
+          asset_name: cortex-${{ inputs.new_version }}-windows-amd64.tar.gz
+          asset_content_type: application/zip
+
+      - name: Upload release assert if public provider is github
+        if: inputs.public_provider == 'github'
+        env:
+          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+        uses: actions/upload-release-asset@v1.0.1
+        with:
+          upload_url: ${{ inputs.upload_url }}
+          asset_path: ./setup.exe
+          asset_name: cortex-${{ inputs.new_version }}-windows-amd64-installer.exe
+          asset_content_type: application/octet-stream
\ No newline at end of file
diff --git a/.github/workflows/template-get-update-version.yml b/.github/workflows/template-get-update-version.yml
new file mode 100644
index 000000000..9d853c7d3
--- /dev/null
+++ b/.github/workflows/template-get-update-version.yml
@@ -0,0 +1,60 @@
+name: get-update-version
+on:
+  workflow_call:
+    outputs:
+      new_version:
+        description: 'The new version of the app'
+        value: ${{ jobs.get-update-version.outputs.new_version }}
+
+jobs:
+  get-update-version:
+    runs-on: ubuntu-latest
+    environment: production
+    outputs:
+      new_version: ${{ steps.version_update.outputs.new_version }}
+    steps:
+    - name: Install jq
+      uses: dcarbone/install-jq-action@v2.0.1
+
+    - name: Get tag
+      if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
+      id: tag
+      uses: dawidd6/action-get-tag@v1
+      with:
+        strip_v: true
+
+    - name: Update app version based on latest release tag with build number
+      id: version_update
+      run: |
+        # Function to get the latest release tag
+        get_latest_tag() {
+          local retries=0
+          local max_retries=3
+          local tag
+          while [ $retries -lt $max_retries ]; do
+            tag=$(curl -s https://api.github.com/repos/janhq/cortex.cpp/releases/latest | jq -r .tag_name)
+            if [ -n "$tag" ] && [ "$tag" != "null" ]; then
+              echo $tag
+              return
+            else
+              let retries++
+              echo "Retrying... ($retries/$max_retries)"
+              sleep 2
+            fi
+          done
+          echo "Failed to fetch latest tag after $max_retries attempts."
+          exit 1
+        }
+
+        if ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}; then
+          echo "Tag detected, set output follow tag"
+          echo "::set-output name=new_version::${{ steps.tag.outputs.tag }}"
+        else
+          # Get the latest release tag from GitHub API
+          LATEST_TAG=$(get_latest_tag)
+          
+          # Remove the 'v' and append the build number to the version
+          new_version="${LATEST_TAG#v}-${GITHUB_RUN_NUMBER}"
+          echo "New version: $new_version"
+          echo "::set-output name=new_version::$new_version"
+        fi
\ No newline at end of file
diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt
index 8a72e5040..58661c508 100644
--- a/engine/CMakeLists.txt
+++ b/engine/CMakeLists.txt
@@ -1,6 +1,6 @@
 cmake_minimum_required(VERSION 3.5)
 
-project(cortex-cpp C CXX)
+project(cortex C CXX)
 
 # Build using CMAKE-JS
 if(DEFINED CMAKE_JS_INC)
diff --git a/engine/Makefile b/engine/Makefile
index ae4a49258..9f72f8355 100644
--- a/engine/Makefile
+++ b/engine/Makefile
@@ -14,14 +14,23 @@ AZURE_CLIENT_SECRET ?= xxxx
 AZURE_CERT_NAME ?= xxxx
 DEVELOPER_ID ?= xxxx
 
+# Arguments for build installer
+PACKAGE_NAME ?= cortexcpp
+VERSION ?= 0.1.1
+SOURCE_BINARY_PATH ?= ../../cortex/cortex
+DESTINATION_BINARY_NAME ?= cortex
+DATA_FOLDER_NAME ?= .cortex
+CONFIGURATION_FILE_NAME ?= .cortexrc
+UNINSTALLER_FILE_NAME ?= cortex-uninstall.sh
+
 # Default target, does nothing
 all:
 	@echo "Specify a target to run"
 
 configure-vcpkg:
 ifeq ($(OS),Windows_NT)
-	@cd vcpkg && bootstrap-vcpkg.bat;
-	@cd vcpkg && vcpkg install
+	@cd vcpkg && cmd /c bootstrap-vcpkg.bat;
+	@cd vcpkg && cmd /c vcpkg install
 else ifeq ($(shell uname -s),Linux) 
 	@cd vcpkg && ./bootstrap-vcpkg.sh;
 	@cd vcpkg && ./vcpkg install;
@@ -46,20 +55,20 @@ endif
 
 pre-package:
 ifeq ($(OS),Windows_NT)
-	@powershell -Command "mkdir -p cortex-cpp;"
-	@powershell -Command "cp build\cortex-cpp.exe .\cortex-cpp\;"
-	@powershell -Command "cp ..\.github\patches\windows\msvcp140.dll .\cortex-cpp\;"
-	@powershell -Command "cp ..\.github\patches\windows\vcruntime140_1.dll .\cortex-cpp\;"
-	@powershell -Command "cp ..\.github\patches\windows\vcruntime140.dll .\cortex-cpp\;"
+	@powershell -Command "mkdir -p cortex;"
+	@powershell -Command "cp build\cortex.exe .\cortex\;"
+	@powershell -Command "cp ..\.github\patches\windows\msvcp140.dll .\cortex\;"
+	@powershell -Command "cp ..\.github\patches\windows\vcruntime140_1.dll .\cortex\;"
+	@powershell -Command "cp ..\.github\patches\windows\vcruntime140.dll .\cortex\;"
 else ifeq ($(shell uname -s),Linux)
-	@mkdir -p cortex-cpp; \
-	cp build/cortex-cpp cortex-cpp/;
+	@mkdir -p cortex; \
+	cp build/cortex cortex/;
 else
-	@mkdir -p cortex-cpp; \
-	cp build/cortex-cpp cortex-cpp/;
+	@mkdir -p cortex; \
+	cp build/cortex cortex/;
 endif
 
-codesign:
+codesign-binary:
 ifeq ($(CODE_SIGN),false)
 	@echo "Skipping Code Sign"
 	@exit 0
@@ -67,29 +76,47 @@ endif
 
 ifeq ($(OS),Windows_NT)
 	@powershell -Command "dotnet tool install --global AzureSignTool;"
-	@powershell -Command 'azuresigntool.exe sign -kvu "$(AZURE_KEY_VAULT_URI)" -kvi "$(AZURE_CLIENT_ID)" -kvt "$(AZURE_TENANT_ID)" -kvs "$(AZURE_CLIENT_SECRET)" -kvc "$(AZURE_CERT_NAME)" -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\cortex-cpp\cortex-cpp.exe";'
-	@powershell -Command 'azuresigntool.exe sign -kvu "$(AZURE_KEY_VAULT_URI)" -kvi "$(AZURE_CLIENT_ID)" -kvt "$(AZURE_TENANT_ID)" -kvs "$(AZURE_CLIENT_SECRET)" -kvc "$(AZURE_CERT_NAME)" -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\cortex-cpp\engines\cortex.llamacpp\engine.dll";'
+	@powershell -Command '~\.dotnet\tools\azuresigntool.exe sign -kvu "$(AZURE_KEY_VAULT_URI)" -kvi "$(AZURE_CLIENT_ID)" -kvt "$(AZURE_TENANT_ID)" -kvs "$(AZURE_CLIENT_SECRET)" -kvc "$(AZURE_CERT_NAME)" -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v ".\cortex\cortex.exe";'
 else ifeq ($(shell uname -s),Linux)
 	@echo "Skipping Code Sign for linux"
 	@exit 0
 else
-	find "cortex-cpp" -type f -exec codesign --force -s "$(DEVELOPER_ID)" --options=runtime {} \;
+	codesign --force -s "$(DEVELOPER_ID)" --options=runtime --entitlements="./templates/macos/entitlements.plist" ./cortex/cortex;
 endif
 
 package:
 ifeq ($(OS),Windows_NT)
-	@powershell -Command "7z a -ttar temp.tar cortex-cpp\*; 7z a -tgzip cortex-cpp.tar.gz temp.tar;"
+	@powershell -Command "7z a -ttar temp.tar cortex\*; 7z a -tgzip cortex.tar.gz temp.tar;"
+else ifeq ($(shell uname -s),Linux)
+	tar -czvf cortex.tar.gz cortex;
+else
+	tar -czvf cortex.tar.gz cortex;
+endif
+
+build-installer:
+ifeq ($(OS),Windows_NT)
+	@echo "Building installer for Windows"; \
+	cp cortex/* ../; \
+	mv ../cortex.exe ../$(DESTINATION_BINARY_NAME).exe;
 else ifeq ($(shell uname -s),Linux)
-	tar -czvf cortex-cpp.tar.gz cortex-cpp;
+	@echo "Building installer for linux"; \
+	cd templates/linux; \
+	chmod +x create_deb.sh; \
+	./create_deb.sh $(PACKAGE_NAME) $(VERSION) $(SOURCE_BINARY_PATH) $(DESTINATION_BINARY_NAME) $(DATA_FOLDER_NAME) $(CONFIGURATION_FILE_NAME); \
+	cp $(PACKAGE_NAME).deb ../../
 else
-	tar -czvf cortex-cpp.tar.gz cortex-cpp;
+	@echo "Building installer for Macos"; \
+	cd templates/macos; \
+	chmod +x create_pkg.sh; \
+	./create_pkg.sh $(PACKAGE_NAME) $(VERSION) $(SOURCE_BINARY_PATH) $(DESTINATION_BINARY_NAME) $(DATA_FOLDER_NAME) $(CONFIGURATION_FILE_NAME) $(UNINSTALLER_FILE_NAME); \
+	cp $(PACKAGE_NAME).pkg ../../
 endif
 
 clean:
 ifeq ($(OS),Windows_NT)
-	@powershell -Command "rm -rf build; rm -rf build-deps; rm -rf cortex-cpp; rm -rf cortex-cpp.tar.gz;"
+	@powershell -Command "rm -rf build; rm -rf build-deps; rm -rf cortex; rm -rf cortex.tar.gz;"
 else ifeq ($(shell uname -s),Linux)
-	@rm -rf build; rm -rf build-deps; rm -rf cortex-cpp; rm -rf cortex-cpp.tar.gz;
+	@rm -rf build; rm -rf build-deps; rm -rf cortex; rm -rf cortex.tar.gz;
 else
-	@rm -rf build; rm -rf build-deps; rm -rf cortex-cpp; rm -rf cortex-cpp.tar.gz;
+	@rm -rf build; rm -rf build-deps; rm -rf cortex; rm -rf cortex.tar.gz;
 endif
\ No newline at end of file
diff --git a/engine/binding/index.d.ts b/engine/binding/index.d.ts
deleted file mode 100644
index a98421ac9..000000000
--- a/engine/binding/index.d.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-// Type definitions for cortex-cpp node binding
-
-/// <reference types="node" />
-declare module "cortex-cpp" {
-  export function start(port?: number);
-  export function stop();
-}
diff --git a/engine/binding/index.js b/engine/binding/index.js
deleted file mode 100644
index fd80a6df8..000000000
--- a/engine/binding/index.js
+++ /dev/null
@@ -1,3 +0,0 @@
-const addon = require("./../build/Release/cortex-cpp.node");
-
-module.exports = addon;
diff --git a/engine/package.json b/engine/package.json
deleted file mode 100644
index 0fc51ab24..000000000
--- a/engine/package.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
-  "name": "cortex-cpp",
-  "version": "0.0.11",
-  "description": "Cortex-cpp is a streamlined, stateless C++ server engineered to be fully compatible with OpenAI's API, particularly its stateless functionalities",
-  "main": "./binding/index.js",
-  "types": "./binding/index.d.ts",
-  "repository": {
-    "type": "git",
-    "url": "git+https://github.com/janhq/cortex.git"
-  },
-  "scripts": {
-    "install": "prebuild-install --runtime napi --backend cmake-js --config Release || yarn rebuild",
-    "build-deps": "cmake-js configure --directory ./cortex-cpp-deps --out ./build-deps/cortex-cpp-deps --config Release && cmake-js build --directory ./cortex-cpp-deps --out ./build-deps/cortex-cpp-deps --config Release && yarn clean-build-deps",
-    "clean-build-deps": "run-script-os",
-    "clean-build-deps:windows": "echo 'No need to clean build-deps on Windows'",
-    "clean-build-deps:linux": "rm -rf ./build-deps/cortex-cpp-deps && rm -rf ./build/CMakeCache.txt && rm -rf ./build/CMakeFiles && rm -rf ./build/compile_commands.json",
-    "clean-build-deps:macos": "rm -rf ./build-deps/cortex-cpp-deps && rm -rf ./build/CMakeCache.txt && rm -rf ./build/CMakeFiles && rm -rf ./build/compile_commands.json",
-    "build": "yarn build-deps && cmake-js configure --config Release && cmake-js build --config Release",
-    "rebuild": "yarn build-deps && cmake-js rebuild --config Release",
-    "prebuild": "yarn build-deps && prebuild --runtime napi --backend cmake-js --all --strip --verbose --config Release --include-regex \"\\.(node|exp|lib|so)$\"",
-    "upload": "prebuild --runtime napi --backend cmake-js --upload ${GITHUB_TOKEN}"
-  },
-  "author": "Jan <service@jan.ai>",
-  "license": "Apache-2.0",
-  "gypfile": true,
-  "dependencies": {
-    "bindings": "^1.5.0",
-    "cmake-js": "^7.3.0",
-    "node-addon-api": "^7.0.0",
-    "prebuild": "^13.0.1",
-    "prebuild-install": "^7.1.2"
-  },
-  "devDependencies": {
-    "@types/node": "^20.14.9",
-    "typescript": "^5.5.3",
-    "run-script-os": "^1.1.6"
-  },
-  "binary": {
-    "napi_versions": [
-      8
-    ]
-  },
-  "files": [
-    "**"
-  ]
-}
diff --git a/engine/templates/linux/control b/engine/templates/linux/control
new file mode 100644
index 000000000..e877fe5ab
--- /dev/null
+++ b/engine/templates/linux/control
@@ -0,0 +1,9 @@
+Package: $PACKAGE_NAME
+Version: $VERSION
+Section: base
+Priority: optional
+Architecture: amd64
+Depends: openmpi-bin,libopenmpi-dev
+Maintainer: Homebrew Computer Pte Ltd <service@homebrew.ltd>
+Description: Cortex
+  Cortex is a C++ AI engine that comes with a Docker-like command-line interface and client libraries. It supports running AI models using ONNX, TensorRT-LLM, and llama.cpp engines. Cortex can function as a standalone server or be integrated as a library.
diff --git a/engine/templates/linux/create_deb.sh b/engine/templates/linux/create_deb.sh
new file mode 100644
index 000000000..190bd293f
--- /dev/null
+++ b/engine/templates/linux/create_deb.sh
@@ -0,0 +1,35 @@
+PACKAGE_NAME=$1
+VERSION=$2
+SOURCE_BINARY_PATH=$3
+DESTINATION_BINARY_NAME=$4
+DATA_FOLDER_NAME=$5
+CONFIGURATION_FILE_NAME=$6
+
+mkdir -p $PACKAGE_NAME/DEBIAN
+
+mkdir -p $PACKAGE_NAME/usr/bin
+cp $SOURCE_BINARY_PATH $PACKAGE_NAME/usr/bin/$DESTINATION_BINARY_NAME
+
+export DESTINATION_BINARY_NAME
+
+cp postinst $PACKAGE_NAME/DEBIAN/postinst
+sed -i '2s/.*/DESTINATION_BINARY_NAME=\$DESTINATION_BINARY_NAME/' $PACKAGE_NAME/DEBIAN/postinst
+
+cp prerm $PACKAGE_NAME/DEBIAN/prerm
+sed -i '3s/.*/DESTINATION_BINARY_NAME=\$DESTINATION_BINARY_NAME/' $PACKAGE_NAME/DEBIAN/prerm
+
+export DATA_FOLDER_NAME CONFIGURATION_FILE_NAME
+
+cp postrm $PACKAGE_NAME/DEBIAN/postrm
+sed -i '3s/.*/DATA_FOLDER_NAME=\$DATA_FOLDER_NAME/' $PACKAGE_NAME/DEBIAN/postrm
+sed -i '4s/.*/CONFIGURATION_FILE_NAME=\$CONFIGURATION_FILE_NAME/' $PACKAGE_NAME/DEBIAN/postrm
+
+chmod 755 $PACKAGE_NAME/DEBIAN/postinst
+chmod 755 $PACKAGE_NAME/DEBIAN/postrm
+chmod 755 $PACKAGE_NAME/DEBIAN/prerm
+
+export PACKAGE_NAME VERSION
+
+envsubst < control > $PACKAGE_NAME/DEBIAN/control
+
+dpkg-deb --build $PACKAGE_NAME $PACKAGE_NAME.deb
\ No newline at end of file
diff --git a/engine/templates/linux/postinst b/engine/templates/linux/postinst
new file mode 100644
index 000000000..2ca83f96e
--- /dev/null
+++ b/engine/templates/linux/postinst
@@ -0,0 +1,5 @@
+#!/bin/sh
+DESTINATION_BINARY_NAME=cortex
+echo "Download cortex.llamacpp engines by default"
+USER_TO_RUN_AS=${SUDO_USER:-$(whoami)}
+sudo -u "$USER_TO_RUN_AS" /usr/bin/$DESTINATION_BINARY_NAME engines cortex.llamacpp install
diff --git a/engine/templates/linux/postrm b/engine/templates/linux/postrm
new file mode 100644
index 000000000..9bf1aed7f
--- /dev/null
+++ b/engine/templates/linux/postrm
@@ -0,0 +1,30 @@
+#!/bin/sh
+set +e
+DATA_FOLDER_NAME=.cortex
+CONFIGURATION_FILE_NAME=.cortexrc
+
+echo "Do you want to delete the '~/${DATA_FOLDER_NAME}' data folder and file '~/${CONFIGURATION_FILE_NAME}'? (yes/no)"
+read -r answer
+
+USER_TO_RUN_AS=${SUDO_USER:-$(whoami)}
+
+case "$answer" in
+    [yY][eE][sS]|[yY])
+        echo "Deleting cortex data folders..."
+        if [ -d "/home/${USER_TO_RUN_AS}/${DATA_FOLDER_NAME}" ]; then
+            echo "Removing /home/${USER_TO_RUN_AS}/${DATA_FOLDER_NAME}"
+            rm -rf "/home/${USER_TO_RUN_AS}/${DATA_FOLDER_NAME}" > /dev/null 2>&1
+        fi
+        if [ -f "/home/${USER_TO_RUN_AS}/${CONFIGURATION_FILE_NAME}" ]; then
+            echo "Removing /home/${USER_TO_RUN_AS}/${CONFIGURATION_FILE_NAME}"
+            rm -f "/home/${USER_TO_RUN_AS}/${CONFIGURATION_FILE_NAME}" > /dev/null 2>&1
+        fi
+        ;;
+    [nN][oO]|[nN])
+        echo "Keeping the 'cortex' data folders."
+        ;;
+    *)
+        echo "Invalid response. Please type 'yes' or 'no'."
+        ;;
+esac
+exit 0
diff --git a/engine/templates/linux/prerm b/engine/templates/linux/prerm
new file mode 100644
index 000000000..4f3c0abfd
--- /dev/null
+++ b/engine/templates/linux/prerm
@@ -0,0 +1,6 @@
+#!/bin/sh
+set +e
+DESTINATION_BINARY_NAME=cortex
+USER_TO_RUN_AS=${SUDO_USER:-$(whoami)}
+sudo -u "$USER_TO_RUN_AS"  /usr/bin/$DESTINATION_BINARY_NAME stop > /dev/null 2>&1
+exit 0
\ No newline at end of file
diff --git a/engine/templates/macos/cortex-uninstall.sh b/engine/templates/macos/cortex-uninstall.sh
new file mode 100644
index 000000000..471bb88d4
--- /dev/null
+++ b/engine/templates/macos/cortex-uninstall.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+DESTINATION_BINARY_NAME=cortex
+DATA_FOLDER_NAME=.cortex
+CONFIGURATION_FILE_NAME=.cortexrc
+UNINSTALLER_FILE_NAME=cortex-uninstall.sh
+
+# required root privileges
+if [ "$EUID" -ne 0 ]
+  then echo "Please run as root with sudo"
+  exit
+fi
+
+USER_TO_RUN_AS=${SUDO_USER:-$(whoami)}
+
+rm /usr/local/bin/$DESTINATION_BINARY_NAME
+
+echo "Do you want to delete the '~/${DATA_FOLDER_NAME}' data folder and file '~/${CONFIGURATION_FILE_NAME}'? (yes/no)"
+read -r answer
+
+case "$answer" in
+    [yY][eE][sS]|[yY])
+        echo "Deleting cortex data folders..."
+        if [ -d "/Users/${USER_TO_RUN_AS}/${DATA_FOLDER_NAME}" ]; then
+            echo "Removing /Users/${USER_TO_RUN_AS}/${DATA_FOLDER_NAME}"
+            rm -rf "/Users/${USER_TO_RUN_AS}/${DATA_FOLDER_NAME}" > /dev/null 2>&1
+        fi
+        if [ -f "/Users/${USER_TO_RUN_AS}/${CONFIGURATION_FILE_NAME}" ]; then
+            echo "Removing /Users/${USER_TO_RUN_AS}/${CONFIGURATION_FILE_NAME}"
+            rm -f "/Users/${USER_TO_RUN_AS}/${CONFIGURATION_FILE_NAME}" > /dev/null 2>&1
+        fi
+        ;;
+    [nN][oO]|[nN])
+        echo "Keeping the 'cortex' data folders."
+        ;;
+    *)
+        echo "Invalid response. Please type 'yes' or 'no'."
+        ;;
+esac
+
+rm /usr/local/bin/$UNINSTALLER_FILE_NAME
\ No newline at end of file
diff --git a/engine/templates/macos/create_pkg.sh b/engine/templates/macos/create_pkg.sh
new file mode 100644
index 000000000..61adbd2b3
--- /dev/null
+++ b/engine/templates/macos/create_pkg.sh
@@ -0,0 +1,25 @@
+PACKAGE_NAME=$1
+VERSION=$2
+SOURCE_BINARY_PATH=$3
+DESTINATION_BINARY_NAME=$4
+DATA_FOLDER_NAME=$5
+CONFIGURATION_FILE_NAME=$6
+UNINSTALLER_FILE_NAME=$7
+
+mkdir installer
+mkdir scripts
+
+cp $SOURCE_BINARY_PATH installer/$DESTINATION_BINARY_NAME
+
+export DESTINATION_BINARY_NAME
+cp post-installer.sh scripts/post-installer.sh
+sed -i '' '2s/.*/DESTINATION_BINARY_NAME=\$DESTINATION_BINARY_NAME/' $PACKAGE_NAME/DEBIAN/postinst
+
+export DATA_FOLDER_NAME CONFIGURATION_FILE_NAME UNINSTALLER_FILE_NAME
+cp cortex-uninstall.sh scripts/$UNINSTALLER_FILE_NAME
+sed -i '' '2s/.*/DESTINATION_BINARY_NAME=\$DESTINATION_BINARY_NAME/' scripts/$UNINSTALLER_FILE_NAME
+sed -i '' '3s/.*/DATA_FOLDER_NAME=\$DATA_FOLDER_NAME/' scripts/$UNINSTALLER_FILE_NAME
+sed -i '' '4s/.*/CONFIGURATION_FILE_NAME=\$CONFIGURATION_FILE_NAME/' scripts/$UNINSTALLER_FILE_NAME
+sed -i '' '5s/.*/UNINSTALLER_FILE_NAME=\$UNINSTALLER_FILE_NAME/' scripts/$UNINSTALLER_FILE_NAME
+
+pkgbuild --identifier ai.cortexcpp.pkg --version $VERSION --scripts scripts --install-location /usr/local/bin --root ./installer ${PACKAGE_NAME}.pkg
diff --git a/platform/entitlements.plist b/engine/templates/macos/entitlements.plist
similarity index 100%
rename from platform/entitlements.plist
rename to engine/templates/macos/entitlements.plist
diff --git a/engine/templates/macos/post-installer.sh b/engine/templates/macos/post-installer.sh
new file mode 100644
index 000000000..504f31756
--- /dev/null
+++ b/engine/templates/macos/post-installer.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+DESTINATION_BINARY_NAME=cortex
+echo "Download cortex.llamacpp engines by default"
+USER_TO_RUN_AS=${SUDO_USER:-$(whoami)}
+sudo -u "$USER_TO_RUN_AS" /usr/local/bin/$DESTINATION_BINARY_NAME engines cortex.llamacpp install
diff --git a/platform/cortex.ico b/engine/templates/windows/cortex.ico
similarity index 100%
rename from platform/cortex.ico
rename to engine/templates/windows/cortex.ico
diff --git a/engine/templates/windows/installer-beta.iss b/engine/templates/windows/installer-beta.iss
new file mode 100644
index 000000000..8624ef068
--- /dev/null
+++ b/engine/templates/windows/installer-beta.iss
@@ -0,0 +1,113 @@
+; Define the application name, version, and other details
+[Setup]
+AppName=cortexcpp-beta
+AppVersion=1.0
+DefaultDirName={localappdata}\cortexcpp-beta
+DefaultGroupName=cortexcpp-beta
+OutputDir=.
+OutputBaseFilename=setup
+Compression=lzma
+SolidCompression=yes
+PrivilegesRequired=lowest
+AllowNoIcons=yes
+
+; Define the languages section
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+
+; Define the files to be installed
+[Files]
+Source: "cortex-beta.exe"; DestDir: "{app}"; Flags: ignoreversion
+Source: "msvcp140.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "vcruntime140.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "vcruntime140_1.dll"; DestDir: "{app}"; Flags: ignoreversion
+
+; Define the icons to be created
+[Icons]
+Name: "{group}\cortexcpp-beta"; Filename: "{app}\cortex-beta.exe"
+
+; Define the run section to execute the application after installation
+[Run]
+Filename: "{app}\cortex-beta.exe"; Parameters: "engines cortex.llamacpp install"; WorkingDir: "{app}"; StatusMsg: "Initializing cortex configuration..."; Flags: nowait postinstall
+[Code]
+procedure AddToUserPath;
+var
+  ExpandedAppDir: String;
+  CmdLine: String;
+  ResultCode: Integer;
+begin
+  ExpandedAppDir := ExpandConstant('{app}');
+  
+  CmdLine := Format('setx PATH "%s;%%PATH%%"', [ExpandedAppDir]);
+  
+  if Exec('cmd.exe', '/C ' + CmdLine, '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
+  begin
+    if ResultCode = 0 then
+      MsgBox('Successfully added to user PATH.', mbInformation, MB_OK)
+    else
+      MsgBox('Failed to update user PATH. Error code: ' + IntToStr(ResultCode), mbError, MB_OK);
+  end
+  else
+  begin
+    MsgBox('Failed to execute setx command.', mbError, MB_OK);
+  end;
+end;
+
+procedure CurStepChanged(CurStep: TSetupStep);
+begin
+  if CurStep = ssPostInstall then
+  begin
+    AddToUserPath;
+  end;
+end;
+
+[Tasks]
+Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"; Flags: unchecked
+Name: "quicklaunchicon"; Description: "Create a &Quick Launch icon"; GroupDescription: "Additional icons:"; Flags: unchecked
+
+; Define icons for the additional tasks
+[Icons]
+Name: "{commondesktop}\cortexcpp-beta"; Filename: "{app}\cortex-beta.exe"; Tasks: desktopicon
+Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\cortexcpp-beta"; Filename: "{app}\cortex-beta.exe"; Tasks: quicklaunchicon
+
+; Define the uninstall run section to execute commands before uninstallation
+[UninstallRun]
+Filename: "{app}\cortex-beta.exe"; Parameters: "stop"; StatusMsg: "Stopping cortexcpp-beta service..."; Flags: runhidden
+
+; Use Pascal scripting to ask user if they want to delete the cortexcpp-beta folder and .cortexrc-beta file
+[Code]
+procedure DeleteCurrentUserCortexFolderAndConfig;
+var
+  UserCortexFolder: String;
+  UserCortexConfig: String;
+  ShouldDelete: Integer;
+begin
+  UserCortexFolder := ExpandConstant('{%USERPROFILE}\cortexcpp-beta');
+  UserCortexConfig := ExpandConstant('{%USERPROFILE}\.cortexrc-beta');
+  
+  if DirExists(UserCortexFolder) or FileExists(UserCortexConfig) then
+  begin
+    ShouldDelete := MsgBox('Do you want to delete the application data in cortexcpp-beta and the .cortexrc-beta config file (this will remove all user data)?', mbConfirmation, MB_YESNO);
+    
+    if ShouldDelete = idYes then
+    begin
+      if DirExists(UserCortexFolder) then
+      begin
+        DelTree(UserCortexFolder, True, True, True);
+      end;
+
+      if FileExists(UserCortexConfig) then
+      begin
+        DeleteFile(UserCortexConfig);
+      end;
+    end;
+  end;
+end;
+
+procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
+begin
+  if CurUninstallStep = usPostUninstall then
+  begin
+    DeleteCurrentUserCortexFolderAndConfig;
+  end;
+end;
diff --git a/engine/templates/windows/installer-nightly.iss b/engine/templates/windows/installer-nightly.iss
new file mode 100644
index 000000000..0abe36863
--- /dev/null
+++ b/engine/templates/windows/installer-nightly.iss
@@ -0,0 +1,113 @@
+; Define the application name, version, and other details
+[Setup]
+AppName=cortexcpp-nightly
+AppVersion=1.0
+DefaultDirName={localappdata}\cortexcpp-nightly
+DefaultGroupName=cortexcpp-nightly
+OutputDir=.
+OutputBaseFilename=setup
+Compression=lzma
+SolidCompression=yes
+PrivilegesRequired=lowest
+AllowNoIcons=yes
+
+; Define the languages section
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+
+; Define the files to be installed
+[Files]
+Source: "cortex-nightly.exe"; DestDir: "{app}"; Flags: ignoreversion
+Source: "msvcp140.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "vcruntime140.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "vcruntime140_1.dll"; DestDir: "{app}"; Flags: ignoreversion
+
+; Define the icons to be created
+[Icons]
+Name: "{group}\cortexcpp-nightly"; Filename: "{app}\cortex-nightly.exe"
+
+; Define the run section to execute the application after installation
+[Run]
+Filename: "{app}\cortex-nightly.exe"; Parameters: "engines cortex.llamacpp install"; WorkingDir: "{app}"; StatusMsg: "Initializing cortex configuration..."; Flags: nowait postinstall
+[Code]
+procedure AddToUserPath;
+var
+  ExpandedAppDir: String;
+  CmdLine: String;
+  ResultCode: Integer;
+begin
+  ExpandedAppDir := ExpandConstant('{app}');
+  
+  CmdLine := Format('setx PATH "%s;%%PATH%%"', [ExpandedAppDir]);
+  
+  if Exec('cmd.exe', '/C ' + CmdLine, '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
+  begin
+    if ResultCode = 0 then
+      MsgBox('Successfully added to user PATH.', mbInformation, MB_OK)
+    else
+      MsgBox('Failed to update user PATH. Error code: ' + IntToStr(ResultCode), mbError, MB_OK);
+  end
+  else
+  begin
+    MsgBox('Failed to execute setx command.', mbError, MB_OK);
+  end;
+end;
+
+procedure CurStepChanged(CurStep: TSetupStep);
+begin
+  if CurStep = ssPostInstall then
+  begin
+    AddToUserPath;
+  end;
+end;
+
+[Tasks]
+Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"; Flags: unchecked
+Name: "quicklaunchicon"; Description: "Create a &Quick Launch icon"; GroupDescription: "Additional icons:"; Flags: unchecked
+
+; Define icons for the additional tasks
+[Icons]
+Name: "{commondesktop}\cortexcpp-nightly"; Filename: "{app}\cortex-nightly.exe"; Tasks: desktopicon
+Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\cortexcpp-nightly"; Filename: "{app}\cortex-nightly.exe"; Tasks: quicklaunchicon
+
+; Define the uninstall run section to execute commands before uninstallation
+[UninstallRun]
+Filename: "{app}\cortex-nightly.exe"; Parameters: "stop"; StatusMsg: "Stopping cortexcpp-nightly service..."; Flags: runhidden
+
+; Use Pascal scripting to ask user if they want to delete the cortexcpp-nightly folder and .cortexrc-nightly file
+[Code]
+procedure DeleteCurrentUserCortexFolderAndConfig;
+var
+  UserCortexFolder: String;
+  UserCortexConfig: String;
+  ShouldDelete: Integer;
+begin
+  UserCortexFolder := ExpandConstant('{%USERPROFILE}\cortexcpp-nightly');
+  UserCortexConfig := ExpandConstant('{%USERPROFILE}\.cortexrc-nightly');
+  
+  if DirExists(UserCortexFolder) or FileExists(UserCortexConfig) then
+  begin
+    ShouldDelete := MsgBox('Do you want to delete the application data in cortexcpp-nightly and the .cortexrc-nightly config file (this will remove all user data)?', mbConfirmation, MB_YESNO);
+    
+    if ShouldDelete = idYes then
+    begin
+      if DirExists(UserCortexFolder) then
+      begin
+        DelTree(UserCortexFolder, True, True, True);
+      end;
+
+      if FileExists(UserCortexConfig) then
+      begin
+        DeleteFile(UserCortexConfig);
+      end;
+    end;
+  end;
+end;
+
+procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
+begin
+  if CurUninstallStep = usPostUninstall then
+  begin
+    DeleteCurrentUserCortexFolderAndConfig;
+  end;
+end;
diff --git a/engine/templates/windows/installer.iss b/engine/templates/windows/installer.iss
new file mode 100644
index 000000000..7c5a7bae4
--- /dev/null
+++ b/engine/templates/windows/installer.iss
@@ -0,0 +1,113 @@
+; Define the application name, version, and other details
+[Setup]
+AppName=cortexcpp
+AppVersion=1.0
+DefaultDirName={localappdata}\cortexcpp
+DefaultGroupName=cortexcpp
+OutputDir=.
+OutputBaseFilename=setup
+Compression=lzma
+SolidCompression=yes
+PrivilegesRequired=lowest
+AllowNoIcons=yes
+
+; Define the languages section
+[Languages]
+Name: "english"; MessagesFile: "compiler:Default.isl"
+
+; Define the files to be installed
+[Files]
+Source: "cortex.exe"; DestDir: "{app}"; Flags: ignoreversion
+Source: "msvcp140.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "vcruntime140.dll"; DestDir: "{app}"; Flags: ignoreversion
+Source: "vcruntime140_1.dll"; DestDir: "{app}"; Flags: ignoreversion
+
+; Define the icons to be created
+[Icons]
+Name: "{group}\cortexcpp"; Filename: "{app}\cortex.exe"
+
+; Define the run section to execute the application after installation
+[Run]
+Filename: "{app}\cortex.exe"; Parameters: "engines cortex.llamacpp install"; WorkingDir: "{app}"; StatusMsg: "Initializing cortex configuration..."; Flags: nowait postinstall
+[Code]
+procedure AddToUserPath;
+var
+  ExpandedAppDir: String;
+  CmdLine: String;
+  ResultCode: Integer;
+begin
+  ExpandedAppDir := ExpandConstant('{app}');
+  
+  CmdLine := Format('setx PATH "%s;%%PATH%%"', [ExpandedAppDir]);
+  
+  if Exec('cmd.exe', '/C ' + CmdLine, '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
+  begin
+    if ResultCode = 0 then
+      MsgBox('Successfully added to user PATH.', mbInformation, MB_OK)
+    else
+      MsgBox('Failed to update user PATH. Error code: ' + IntToStr(ResultCode), mbError, MB_OK);
+  end
+  else
+  begin
+    MsgBox('Failed to execute setx command.', mbError, MB_OK);
+  end;
+end;
+
+procedure CurStepChanged(CurStep: TSetupStep);
+begin
+  if CurStep = ssPostInstall then
+  begin
+    AddToUserPath;
+  end;
+end;
+
+[Tasks]
+Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"; Flags: unchecked
+Name: "quicklaunchicon"; Description: "Create a &Quick Launch icon"; GroupDescription: "Additional icons:"; Flags: unchecked
+
+; Define icons for the additional tasks
+[Icons]
+Name: "{commondesktop}\cortexcpp"; Filename: "{app}\cortex.exe"; Tasks: desktopicon
+Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\cortexcpp"; Filename: "{app}\cortex.exe"; Tasks: quicklaunchicon
+
+; Define the uninstall run section to execute commands before uninstallation
+[UninstallRun]
+Filename: "{app}\cortex.exe"; Parameters: "stop"; StatusMsg: "Stopping cortexcpp service..."; Flags: runhidden
+
+; Use Pascal scripting to ask user if they want to delete the .cortex folder and .cortexrc file
+[Code]
+procedure DeleteCurrentUserCortexFolderAndConfig;
+var
+  UserCortexFolder: String;
+  UserCortexConfig: String;
+  ShouldDelete: Integer;
+begin
+  UserCortexFolder := ExpandConstant('{%USERPROFILE}\.cortex');
+  UserCortexConfig := ExpandConstant('{%USERPROFILE}\.cortexrc');
+  
+  if DirExists(UserCortexFolder) or FileExists(UserCortexConfig) then
+  begin
+    ShouldDelete := MsgBox('Do you want to delete the application data in .cortex and the .cortexrc config file (this will remove all user data)?', mbConfirmation, MB_YESNO);
+    
+    if ShouldDelete = idYes then
+    begin
+      if DirExists(UserCortexFolder) then
+      begin
+        DelTree(UserCortexFolder, True, True, True);
+      end;
+
+      if FileExists(UserCortexConfig) then
+      begin
+        DeleteFile(UserCortexConfig);
+      end;
+    end;
+  end;
+end;
+
+procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
+begin
+  if CurUninstallStep = usPostUninstall then
+  begin
+    DeleteCurrentUserCortexFolderAndConfig;
+  end;
+end;
diff --git a/package-managers-template/launchpad/cortexso/debian/changelog b/package-managers-template/launchpad/cortexso/debian/changelog
deleted file mode 100644
index 131a0e3e2..000000000
--- a/package-managers-template/launchpad/cortexso/debian/changelog
+++ /dev/null
@@ -1,11 +0,0 @@
-cortexso (VERSION) jammy; urgency=low
-
-  * CHANGELOG_HERE
-
- -- Homebrew Computer Pte Ltd <service@homebrew.ltd>  TIME_HERE
-
-cortexso (VERSION) noble; urgency=low
-
-  * CHANGELOG_HERE
-
- -- Homebrew Computer Pte Ltd <service@homebrew.ltd>  TIME_HERE
\ No newline at end of file
diff --git a/package-managers-template/launchpad/cortexso/debian/control b/package-managers-template/launchpad/cortexso/debian/control
deleted file mode 100644
index d637974fd..000000000
--- a/package-managers-template/launchpad/cortexso/debian/control
+++ /dev/null
@@ -1,12 +0,0 @@
-Source: cortexso
-Section: base
-Priority: optional
-Maintainer: Homebrew Computer Pte Ltd <service@homebrew.ltd>
-Build-Depends: debhelper-compat (= 13)
-Standards-Version: 4.6.2
-
-Package: cortexso
-Architecture: amd64
-Depends: ${shlibs:Depends}, ${misc:Depends}, openmpi-bin, libopenmpi-dev
-Description: Cortex
- Cortex is an OpenAI-compatible AI engine that developers can use to build LLM apps. It is packaged with a Docker-inspired command-line interface and client libraries. It can be used as a standalone server or imported as a library.
\ No newline at end of file
diff --git a/package-managers-template/launchpad/cortexso/debian/copyright b/package-managers-template/launchpad/cortexso/debian/copyright
deleted file mode 100644
index 828023e47..000000000
--- a/package-managers-template/launchpad/cortexso/debian/copyright
+++ /dev/null
@@ -1,19 +0,0 @@
-Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: cortexso
-Source: https://cortex.so
-
-Files: *
-Copyright: 2023, Homebrew Computer Pte Ltd <service@homebrew.ltd>
-License: AGPL-3+
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- .
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- GNU Affero General Public License for more details.
- .
- You should have received a copy of the GNU Affero General Public License
- along with this program.  If not, see <https://www.gnu.org/licenses/>.
\ No newline at end of file
diff --git a/package-managers-template/launchpad/cortexso/debian/install b/package-managers-template/launchpad/cortexso/debian/install
deleted file mode 100644
index 0eb8dba40..000000000
--- a/package-managers-template/launchpad/cortexso/debian/install
+++ /dev/null
@@ -1 +0,0 @@
-cortex /usr/bin/
\ No newline at end of file
diff --git a/package-managers-template/launchpad/cortexso/debian/postrm b/package-managers-template/launchpad/cortexso/debian/postrm
deleted file mode 100644
index 257c7375f..000000000
--- a/package-managers-template/launchpad/cortexso/debian/postrm
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-set +e
-
-for userdir in /home/*; do
-  if [ -d "$userdir/cortex" ]; then
-    rm -rf "$userdir/cortex" > /dev/null 2>&1
-  fi
-done
-
-exit 0
diff --git a/package-managers-template/launchpad/cortexso/debian/prerm b/package-managers-template/launchpad/cortexso/debian/prerm
deleted file mode 100644
index 40b730f2b..000000000
--- a/package-managers-template/launchpad/cortexso/debian/prerm
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-set +e
-
-/usr/bin/cortex stop > /dev/null 2>&1
-
-exit 0
\ No newline at end of file
diff --git a/package-managers-template/launchpad/cortexso/debian/rules b/package-managers-template/launchpad/cortexso/debian/rules
deleted file mode 100644
index 7efda1953..000000000
--- a/package-managers-template/launchpad/cortexso/debian/rules
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/usr/bin/make -f
-%:
-	dh $@
-override_dh_auto_install:
-	dh_install
-override_dh_strip:
-	dh_strip --exclude=cortex
diff --git a/platform/control.template b/platform/control.template
deleted file mode 100644
index 92a6e7a2a..000000000
--- a/platform/control.template
+++ /dev/null
@@ -1,9 +0,0 @@
-Package: cortexso
-Version:
-Section: base
-Priority: optional
-Architecture: amd64
-Depends: openmpi-bin,libopenmpi-dev
-Maintainer: Homebrew Pte Ltd <service@jan.ai>
-Description: Cortex
- Cortex is an OpenAI-compatible AI engine that developers can use to build LLM apps. It is packaged with a Docker-inspired command-line interface and client libraries. It can be used as a standalone server or imported as a library.
diff --git a/platform/installer.iss b/platform/installer.iss
deleted file mode 100644
index 874e4d79a..000000000
--- a/platform/installer.iss
+++ /dev/null
@@ -1,86 +0,0 @@
-; Inno Setup Script
-; Define the application name, version, and other details
-[Setup]
-AppName=Cortexso
-AppVersion=1.0
-DefaultDirName={pf}\Cortexso
-DefaultGroupName=Cortexso
-OutputDir=.
-OutputBaseFilename=setup
-Compression=lzma
-SolidCompression=yes
-PrivilegesRequired=admin
-
-; Define the languages section
-[Languages]
-Name: "english"; MessagesFile: "compiler:Default.isl"
-
-; Define the files to be installed
-[Files]
-Source: "cortex.exe"; DestDir: "{app}"; Flags: ignoreversion
-
-; Define the icons to be created
-[Icons]
-Name: "{group}\Cortexso"; Filename: "{app}\cortex.exe"
-
-; Define the run section to execute the application after installation
-[Run]
-Filename: "cmd"; Parameters: "/c setx PATH ""%PATH%;{app}"""; StatusMsg: "Updating system PATH environment variable..."; Flags: runhidden
-Filename: "{app}\cortex.exe"; Description: "{cm:LaunchProgram,Cortexso}"; Flags: nowait postinstall skipifsilent
-
-; Define the tasks section (optional, for additional tasks like creating desktop icons)
-[Tasks]
-Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"; Flags: unchecked
-Name: "quicklaunchicon"; Description: "Create a &Quick Launch icon"; GroupDescription: "Additional icons:"; Flags: unchecked
-
-; Define icons for the additional tasks
-[Icons]
-Name: "{commondesktop}\Cortexso"; Filename: "{app}\cortex.exe"; Tasks: desktopicon
-Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Cortexso"; Filename: "{app}\cortex.exe"; Tasks: quicklaunchicon
-
-; Define the uninstall run section to execute commands before uninstallation
-[UninstallRun]
-Filename: "{app}\cortex.exe"; Parameters: "stop"; StatusMsg: "Stopping Cortexso service..."; Flags: runhidden
-
-; Use Pascal scripting to delete the directory for all users
-[Code]
-function GetUsersFolder: String;
-var
-  WinDir: String;
-begin
-  WinDir := ExpandConstant('{win}');
-  Result := Copy(WinDir, 1, Pos('\Windows', WinDir) - 1) + '\Users';
-end;
-
-procedure DeleteUserCortexFolder;
-var
-  UsersFolder: String;
-  FindRec: TFindRec;
-begin
-  UsersFolder := GetUsersFolder;
-  if FindFirst(UsersFolder + '\*', FindRec) then
-  begin
-    try
-      repeat
-        if (FindRec.Attributes and FILE_ATTRIBUTE_DIRECTORY <> 0) and
-           (FindRec.Name <> '.') and (FindRec.Name <> '..') then
-        begin
-          if DirExists(UsersFolder + '\' + FindRec.Name + '\cortex') then
-          begin
-            DelTree(UsersFolder + '\' + FindRec.Name + '\cortex', True, True, True);
-          end;
-        end;
-      until not FindNext(FindRec);
-    finally
-      FindClose(FindRec);
-    end;
-  end;
-end;
-
-procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
-begin
-  if CurUninstallStep = usPostUninstall then
-  begin
-    DeleteUserCortexFolder;
-  end;
-end;