.circleci
chore(deps): update cimg/php docker tag to v8.6
.github
chore(deps): update github/codeql-action action to v4.39.4
.openhands
feat: add OpenHands setup script for dependency installation
appinfo
chore(release): 1.23.0 [skip ci]
css
fix: wire the theme setting through and drop settings the viewer ignores
docs
docs: add viewer screenshot to README and complete info.xml
img
feat: add missing files from Nextcloud app_template
js
fix(deps): Fix pnpm audit
lib
fix: give the MTEXT worker response the font CDN allowance
LICENSES
fix: revalidate worker assets and correct the license notices
scripts
fix(release): anchor the analyzer resolution on semantic-release's entry point
src
test: fail the stub guard when a webpack rule cannot be parsed
templates
fix: wire the theme setting through and drop settings the viewer ignores
tests
chore: add Nx
vendor-bin
chore(dev-deps): Bump nextcloud/ocp package
wiki
fix: clear the reload guard only after the drawing actually opens
.codacy.yml
chore: use exclude_paths glob for test stubs in Codacy
.eslintrc.json
chore: give test files jest globals in the legacy eslint config too
.gitignore
chore: add Nx
.kodiak.toml
Add minimal configuration for Kodiak
.npmrc
fix: use minimumReleaseAge:0 to disable supply-chain age check
.nvmrc
chore(deps): update node.js to v26
.php-cs-fixer.dist.php
fix: convert tabs to spaces and use PSR-12 coding standard
AGENTS.md
docs: correct the AI policy's cross-references and scope
AI_POLICY.md
docs: correct the AI policy's cross-references and scope
babel.config.js
fix: update babel preset-typescript options for compatibility
CHANGELOG.md
chore(release): 1.23.0 [skip ci]
CODE_OF_CONDUCT.md
Add files via upload
commitlint.config.js
update branch
composer.json
fix: pass --threads once to psalm
composer.lock
chore(deps): update dependency vimeo/psalm to v7.12.0
COPYING.txt
Add files via upload
COPYING.txt.license
docs: reconcile the declared license and scope the AGPL notice correctly
eslint.config.js
fix: wire the theme setting through and drop settings the viewer ignores
jest.config.js
test: follow the repo convention for the fetchCadFile test
LICENSE
Add MIT License
Makefile
chore: add Nx
nx.json
chore: add Nx
openapi.json
Add files via upload
package.json
chore(release): 1.23.0 [skip ci]
phpstan.neon
fix: satisfy static analysis and PHPUnit for the rewritten viewer
playwright.config.ts
test: add a Playwright e2e test for the built file action
pnpm-lock.yaml
chore(deps): update dependency @babel/core to v8.1.3
pnpm-workspace.yaml
chore(deps): update dependency @ai-sdk/provider-utils to v5.0.83
psalm.xml
fix: satisfy static analysis and PHPUnit for the rewritten viewer
README.md
Simplify installation instructions in README
rector.php
fix: comprehensive CI and compatibility alignment for Nextcloud 33
release.config.js
fix: release bug fixes as patch versions
renovate.json
chore(ci): let Renovate update vue-i18n again
sonar-project.properties
chore: exclude js/ from JavaScript analysis in SonarCloud
stylelint.config.js
fix: comprehensive CI and compatibility alignment for Nextcloud 33
THIRD-PARTY-NOTICES.txt
docs: clarify the license sources in the AGPL notice
tsconfig.json
test: scope jest types to the test file via a triple-slash reference
webpack.config.js
fix: register the PDF, SVG and HTML export plugins

Nextcloud CAD Viewer

A native Nextcloud app providing DWG and DXF file viewing capabilities based on mlightcad/cad-viewer. View your CAD drawings directly in Nextcloud without downloading or installing additional software.

๐Ÿ“ธ Screenshots

โœจ Features

  • ๐ŸŽจ View DWG and DXF files directly in Nextcloud web interface
  • ๐Ÿ—‚๏ธ Start page with your recent drawings and a blank drawing shortcut
  • โšก Fast, browser-based rendering using WebGL technology
  • ๐Ÿ” Interactive controls: Zoom, pan, and fit-to-view
  • ๐Ÿ“ Layer management: Toggle layer visibility on/off
  • ๐ŸŒ“ Theme support: Dark and light mode options
  • ๐Ÿ–ฅ๏ธ Fullscreen mode for detailed viewing
  • ๐Ÿ“ฑ Responsive design that works on desktop and mobile
  • ๐Ÿ’พ Save and exit from the viewer toolbar (DXF files)
  • ๐Ÿ”’ Secure integration with Nextcloud's file permissions
  • ๐Ÿ–ผ๏ธ Preview thumbnails in the Files app for drawings you have opened
  • ๐Ÿ”„ Easy updates from upstream cad-viewer
  • ๐Ÿงช Fully tested and compatible with Nextcloud 34-35

