### Install Dependencies and Build UI Workspace Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/README.md First, install all project dependencies, then build the 'ui' workspace. ```bash yarn install yarn workspace ui build ``` -------------------------------- ### Start Local Frontend Server Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/packages/hooks/README.md Command to start the local frontend development server. ```bash yarn dev ``` -------------------------------- ### Start Viewer.dev Dev Server Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/apps/viewer.dev/README.md Run this command from the monorepo root folder to start the Viewer.dev development server. ```bash yarn workspace viewer.dev dev ``` -------------------------------- ### Install Development Dependencies Source: https://github.com/papermerge/papermerge-core/blob/master/README.md Installs development dependencies for the backend using uv. ```bash $ uv sync ``` -------------------------------- ### Start Dev Server for UI and Viewer Workspaces Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/README.md Commands to start the development server for the 'ui' and '@papermerge/viewer' workspaces. ```bash yarn workspace ui dev yarn workspace @papermerge/viewer dev ``` -------------------------------- ### Start Viewer Dev Server Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/packages/viewer/README.md Run this command from the monorepo root folder to start the development server for the viewer package. ```bash yarn workspace @papermerge/viewer dev ``` -------------------------------- ### Start Kommon.dev Development Server Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/apps/kommon.dev/README.md Run this command from the monorepo root to start the dev server for the Kommon.dev workspace. ```bash yarn workspace kommon.dev dev ``` -------------------------------- ### Start Commander.dev Dev Server Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/apps/commander.dev/README.md Run this command from the monorepo root folder to start the development server for Commander.dev. ```bash yarn workspace commander.dev dev ``` -------------------------------- ### Start Dev Server for Specific Workspace Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/README.md Command to start the development server for a particular workspace, such as 'hooks'. ```bash yarn workspace hooks.dev dev ``` -------------------------------- ### Install Monorepo Dependencies Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/apps/viewer.dev/README.md Installs all dependencies for the entire monorepo after creating a new workspace. ```bash cd /path/to/your/monorepo yarn install ``` -------------------------------- ### Run Papermerge App with Docker Source: https://github.com/papermerge/papermerge-core/blob/master/README.md This command starts the Papermerge App with a basic setup using Docker. Ensure you set the necessary environment variables for security and authentication. ```bash docker run -p 8000:80 \ -e PAPERMERGE__SECURITY__SECRET_KEY=abc \ -e PAPERMERGE__AUTH__PASSWORD=123 \ papermerge/papermerge:3.5.3 ``` -------------------------------- ### Start Frontend Development Server Source: https://github.com/papermerge/papermerge-core/blob/master/README.md Starts the frontend development server using yarn. The UI will be available at http://localhost:5173/. ```bash cd frontend yarn workspace ui dev ``` -------------------------------- ### Start Backend Server Source: https://github.com/papermerge/papermerge-core/blob/master/README.md Starts the backend server using uv. The server will be accessible on localhost port 8000, and its Swagger documentation can be found at http://localhost:8000/docs. ```bash $ uv run task server ``` -------------------------------- ### Build and Start Papermerge Services Source: https://github.com/papermerge/papermerge-core/blob/master/docker/standard/README.md Builds the Docker images for Papermerge and then starts the services. Navigate to the project's standard Docker directory first. ```bash cd /docker/standard/ docker compose up --build ``` -------------------------------- ### Start Docker Services with Build Source: https://github.com/papermerge/papermerge-core/blob/master/docker/oidc/README.md Starts the Docker services, rebuilding any changed images. Useful for development or when making changes to the Dockerfiles. ```bash cd /docker/oidc/ docker compose up --build ``` -------------------------------- ### Add Dependencies Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/apps/viewer.dev/README.md Installs core and development dependencies for the Viewer.dev application. ```bash yarn add @mantine/core @mantine/hooks react react-dom yarn add -D @types/react @types/react-dom typescript vite ``` -------------------------------- ### Start Docker Services and Log Output Source: https://github.com/papermerge/papermerge-core/blob/master/docker/oidc/README.md Starts the Docker services, rebuilding images if necessary, and redirects all output to both the console and a file named 'compose.log'. ```bash cd /docker/oidc/ docker compose up --build 2>&1 | tee compose.log ``` -------------------------------- ### Build and Start Services with Log Redirection Source: https://github.com/papermerge/papermerge-core/blob/master/docker/standard/README.md Builds and starts the Papermerge services, redirecting all output to a log file named 'compose.log'. Navigate to the project's standard Docker directory first. ```bash cd /docker/standard/ docker compose up --build 2>&1 | tee compose.log ``` -------------------------------- ### Start Docker Services Source: https://github.com/papermerge/papermerge-core/blob/master/docker/oidc/README.md Starts the Docker services defined in the docker-compose.yml file in detached mode. Ensure you have generated the cookie secret first. ```bash cd /docker/oidc/ docker compose up -d ``` -------------------------------- ### Run Test Suite Source: https://github.com/papermerge/papermerge-core/blob/master/README.md Installs development dependencies and runs the test suite using uv and pytest. ```bash uv sync --group dev uv pytest ``` -------------------------------- ### Start Papermerge Services Source: https://github.com/papermerge/papermerge-core/blob/master/docker/standard/README.md Starts the Papermerge services in detached mode using Docker Compose. Navigate to the project's standard Docker directory first. ```bash cd /docker/standard/ docker compose up -d ``` -------------------------------- ### FastAPI Server for useDocumentThumbnailPolling Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/packages/hooks/README.md A FastAPI server example to test the `useDocumentThumbnailPolling` hook. It simulates different preview statuses based on a counter. ```python from fastapi.middleware.cors import CORSMiddleware from fastapi import FastAPI, Query from typing import List app = FastAPI() app.add_middleware( CORSMiddleware, allow_origins=["http://localhost:5173"], # or ["*"] to allow all origins (not recommended for production) allow_credentials=True, allow_methods=["*"], allow_headers=["*"], ) counter = 1 @app.get("/api/previews") async def root(doc_ids: List[str] = Query()): global counter result = [] if counter % 4 != 0: for doc_id in doc_ids: result.append({ 'doc_id': doc_id, 'status': 'pending', 'preview_image_url': None }) else: for doc_id in doc_ids: result.append({ 'doc_id': doc_id, 'status': 'ready', 'preview_image_url': f'http://image-cdn/{doc_id}/sm.jpg' }) counter += 1 return result ``` -------------------------------- ### Simulate User Authentication in Dev Mode Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/README.md To start in development mode without actual authentication, set VITE_REMOTE_USER and VITE_REMOTE_GROUPS in the .env.development.local file. ```env VITE_REMOTE_USER=admin VITE_REMOTE_GROUPS=admin VITE_BASE_URL=http://localhost:8000/ ``` -------------------------------- ### Backend Development Environment Variables Source: https://github.com/papermerge/papermerge-core/blob/master/README.md Sets environment variables required for backend development. Ensure these are configured correctly, for example, using direnv. ```bash export PM_DB_URL=postgresql://coco:***@127.0.0.1:5432/pmgdb export PM_MEDIA_ROOT=/home/eugen/var/pmgdata export PM_API_PREFIX='/api' ``` -------------------------------- ### Frontend Development Environment Variables Source: https://github.com/papermerge/papermerge-core/blob/master/README.md Defines environment variables for the frontend development. Adjust values to match your backend setup. VITE_KEEP_UNUSED_DATA_FOR caches data for one second. ```bash VITE_REMOTE_USER=admin VITE_REMOTE_USER_ID=49e78737-7c6e-410f-ae27-315b04bdec69 VITE_REMOTE_GROUPS=admin VITE_BASE_URL=http://localhost:8000 VITE_KEEP_UNUSED_DATA_FOR=1 ``` -------------------------------- ### Generate Cookie Secret and Environment File Source: https://github.com/papermerge/papermerge-core/blob/master/docker/oidc/README.md Generates a random secret for OAuth2-Proxy session cookies and saves it to a .env file. This is a prerequisite for starting the services. ```bash cd /docker/oidc/ export OAUTH2_COOKIE_SECRET=$(openssl rand -base64 32) echo "OAUTH2_COOKIE_SECRET=$OAUTH2_COOKIE_SECRET" > .env ``` -------------------------------- ### Display CLI Help Source: https://github.com/papermerge/papermerge-core/blob/master/README.md Displays help information for the 'pm' command-line interface. ```bash pm --help ``` -------------------------------- ### List Frontend Workspaces Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/README.md Command to list all available workspaces within the frontend project. ```bash yarn workspaces list ``` -------------------------------- ### Create Kommon.dev Package Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/apps/kommon.dev/README.md Steps to create the Kommon.dev package using Vite and add necessary dependencies. ```bash cd /path/to/your/monorepo mkdir -p apps/viewer.dev cd apps/viewer.dev yarn dlx create-vite@latest . --template react-ts yarn add @mantine/core @mantine/hooks react react-dom yarn add -D @types/react @types/react-dom typescript vite cd /path/to/your/monorepo yarn install ``` -------------------------------- ### Create Commander.dev App Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/apps/commander.dev/README.md Steps to create a new Commander.dev application within a monorepo using Vite and React TypeScript. ```bash cd /path/to/your/monorepo mkdir -p apps/commander.dev cd apps/commander.dev yarn dlx create-vite@latest . --template react-ts yarn add @mantine/core @mantine/hooks react react-dom yarn add -D @types/react @types/react-dom typescript vite cd /path/to/your/monorepo yarn install ``` -------------------------------- ### Switch Python Version Source: https://github.com/papermerge/papermerge-core/blob/master/README.md Switches to a specific Python version within your virtual environment using uv. ```bash uv sync --python 3.14 ``` -------------------------------- ### Create Papermerge Viewer Package Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/packages/viewer/README.md Steps to create the Papermerge Viewer package within a monorepo using Vite and adding necessary dependencies. ```bash cd /path/to/your/monorepo ``` ```bash mkdir -p packages/viewer cd packages/viewer ``` ```bash yarn init -y // I think this step is redundant ``` ```bash yarn dlx create-vite@latest . --template react-ts ``` ```bash yarn add @mantine/core @mantine/hooks react react-dom ``` ```bash yarn add -D @types/react @types/react-dom typescript vite ``` ```bash cd /path/to/your/monorepo yarn install ``` -------------------------------- ### Create Vite React TS App Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/apps/viewer.dev/README.md Steps to create a new Vite project with the React TypeScript template in the apps/viewer.dev directory. ```bash cd /path/to/your/monorepo mkdir -p apps/viewer.dev cd apps/viewer.dev yarn dlx create-vite@latest . --template react-ts ``` -------------------------------- ### View Papermerge Service Logs Source: https://github.com/papermerge/papermerge-core/blob/master/docker/standard/README.md Follows the logs of the Papermerge services in real-time. Navigate to the project's standard Docker directory first. ```bash cd /docker/standard/ docker compose logs -f ``` -------------------------------- ### Build Search Index Source: https://github.com/papermerge/papermerge-core/blob/master/README.md Clears the existing search index and rebuilds it from scratch using the 'pm search build' command. ```bash pm search build ``` -------------------------------- ### Node.js Version Requirement Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/apps/commander.dev/README.md Specifies the Node.js version tested with Commander.dev. ```bash node --version v20.13.1 ``` -------------------------------- ### Build Docker Image Source: https://github.com/papermerge/papermerge-core/blob/master/docker/oidc/README.md Build the Docker image for papermerge using docker compose. Navigate to the project root's docker/oidc directory before running this command. ```bash cd /docker/oidc/ docker compose build papermerge --no-cache ``` -------------------------------- ### Auth0 OIDC Configuration Source: https://github.com/papermerge/papermerge-core/blob/master/docker/oidc/README.md Configure oauth2-proxy to use Auth0 as an OIDC provider. Replace 'your-tenant.auth0.com' with your Auth0 tenant domain and provide your client-id and client-secret. ```yaml oauth2-proxy: command: - --provider=oidc - --oidc-issuer-url=https://your-tenant.auth0.com/ - --client-id=your-client-id - --client-secret=your-client-secret ``` -------------------------------- ### Build Papermerge Docker Image Source: https://github.com/papermerge/papermerge-core/blob/master/docker/standard/README.md Builds the Papermerge Docker image without using the cache. Navigate to the project's standard Docker directory first. ```bash cd /docker/standard/ docker compose build papermerge --no-cache ``` -------------------------------- ### Set REST API Base URL Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/README.md Configure the base URL for the server's REST API by setting the VITE_BASE_URL variable in the .env.development.local file. ```env VITE_BASE_URL=http://localhost:8000/ ``` -------------------------------- ### Follow Docker Service Logs Source: https://github.com/papermerge/papermerge-core/blob/master/docker/oidc/README.md Continuously streams the logs from all running Docker services. This is helpful for monitoring real-time activity and debugging issues. ```bash cd /docker/oidc/ docker compose logs -f ``` -------------------------------- ### Yarn Version Requirement Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/apps/commander.dev/README.md Specifies the Yarn version tested with Commander.dev. ```bash yarn --version 4.9.1 ``` -------------------------------- ### Integrate React-Specific ESLint Plugins Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/apps/hooks.dev/README.md Add 'eslint-plugin-react-x' and 'eslint-plugin-react-dom' to your ESLint configuration to enable React-specific linting rules. This includes enabling their recommended TypeScript and general rules. ```javascript // eslint.config.js import reactX from 'eslint-plugin-react-x' import reactDom from 'eslint-plugin-react-dom' export default tseslint.config({ plugins: { // Add the react-x and react-dom plugins 'react-x': reactX, 'react-dom': reactDom, }, rules: { // other rules... // Enable its recommended typescript rules ...reactX.configs['recommended-typescript'].rules, ...reactDom.configs.recommended.rules, }, }) ``` -------------------------------- ### Extend ESLint with Type-Aware Rules Source: https://github.com/papermerge/papermerge-core/blob/master/frontend/apps/hooks.dev/README.md Configure ESLint to use type-aware lint rules by extending recommended, strict, or stylistic type-checked configurations. Ensure 'tsconfig.node.json' and 'tsconfig.app.json' are specified for project parsing. ```javascript export default tseslint.config({ extends: [ // Remove ...tseslint.configs.recommended and replace with this ...tseslint.configs.recommendedTypeChecked, // Alternatively, use this for stricter rules ...tseslint.configs.strictTypeChecked, // Optionally, add this for stylistic rules ...tseslint.configs.stylisticTypeChecked, ], languageOptions: { // other options... parserOptions: { project: ['./tsconfig.node.json', './tsconfig.app.json'], tsconfigRootDir: import.meta.dirname, }, }, }) ``` -------------------------------- ### Display Search Index Statistics Source: https://github.com/papermerge/papermerge-core/blob/master/README.md Retrieves and displays statistics for the search index using the 'pm search stats' command. ```bash pm search stats ``` -------------------------------- ### Authentik OIDC Configuration Source: https://github.com/papermerge/papermerge-core/blob/master/docker/oidc/README.md Configure oauth2-proxy to use Authentik as an OIDC provider. Ensure the oidc-issuer-url, client-id, and client-secret are correctly set for your Authentik instance. ```yaml oauth2-proxy: command: - --provider=oidc - --oidc-issuer-url=https://authentik.example.com/application/o/papermerge/ - --client-id=your-client-id - --client-secret=your-client-secret # ... other options ``` -------------------------------- ### Export Keycloak Realm Source: https://github.com/papermerge/papermerge-core/blob/master/docker/oidc/README.md Exports the current Keycloak 'papermerge' realm configuration to a JSON file. This can be used for backup or to persist realm configurations. ```bash docker compose exec keycloak /opt/keycloak/bin/kc.sh export \ --dir /tmp/export --realm papermerge docker compose cp keycloak:/tmp/export/papermerge-realm.json \ ./keycloak/realm-export.json ``` -------------------------------- ### Check Papermerge Service Status Source: https://github.com/papermerge/papermerge-core/blob/master/docker/standard/README.md Displays the status of the running Docker containers for Papermerge. Navigate to the project's standard Docker directory first. ```bash cd /docker/standard/ docker compose ps ``` -------------------------------- ### Check Docker Service Status Source: https://github.com/papermerge/papermerge-core/blob/master/docker/oidc/README.md Displays the current status of the Docker services managed by docker-compose. Useful for verifying that services are running as expected. ```bash cd /docker/oidc/ docker compose ps ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.