[data-reveal]{opacity:1!important;transform:none!important}
AntelopeJS DMS
DocumentationInstallation

Installation

Add the Media module to a DMS project, give it a file storage, and allow the dashboard's origin for direct uploads.

The Media module runs inside a project that loads @antelopejs/dms, a database module and a module that implements @antelopejs/interface-file-storage, such as @antelopejs/file-storage-local.

Requirements

  • A DMS backend in a release that implements the @antelopejs/interface-dms range in the README compatibility table.
  • The @antelopejs/dms-frontend renderer in the range that engines["@antelopejs/dms-frontend"] of frontend-vue/package.json declares. The ajs dms CLI refuses to build the module with a renderer outside that range.
  • The @antelopejs/interface-dms-media range listed in the README compatibility table.
Warning

Upgrade the DMS backend, the media interface and the renderer together, to the ranges above. See DMS installation for the toolchain and Troubleshooting for dependency and frontend integration errors.

Add it to a project

Add the module

Terminal bash
ajs project modules add @antelopejs/dms-media

The browser uploads files straight to the storage, and copied links start with the module's publicBaseUrl. Point both at the public base URL of the api module:

antelope.config.ts typescript
import { defineConfig } from "@antelopejs/interface-core/config";

export default defineConfig({
  name: "my-project",
  modules: {
    "dms-media": {
      source: {
        type: "package",
        package: "@antelopejs/dms-media",
        version: "^0.9.3",
      },
      config: {
        publicBaseUrl: "${@api.API_PUBLIC_BASE_URL}",
      },
    },
    "file-storage-local": {
      source: {
        type: "package",
        package: "@antelopejs/file-storage-local",
        version: ">=0.1.13 <1.0.0",
      },
      config: {
        storagePath: ".antelope/file-storage",
        baseUrl: "${@api.API_PUBLIC_BASE_URL}",
        defaultVisibility: "private",
      },
    },
    // dms, api, mongodb, auth-jwt, ...
  },
});

Allow the dashboard's origin

The browser asks the API to presign an upload, then sends the file with a PUT straight to the storage URL. That URL is on another origin than the dashboard. List every origin the dashboard is served on in the CORS settings of the api module:

antelope.config.ts typescript
api: {
  config: {
    cors: {
      allowedOrigins: ["https://dms.example.com"],
    },
  },
},

Open the library

Restart the backend, then the frontend. The module appears under Modules › Media, at /modules/media/overview.

The server renders the overview, the folder tree and listing of the library, and the file page with their data. A link to a folder, a view or a search arrives rendered too. The image editor's canvas, the dialogs and the picker of the asset field load their data in the browser.

Warning

Without the CORS entry, listing and presigning work, but the browser blocks the PUT. The console shows a CORS error on /file-storage/.... The upload queue then names the origin to add, and a retry fails until the API allows it.

Try it in the playground

Run these commands from the repository root. The playground is not a workspace package, so it needs its own install:

Terminal bash
pnpm install --frozen-lockfile
pnpm --dir packages/dms-media/playground install --frozen-lockfile --ignore-workspace
pnpm dev                                     # backend on http://localhost:5010
pnpm --dir packages/dms-media frontend:dev   # dashboard on http://localhost:3001

The playground uses MongoDB at mongodb://localhost:27017. Set MONGO_URL to use another server. Its Media demo page (/media-demo) holds every kind of AssetType picker: a cover image with a linked folder, a gallery with a maximum, a PDF-only spec sheet, documents in their own linked folder, and a free attachment.