๐Ÿ“‹ Requirements

ComponentVersion
Nextcloud34-35
PHP8.4+
Node.js24+ (dev. only)
pnpm10+ (dev. only)

๐Ÿ“ฆ Installation

CAD Viewer is listed in the Nextcloud App Store. Install it from the release archive or from source as described below.

From a release archive

  1. Download the latest cad_viewer.tar.gz from the releases page.
  2. Extract it into your Nextcloud apps directory:
    tar -xzf cad_viewer.tar.gz -C /path/to/nextcloud/apps
    chown -R www-data:www-data /path/to/nextcloud/apps/cad_viewer
    The archive already contains the built frontend assets, so no Node.js/pnpm step is needed.
  3. Enable the app:
    occ app:enable cad_viewer
    The DWG/DXF MIME types are registered automatically on install; the app re-detects existing CAD files, so no manual config/mimetypemapping.json edit is required.

From source

  1. Clone this repository into your Nextcloud apps directory:

    cd /path/to/nextcloud/apps
    git clone https://github.com/ashcoft/nextcloud-cad-viewer.git cad_viewer
  2. Set proper permissions:

    chown -R www-data:www-data cad_viewer
  3. Build the frontend assets:

    cd cad_viewer
    pnpm install
    pnpm run build
  4. Enable the app:

    occ app:enable cad_viewer

    Or go to Settings โ†’ Apps, find "CAD Viewer" in the disabled apps section and click Enable.

    Enabling the app registers the .dwg/.dxf MIME types and re-detects files uploaded before the app was installed. If you need to re-run this manually:

    occ maintenance:repair --include-expensive

๐Ÿš€ Usage

Once installed, the CAD Viewer integrates seamlessly with Nextcloud:

  1. Navigate to any DWG or DXF file in your Nextcloud files
  2. Click the file, or right-click it and choose Open with CAD Viewer
  3. The drawing opens in the CAD Viewer
  4. Use the toolbar controls to:
    • Zoom in/out
    • Pan around the drawing
    • Fit the drawing to view
    • Toggle layers
    • Switch between dark/light themes
    • Enter fullscreen mode

Opening CAD Viewer from the Nextcloud app menu shows a start page with the drawings you worked on recently. From there you can reopen one of them or create a blank drawing: the app saves a new, empty DXF file in your home folder and opens it in the viewer.

Note: The app opens CAD drawings in its own full-page viewer rather than in the Nextcloud Viewer. The bundled Nextcloud Viewer is a Vue 2 application and cannot render the Vue 3 CAD component, so the file action navigates to /apps/cad_viewer/view instead.

Supported File Formats

FormatExtensionMIME Types
AutoCAD DWG.dwgapplication/acad, application/autocad_dwg, application/dwg, application/x-autocad, application/x-dwg, image/vnd.dwg
AutoCAD DXF.dxfimage/vnd.dxf, application/dxf, application/x-dxf, image/x-dxf

Saving Changes

The viewer toolbar has Save and Exit buttons. Save serialises the drawing back to its file, then Exit returns to the folder it came from.

Saving is limited to DXF: the bundled LibreDWG converter can read DWG but has no encoder, so a DWG is left read-only and the Save button is hidden. The server also refuses a save when the file changed since it was loaded, so an older browser tab cannot overwrite a newer version.

Preview Thumbnails

CAD rendering needs WebGL, so a preview cannot be produced server-side. Instead the viewer captures the rendered drawing after it finishes opening, uploads the PNG, and the app serves it back to the Files grid. Thumbnails therefore appear only for drawings that have been opened at least once; before that the generic file icon is shown.

Only users who can modify a file may set its thumbnail, and an upload is rejected when the drawing changed after it was downloaded, so the preview always matches the current version. Thumbnails are stored under the app's data directory (not in the user's files) and are removed when the drawing is deleted.

๐Ÿ› ๏ธ Development

Prerequisites

  • Node.js 24+
  • pnpm 10+
  • Nextcloud 34 development environment
  • PHP 8.4+

Setup Development Environment

# Clone the repository
git clone https://github.com/ashcoft/nextcloud-cad-viewer.git
cd nextcloud-cad-viewer

# Install dependencies
pnpm install

Build Commands

# Development build with watch mode
pnpm run dev

# Production build
pnpm run build

# Type-check Vue + TypeScript sources
pnpm run check-types

# Run linter
pnpm run lint

# Fix linting issues
pnpm run lint -- --fix

# Run stylelint
pnpm run stylelint

# Run frontend (Jest) tests
pnpm test

# Run backend (PHPUnit) tests
composer test:unit

The Makefile wraps the common flows:

make dev-setup          # clean, install and build the production bundle
make production-setup   # clean, install and build for production
make appstore           # build the installable tar.gz/zip archives
make test               # run PHPUnit and Jest suites
make lint               # run PHP and frontend linters

๐Ÿ”„ Updating CAD Viewer

When new versions of mlightcad/cad-viewer are released:

  1. Update the dependency:

    pnpm update @mlightcad/cad-viewer
  2. Rebuild the application:

    pnpm run build
  3. Test thoroughly with various DWG/DXF files

  4. Commit and push changes:

    git add package.json pnpm-lock.yaml
    git commit -m "Update cad-viewer dependency"
    git push

The pinned @mlightcad versions and compatibility overrides live in pnpm-workspace.yaml; review them when bumping the viewer. Note that the CAD viewer library is bundled at build time, so a rebuild and redeploy is required for changes to take effect.

โš™๏ธ Configuration

The app works out of the box. Administrators can additionally tune the viewer under Settings โ†’ Administration โ†’ CAD Viewer:

SettingOptionsDefaultDescription
ThemeLight / DarkLightTheme the viewer opens a drawing with
Enable file previewsYes / NoYesGenerate and store CAD file previews

Both settings are app-wide. Turning previews off stops new thumbnails being stored: the viewer still renders and uploads one, but the server refuses it with a 403. Existing thumbnails stay on disk and are simply not served, so they remain until their drawing is deleted.

Autosave is not configurable: the viewer edits in memory and writes only when you press Save in its toolbar, so there is nothing to schedule.

๐Ÿ› Troubleshooting

Files Not Displaying

  1. Verify the CAD Viewer app is enabled in Nextcloud
  2. Check that the file is a supported format (DWG or DXF)
  3. Confirm the MIME types are registered โ€” for manual installs see Register the DWG/DXF MIME types above. Files showing a generic icon or no Open with CAD Viewer action usually mean the mapping is missing.
  4. Ensure you have read permissions for the file
  5. Check the browser console for JavaScript errors
  6. Review Nextcloud logs at nextcloud/data/nextcloud.log

Performance Issues with Large Files

  1. Ensure your server has sufficient RAM and CPU resources
  2. Consider enabling browser hardware acceleration
  3. For very large files, consider optimizing the DWG/DXF in AutoCAD
  4. Check network bandwidth between client and server

Build Errors

  1. Clear node_modules and reinstall:

    rm -rf node_modules
    pnpm install
  2. Ensure you're using Node.js 24+

  3. Check that all dependencies are properly installed

Common Issues

IssueSolution
Blank viewerCheck browser console for errors, verify file permissions
"Open with CAD Viewer" missingRegister the DWG/DXF MIME types (see Installation)
Slow loadingOptimize CAD file, check server resources
Missing layersEnsure CAD file layers are not frozen in source application
Mobile display issuesUse landscape orientation for better viewing

๐Ÿงช Testing

Run the frontend and backend suites:

pnpm test              # Jest (frontend)
composer test:unit     # PHPUnit (backend)

Static analysis and linting:

pnpm run check-types   # vue-tsc
pnpm run lint          # ESLint
pnpm run stylelint     # Stylelint
composer psalm         # Psalm
composer phpstan       # PHPStan

For compatibility testing procedures, see COMPATIBILITY.md.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

Bundled third-party components keep their own licenses, which are listed in THIRD-PARTY-NOTICES.txt. In particular the bundled @nextcloud/files library is AGPL-3.0-or-later (its license text ships as COPYING.txt); that is compatible with this app's MIT license.

๐Ÿค Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Run linters and tests (pnpm run lint && pnpm test)
  5. Build the production assets (pnpm run build)
  6. Commit your changes using conventional commit messages (git commit -m 'feat: add amazing feature')
  7. Push to the branch (git push origin feature/amazing-feature)
  8. Open a Pull Request

Please read CONTRIBUTING.md for detailed guidelines, and AI_POLICY.md if you use AI assistance: a pull request containing AI-assisted code, documentation or tests must disclose that, and each commit containing AI-assisted content must carry an Assisted-by: AGENT_NAME:MODEL_VERSION trailer.

๐Ÿ“ž Support

๐Ÿ™ Credits

๐Ÿ“ Changelog

See CHANGELOG.md for version history and changes.

๐Ÿ”— Links