### First-Time Setup Commands Source: https://github.com/aexol-studio/deenruv/blob/main/AGENTS.md Run these commands in order to set up the project for the first time: install dependencies, start Docker services, build all packages, seed the database, and start the server and admin panel. ```bash pnpm install # Install all dependencies pnpm server-docker-up # Start Postgres, Redis, MinIO pnpm build # Build all packages (sequential, respects deps) pnpm server-populate # Seed database with sample data pnpm start # Start server + admin panel ``` -------------------------------- ### Get Running in 5 Minutes Source: https://github.com/aexol-studio/deenruv/blob/main/README.md Quick-start commands to install dependencies, start required services, build, seed sample data, and launch the server and admin panel. Requires Node.js >= 18, pnpm, and Docker. ```bash pnpm install # Install dependencies pnpm server-docker-up # Start Postgres, Redis, MinIO pnpm build # Build all packages pnpm server-populate # Seed with sample data pnpm start # Launch server + admin panel ``` -------------------------------- ### Quick Start: Create a plugin with extensions Source: https://github.com/aexol-studio/deenruv/blob/main/packages/react-ui-devkit/docs/extensions-api.md Shows the minimal setup for a Deenruv UI plugin using the `extensions` array. Requires importing `createDeenruvUIPlugin` and `DEENRUV_UI_VERSION` from `@deenruv/react-ui-devkit`, and a component to inject. ```typescript import { createDeenruvUIPlugin, DEENRUV_UI_VERSION } from '@deenruv/react-ui-devkit'; import { MyComponent } from './components/MyComponent'; export const MyPlugin = createDeenruvUIPlugin({ version: DEENRUV_UI_VERSION, name: 'My Plugin', extensions: [ { id: 'my-product-widget', surface: 'products-detail-view', component: MyComponent, }, ], }); ``` -------------------------------- ### Install @deenruv/wfirma-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/wfirma-plugin/README.md Install the plugin using pnpm. ```bash pnpm add @deenruv/wfirma-plugin ``` -------------------------------- ### Install @deenruv/job-queue-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/job-queue-plugin/README.md Install the package using pnpm. ```bash pnpm add @deenruv/job-queue-plugin ``` -------------------------------- ### Start local Docker services and run server Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/deployment/docker.mdx Starts the Docker Compose services, then populates the database and starts the server. Run these commands in order after the services are up. ```bash pnpm server-docker-up ``` ```bash pnpm server-populate pnpm start ``` -------------------------------- ### Install @deenruv/deenruv-examples-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/deenruv-examples-plugin/README.md Install the plugin package using pnpm. ```bash pnpm add @deenruv/deenruv-examples-plugin ``` -------------------------------- ### Install with pnpm Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/harden-plugin/README.md Install the plugin using pnpm. ```bash pnpm add @deenruv/harden-plugin ``` -------------------------------- ### Run @deenruv/create with verbose logging Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/getting-started/installation.mdx Use the --log-level verbose flag to get more detailed output when troubleshooting installation issues. ```sh npx @deenruv/create my-shop --log-level verbose ``` -------------------------------- ### Install @deenruv/method-modal-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/method-modal-plugin/README.md Install the plugin using pnpm. ```bash pnpm add @deenruv/method-modal-plugin ``` -------------------------------- ### Install @deenruv/replicate-simple-bg-plugin and replicate Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/replicate-simple-bg-plugin/README.md Install the plugin and the Replicate client library using pnpm. ```bash pnpm add @deenruv/replicate-simple-bg-plugin replicate ``` -------------------------------- ### Install @deenruv/replicate-plugin and replicate Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/replicate-plugin/README.md Install the plugin and the Replicate SDK using pnpm. ```bash pnpm add @deenruv/replicate-plugin replicate ``` -------------------------------- ### Install @deenruv/payments-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/payments-plugin/README.md Install the main payments plugin package. ```bash pnpm add @deenruv/payments-plugin ``` -------------------------------- ### Install @deenruv/asset-server-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/asset-server-plugin/README.md Install the plugin package using pnpm. ```bash pnpm add @deenruv/asset-server-plugin ``` -------------------------------- ### Start development server Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/developer-guide/plugins.mdx Starts the development server after generating the migration, allowing you to test the plugin. ```bash npm run dev ``` -------------------------------- ### Install @deenruv/product-badges-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/product-badges-plugin/README.md Install the plugin package using pnpm. ```bash pnpm add @deenruv/product-badges-plugin ``` -------------------------------- ### Install Payment Provider Client Libraries Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/payments-plugin/README.md Install the client library for your chosen payment provider(s). ```bash # Stripe pnpm add stripe # Mollie pnpm add @mollie/api-client # Braintree pnpm add braintree ``` -------------------------------- ### Install @deenruv/seo-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/seo-plugin/README.md Install the @deenruv/seo-plugin package using pnpm. ```bash pnpm add @deenruv/seo-plugin ``` -------------------------------- ### Install @deenruv/redis-strategy-plugin and ioredis Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/redis-strategy-plugin/README.md Install the plugin and its peer dependency ioredis using pnpm. ```bash pnpm add @deenruv/redis-strategy-plugin ioredis ``` -------------------------------- ### Install @deenruv/order-reminder-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/order-reminder-plugin/README.md Install the plugin package using pnpm. ```bash pnpm add @deenruv/order-reminder-plugin ``` -------------------------------- ### Start development servers Source: https://github.com/aexol-studio/deenruv/blob/main/packages/create/README.md After creating the project, navigate into the directory and run npm run dev to start the server, worker, and admin panel concurrently. The admin API is at http://localhost:6100/admin-api, shop API at http://localhost:6100/shop-api, and admin UI at http://localhost:6101/admin-ui. ```sh cd my-app npm run dev # Starts server, worker, and admin panel concurrently ``` -------------------------------- ### Install @deenruv/copy-order-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/copy-order-plugin/README.md Install the plugin package using pnpm. ```bash pnpm add @deenruv/copy-order-plugin ``` -------------------------------- ### Install @deenruv/dashboard-widgets-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/dashboard-widgets-plugin/README.md Install the plugin package using pnpm. ```bash pnpm add @deenruv/dashboard-widgets-plugin ``` -------------------------------- ### Install @google-cloud/pubsub Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/job-queue-plugin/README.md Install the Google Cloud Pub/Sub client library for the PubSubPlugin. ```bash pnpm add @google-cloud/pubsub ``` -------------------------------- ### Install @deenruv/stellate-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/stellate-plugin/README.md Install the plugin package using pnpm. ```bash pnpm add @deenruv/stellate-plugin ``` -------------------------------- ### Install bullmq Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/job-queue-plugin/README.md Install the BullMQ dependency for the BullMQJobQueuePlugin. ```bash pnpm add bullmq ``` -------------------------------- ### Install @deenruv/newsletter-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/newsletter-plugin/README.md Install the plugin package using pnpm. ```bash pnpm add @deenruv/newsletter-plugin ``` -------------------------------- ### Start the Deenruv server with yarn or npm Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/getting-started/installation.mdx After scaffolding, move into the project directory and start the server. Use either 'yarn dev' or 'npm run dev'. The server will be available at localhost:6100. ```bash cd my-shop yarn dev # or npm run dev ``` -------------------------------- ### Install @deenruv/merchant-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/merchant-plugin/README.md Install the plugin package using pnpm. ```bash pnpm add @deenruv/merchant-plugin ``` -------------------------------- ### Install @deenruv/react-ui-devkit Source: https://github.com/aexol-studio/deenruv/blob/main/packages/react-ui-devkit/README.md Installs the UI plugin development kit as a dependency. ```bash pnpm add @deenruv/react-ui-devkit ``` -------------------------------- ### Install and initialize GraphQL Code Generator Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/storefront/codegen.mdx Install GraphQL Code Generator and initialize the configuration. The init command prompts for schema URL, operations glob, and config file name. ```bash npm i graphql npm i -D typescript @graphql-codegen/cli npx graphql-code-generator init npm install ``` -------------------------------- ### Install @deenruv/facet-harmonica-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/facet-harmonica-plugin/README.md Install the plugin package using pnpm. ```bash pnpm add @deenruv/facet-harmonica-plugin ``` -------------------------------- ### Usage Example: Get Full Content of Worker-Job-Queue Page Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/getting-started/mcp-docs-server.mdx Ask your AI assistant to get the full content of the worker-job-queue docs page. The AI will call the appropriate MCP tool under the hood. ```text Get the full content of the worker-job-queue docs page ``` -------------------------------- ### Install @deenruv/reviews-plugin with pnpm Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/reviews-plugin/README.md Install the @deenruv/reviews-plugin package using pnpm. ```bash pnpm add @deenruv/reviews-plugin ``` -------------------------------- ### Install @deenruv/cronjobs-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/cronjobs-plugin/README.md Install the plugin package using pnpm. ```bash pnpm add @deenruv/cronjobs-plugin ``` -------------------------------- ### VITE_ADMIN_UI_PLUGINS environment variable examples Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/extending-the-admin-ui/plugin-system.mdx Shows how to set the VITE_ADMIN_UI_PLUGINS environment variable to load specific plugins, all plugins, or no plugins when starting the admin UI. The empty string disables all plugins, while a CSV list or 'all' enables the corresponding set. ```bash VITE_ADMIN_UI_PLUGINS="dashboard-widgets,badges" pnpm start:admin-ui VITE_ADMIN_UI_PLUGINS="all" pnpm start:admin-ui VITE_ADMIN_UI_PLUGINS="" pnpm start:admin-ui # no plugins ``` -------------------------------- ### Install @deenruv/apollo-cache Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/apollo-cache/README.md Install the @deenruv/apollo-cache package using pnpm. ```bash pnpm add @deenruv/apollo-cache ``` -------------------------------- ### Install @deenruv/core Source: https://github.com/aexol-studio/deenruv/blob/main/packages/core/README.md Install the Deenruv core package via npm. ```bash $ npm install @deenruv/core ``` -------------------------------- ### Usage Example: Find How to Create a Plugin Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/getting-started/mcp-docs-server.mdx Ask your AI assistant to use the Deenruv docs tools to find how to create a plugin. The AI will call the appropriate MCP tool under the hood. ```text Use deenruv-docs tools to find how to create a plugin ``` -------------------------------- ### Fetch-based client setup for Shop API (client.ts, App.tsx, index.ts) Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/storefront/connect-api.mdx A complete React + TypeScript example of connecting to the Shop API using the native fetch API. The client.ts file defines a query function that sends POST requests with JSON body, handles authentication via localStorage and the deenruv-token header, and includes a useQuery React hook. App.tsx uses the hook to fetch and display products, and index.ts mounts the app. ```ts import { useState, useEffect } from 'react'; // If using bearer-token based session management, we'll store the token // in localStorage using this key. const AUTH_TOKEN_KEY = 'auth_token'; const API_URL = 'https://readonlydemo.deenruv.com/shop-api'; let languageCode: string | undefined; let channelToken: string | undefined; export function setLanguageCode(value: string | undefined) { languageCode = value; } export function setChannelToken(value: string | undefined) { channelToken = value; } export function query(document: string, variables: Record = {}) { const authToken = localStorage.getItem(AUTH_TOKEN_KEY); const headers = new Headers({ 'content-type': 'application/json', }); if (authToken) { headers.append('authorization', `Bearer ${authToken}`); } if (channelToken) { headers.append('deenruv-token', channelToken); } let endpoint = API_URL; if (languageCode) { endpoint += `?languageCode=${languageCode}`; } return fetch(endpoint, { method: 'POST', headers, credentials: 'include', body: JSON.stringify({ query: document, variables, }), }).then(res => { if (!res.ok) { throw new Error(`An error ocurred, HTTP status: ${res.status}`); } const newAuthToken = res.headers.get('deenruv-auth-token'); if (newAuthToken) { localStorage.setItem(AUTH_TOKEN_KEY, newAuthToken); } return res.json(); }); } /** * Here we have wrapped the `query` function into a React hook for convenient use in * React components. */ export function useQuery(document: string, variables: Record = {}) { const [data, setData] = useState(null); const [loading, setLoading] = useState(true); const [error, setError] = useState(null); useEffect(() => { query(document, variables) .then(result => { setData(result.data); setError(null); }) .catch(err => { setError(err.message); setData(null); }) .finally(() => { setLoading(false); }); }, []); return { data, loading, error }; } ``` ```tsx import { useQuery } from './client'; import './style.css'; const GET_PRODUCTS = /*GraphQL*/ ` query GetProducts($options: ProductListOptions) { products(options: $options) { items { id name slug featuredAsset { preview } } } } `; export default function App() { const { data, loading, error } = useQuery(GET_PRODUCTS, { options: { take: 3 }, }); if (loading) return

Loading...

; if (error) return

Error : {error.message}

; return data.products.items.map(({ id, name, slug, featuredAsset }) => (

{name}

{name}
)); } ``` ```ts import * as React from 'react'; import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; import App from './App'; const rootElement = document.getElementById('root'); const root = createRoot(rootElement); root.render( ); ``` -------------------------------- ### Install @deenruv/phone-number-validation Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/phone-number-validation/README.md Install the plugin package using pnpm. ```bash pnpm add @deenruv/phone-number-validation ``` -------------------------------- ### Configure PubSubPlugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/job-queue-plugin/README.md Example configuration for PubSubPlugin, with placeholder for PubSub options. ```typescript import { PubSubPlugin } from '@deenruv/job-queue-plugin/package/pub-sub'; const config = { plugins: [ PubSubPlugin.init({ // PubSub options }), ], }; ``` -------------------------------- ### Configuring UI component for argument Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/developer-guide/strategies-configurable-operations.mdx Shows how to set a custom UI component for an argument using the `ui` property. The example uses a 'select-form-input' component with options for string matching. Refer to the Custom Fields guide for available UI components. ```ts { args: { operator: { type: 'string', ui: { component: 'select-form-input', options: [ { value: 'startsWith' }, { value: 'endsWith' }, { value: 'contains' }, { value: 'doesNotContain' }, ], }, }, } } ``` -------------------------------- ### Install @deenruv/email-plugin with pnpm Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/email-plugin/README.md Install the plugin package using pnpm. ```bash pnpm add @deenruv/email-plugin ``` -------------------------------- ### Install @deenruv/sentry-plugin and @sentry/node Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/sentry-plugin/README.md Install the Sentry plugin and the Sentry Node.js SDK. Run this command in your Deenruv server project. ```bash pnpm add @deenruv/sentry-plugin @sentry/node ``` -------------------------------- ### Install peer dependency @deenruv/core Source: https://github.com/aexol-studio/deenruv/blob/main/packages/react-ui-devkit/README.md Installs the required peer dependency for the UI dev kit. ```bash pnpm add @deenruv/core ``` -------------------------------- ### Import example for atom components Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/extending-the-admin-ui/components.mdx Example of importing multiple atom components from the @deenruv/react-ui-devkit package. ```tsx import { Button, Input, Card, Dialog, Table, Badge, Tabs, Select, Switch, Spinner, } from '@deenruv/react-ui-devkit'; ``` -------------------------------- ### Deployment commands (docker compose) Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/deployment/docker.mdx Commands to build and start services, run database migrations, and view logs for the server service. ```bash # Build and start all services docker compose -f docker-compose.prod.yml up -d --build # Run database migrations docker compose -f docker-compose.prod.yml exec server node dist/migrate.js # View logs docker compose -f docker-compose.prod.yml logs -f server ``` -------------------------------- ### Install @deenruv/elasticsearch-plugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/elasticsearch-plugin/README.md Install the plugin and the Elasticsearch client. Requires Elasticsearch v7.0 or higher (below v7.10.2 due to client compatibility). ```bash pnpm add @deenruv/elasticsearch-plugin @elastic/elasticsearch ``` -------------------------------- ### Install dependencies with pnpm Source: https://github.com/aexol-studio/deenruv/blob/main/CONTRIBUTING.md Installs project dependencies. The strict rule is to never use --legacy-peer-deps; all dependency conflicts must be resolved properly. ```bash pnpm install ``` -------------------------------- ### createDeenruvUIPlugin with extensions Source: https://github.com/aexol-studio/deenruv/blob/main/packages/react-ui-devkit/docs/extensions-api.md Example of creating a Deenruv UI plugin with an extension that injects a component into a detail view surface. ```APIDOC ## createDeenruvUIPlugin ### Description Creates a Deenruv UI plugin with an `extensions` array to inject React components into detail view surfaces. ### Method createDeenruvUIPlugin ### Parameters #### Plugin Configuration - **version** (string) - Required - The Deenruv UI version, typically `DEENRUV_UI_VERSION`. - **name** (string) - Required - The plugin name. - **extensions** (Array) - Optional - List of surface extensions. ### Request Example ts import { createDeenruvUIPlugin, DEENRUV_UI_VERSION } from '@deenruv/react-ui-devkit'; import { MyComponent } from './components/MyComponent'; export const MyPlugin = createDeenruvUIPlugin({ version: DEENRUV_UI_VERSION, name: 'My Plugin', extensions: [ { id: 'my-product-widget', surface: 'products-detail-view', component: MyComponent, }, ], }); ### Response Returns a plugin object that can be used with the Deenruv UI system. ``` -------------------------------- ### Image Transformation URL Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/asset-server-plugin/README.md Example URL for on-the-fly image transformation with width, height, and mode parameters. ```text http://localhost:6100/assets/photo.jpg?w=500&h=300&mode=resize ``` -------------------------------- ### Start server with DB environment variable Source: https://github.com/aexol-studio/deenruv/blob/main/apps/server/README.md Run the Deenruv server with a specific database type. The DB environment variable selects the database; the default is mysql if none is specified. ```bash DB=mysql npm run start DB=postgres npm run start DB=sqlite npm run start ``` -------------------------------- ### Configure BullMQJobQueuePlugin Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/job-queue-plugin/README.md Example configuration for BullMQJobQueuePlugin, including connection and worker options. ```typescript import { BullMQJobQueuePlugin } from '@deenruv/job-queue-plugin/package/bullmq'; const config = { plugins: [ // Remove DefaultJobQueuePlugin first BullMQJobQueuePlugin.init({ connection: { host: 'localhost', port: 60379, }, workerOptions: { concurrency: 10, }, }), ], }; ``` -------------------------------- ### SimpleSelect usage example Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/extending-the-admin-ui/components.mdx Example of using the SimpleSelect molecule component with value, onChange, and options array. ```tsx import { SimpleSelect } from '@deenruv/react-ui-devkit'; ``` -------------------------------- ### Start the worker with bootstrapWorker (src/index-worker.ts) Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/developer-guide/worker-job-queue.mdx Starts the Deenruv worker by calling bootstrapWorker() with the same config as the main server. The returned worker's startJobQueue() method begins processing jobs from the queue. Errors are logged to the console. ```typescript import { bootstrapWorker } from '@deenruv/core'; import { config } from './deenruv-config'; bootstrapWorker(config) .then(worker => worker.startJobQueue()) .catch(err => { console.log(err); }); ``` -------------------------------- ### SearchInput usage example Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/extending-the-admin-ui/components.mdx Example of using the SearchInput molecule component with value, onChange, and placeholder props. ```tsx import { SearchInput } from '@deenruv/react-ui-devkit'; ``` -------------------------------- ### Migration Example: useGFFLP to useDeenruvForm Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/developer-guide/react-ui-devkit-form-roadmap.mdx Shows the before and after of migrating a form from useGFFLP to useDeenruvForm. The before uses useGFFLP with a custom validation object, while the after uses useDeenruvForm with a Zod schema. ```ts // Before const { state, setField, checkIfAllFieldsAreValid } = useGFFLP( 'CreateProductInput', 'name', 'slug', )({ name: { validate: (v) => v ? undefined : ['Required'] } }); // After const form = useDeenruvForm({ schema: z.object({ name: z.string().min(1, t('validation.required')), slug: z.string(), }), }); ``` -------------------------------- ### GraphQL input type example Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/getting-started/graphql-intro.mdx Shows how to use an input type to pass complex data to a mutation. Input types use the `input` keyword. ```graphql type Mutation { updateCustomerEmail(input: UpdateCustomerEmailInput!): Customer! } input UpdateCustomerEmailInput { customerId: ID! email: String! } ``` -------------------------------- ### Run dev mode with pnpm commands Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/extending-the-admin-ui/getting-started.mdx Commands to run the development environment. Start Docker services, then the server, and finally the admin UI in a separate terminal. The plugin page will be accessible at http://localhost:5173/admin-ui/extensions/my-plugin-ui/. ```bash # Start Docker services (Postgres, Redis, MinIO) pnpm server-docker-up # Start the server pnpm start:server # Start the admin UI (in a separate terminal) pnpm start:admin-ui ``` -------------------------------- ### Run pre-release checks Source: https://github.com/aexol-studio/deenruv/blob/main/CONTRIBUTING.md Pre-steps to run before a release to ensure everything is in order. Start from a clean git working tree. ```bash pnpm i pnpm run lint:fix pnpm test pnpm run build:dev ``` -------------------------------- ### Usage Example: Search for Payment Integration Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/getting-started/mcp-docs-server.mdx Ask your AI assistant to search the Deenruv docs for payment integration. The AI will call the appropriate MCP tool under the hood. ```text Search the Deenruv docs for payment integration ``` -------------------------------- ### createFormSchema example Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/extending-the-admin-ui/hooks.mdx Shows how to use createFormSchema to define a form schema with zod, providing a consistent pattern for admin forms. ```ts import { createFormSchema } from '@deenruv/react-ui-devkit'; import { z } from 'zod'; const schema = createFormSchema({ name: z.string().min(1, 'Name is required'), code: z.string().min(1, 'Code is required'), price: z.number().min(0), customFields: z.record(z.unknown()).optional(), }); ``` -------------------------------- ### Example: Controlling Order Source: https://github.com/aexol-studio/deenruv/blob/main/packages/react-ui-devkit/docs/extensions-api.md Shows how to use the `order` field to control the placement of extensions. Extensions with `order` are sorted ascending; those without are appended last. ```typescript extensions: [ { id: 'price-override', surface: 'products-detail-view', order: 10, component: PriceOverride }, { id: 'badges', surface: 'products-detail-view', order: 20, component: Badges }, { id: 'seo-meta', surface: 'products-detail-view', component: SeoMeta }, // no order → last ], ``` -------------------------------- ### JSON response for filtered product reviews Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/how-to/paginated-list.mdx Example response showing totalItems and items array with review details for products matching the filter. ```json { "data": { "productReviews": { "totalItems": 3, "items": [ { "id": "12", "createdAt": "2023-08-23T12:00:00Z", "product": { "name": "Smartphone X" }, "text": "The best phone I've ever had!", "rating": 5 }, { "id": "42", "createdAt": "2023-08-22T15:30:00Z", "product": { "name": "Smartphone Y" }, "text": "Not a very good phone at all.", "rating": 0 } ] } } } ``` -------------------------------- ### Query eligiblePaymentMethods with example result Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/storefront/checkout-flow.mdx Query the eligiblePaymentMethods to retrieve available payment methods. The result can be displayed to the customer for selection. ```graphql query GetPaymentMethods { eligiblePaymentMethods { id name code isEligible } } ``` ```json { "data": { "eligiblePaymentMethods": [ { "id": "1", "name": "Stripe", "code": "stripe", "isEligible": true }, { "id": "2", "name": "Apple Pay", "code": "apple-pay", "isEligible": true }, { "id": "3", "name": "Pay on delivery", "code": "pay-on-delivery", "isEligible": false } ] } } ``` -------------------------------- ### Register SqljsInitializer for e2e tests (before/after) Source: https://github.com/aexol-studio/deenruv/blob/main/CHANGELOG_v1.md Before and after examples for the breaking change in @deenruv/testing. The before version uses the removed dataDir option in TestServer.init(); the after version requires explicitly registering the SqljsInitializer with registerInitializer('sqljs', ...) and omits dataDir. ```TypeScript import { createTestEnvironment, testConfig } from '@deenruv/testing'; describe('my e2e test suite', () => { const { server, adminClient } = createTestEnvironment(testConfig); beforeAll(() => { await server.init({ dataDir: path.join(__dirname, '__data__'), initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 1, }); }); //... }); ``` ```TypeScript import { createTestEnvironment, registerInitializer, SqljsInitializer, testConfig } from '@deenruv/testing'; registerInitializer('sqljs', new SqljsInitializer(path.join(__dirname, '__data__'))); describe('my e2e test suite', () => { const { server, adminClient } = createTestEnvironment(testConfig); beforeAll(() => { await server.init({ initialData, productsCsvPath: path.join(__dirname, 'fixtures/e2e-products-minimal.csv'), customerCount: 1, }); }); //... }); ``` -------------------------------- ### Success case response Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/developer-guide/error-handling.mdx Example response when the applyCouponCode mutation succeeds, returning an Order object. ```json { "data": { "applyCouponCode": { "__typename": "Order", "id": "123", "couponCodes": ["VALID-CODE"], "totalWithTax": 12599 } } } ``` -------------------------------- ### Run codegen script Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/storefront/codegen.mdx Runs the codegen script installed during init. Requires the Deenruv server to be running. Generates a src/gql directory with TypeScript types. ```bash npm run codegen ``` -------------------------------- ### Joining relations in ProductService.findOne Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/developer-guide/the-service-layer.mdx Example of using the optional relations argument in a built-in service method (ProductService.findOne) to join specified relations. ```ts const productWithAssets = await this.productService.findOne(ctx, productId, ['featuredAsset', 'assets']); ``` -------------------------------- ### Create a project with npm init Source: https://github.com/aexol-studio/deenruv/blob/main/packages/create/README.md Scaffolds a new Deenruv project using npm init, available in npm 6+. ```sh npm init @deenruv my-app ``` -------------------------------- ### Configure ReplicateSimpleBGPlugin.init with envs and options Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/replicate-simple-bg-plugin/README.md Configure the plugin in your Deenruv server config. Requires a Replicate deployment name and API token. Optional prompts, room types, and themes can be provided. ```typescript import { ReplicateSimpleBGPlugin } from '@deenruv/replicate-simple-bg-plugin'; // In your Deenruv server config: plugins: [ ReplicateSimpleBGPlugin.init({ envs: { deploymentName: 'your-replicate-deployment', apiToken: process.env.REPLICATE_API_TOKEN, assetPrefix: 'https://your-cdn.com/assets', }, // Optional: custom prompts for image generation prompts: { positive: 'modern interior design', negative: 'blurry, distorted', }, // Optional: predefined room types and themes roomType: [{ value: 'living-room', label: 'Living Room' }], roomTheme: [{ value: 'modern', label: 'Modern', image: '/themes/modern.jpg' }], }), ] ``` -------------------------------- ### Combining DetailList and DetailView in a plugin Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/extending-the-admin-ui/templates.pl.mdx Typical plugin setup combining DetailList for the list page and DetailView for the detail page. Uses createDeenruvUIPlugin from @deenruv/react-ui-devkit and defines pages with paths and elements. ```tsx import { createDeenruvUIPlugin } from '@deenruv/react-ui-devkit'; import { ReviewsListPage } from './pages/ReviewsListPage'; import { ReviewDetailPage } from './pages/ReviewDetailPage'; export const ReviewsPlugin = createDeenruvUIPlugin({ name: 'reviews-plugin-ui', version: '1.0.0', pages: [ { path: '', element: }, // Używa DetailList { path: ':id', element: }, // Używa DetailView ], // ... }); ``` -------------------------------- ### docker-compose.yml for local development Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/deployment/docker.mdx Defines the local development infrastructure services for Deenruv: PostgreSQL, Redis, and MinIO. Use this with the provided pnpm scripts to start the services and run the server locally. ```yaml name: deenruv-local services: deenruv-postgres: image: ghcr.io/cloudnative-pg/postgresql:16.3 environment: POSTGRES_USER: deenruv POSTGRES_PASSWORD: deenruv POSTGRES_DB: deenruv ports: - 5432:5432 deenruv-redis: image: bitnami/redis:7.2 environment: ALLOW_EMPTY_PASSWORD: yes ports: - 6379:6379 deenruv-minio: image: minio/minio:latest ports: - 9000:9000 - 9090:9090 environment: MINIO_ROOT_USER: root MINIO_ROOT_PASSWORD: password command: minio server /data/minio --console-address ":9090" ``` -------------------------------- ### Fetch product query Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/getting-started/try-the-api.mdx Use this query to fetch detailed product information including variants, prices, and stock levels. The example queries product with ID 42. ```graphql query { product(id: 42) { enabled name variants { id name enabled prices { currencyCode price } stockLevels { stockLocationId stockOnHand stockAllocated } } } } ``` -------------------------------- ### Configure WFirmaPlugin with API keys Source: https://github.com/aexol-studio/deenruv/blob/main/plugins/wfirma-plugin/README.md Initialize the WFirmaPlugin in your Deenruv server configuration, providing the wFirma API credentials via environment variables. ```typescript import { WFirmaPlugin } from '@deenruv/wfirma-plugin'; // In your Deenruv server config: plugins: [ WFirmaPlugin.init({ authorization: { accessKey: process.env.WFIRMA_ACCESS_KEY, secretKey: process.env.WFIRMA_SECRET_KEY, appKey: process.env.WFIRMA_APP_KEY, }, }), ] ``` -------------------------------- ### dummyPaymentHandler with configurable args Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/developer-guide/strategies-configurable-operations.mdx Example of a PaymentMethodHandler with configurable arguments, including type, label, description, required, and defaultValue. The `createPayment` method receives type-safe args. Use this as a template for defining custom operation arguments. ```ts import { PaymentMethodHandler, LanguageCode } from '@deenruv/core'; export const dummyPaymentHandler = new PaymentMethodHandler({ code: 'dummy-payment-handler', description: [ /* omitted for brevity */ ], args: { automaticSettle: { type: 'boolean', label: [ { languageCode: LanguageCode.en, value: 'Authorize and settle in 1 step', }, ], description: [ { languageCode: LanguageCode.en, value: 'If enabled, Payments will be created in the "Settled" state.', }, ], required: true, defaultValue: false, }, }, createPayment: async (ctx, order, amount, args, metadata, method) => { // Inside this method, the `args` argument is type-safe and will be // an object with the following shape: // { // automaticSettle: boolean // } // ... implementation omitted }, }); ``` -------------------------------- ### Using useDeenruvForm with DetailView Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/extending-the-admin-ui/hooks.mdx Example of a product detail page using useDeenruvForm with DetailView, including form fields, sidebar, and actions. The form uses a zod schema and submits a mutation to update a product. ```tsx import { DetailView, useDeenruvForm, z, DeenruvForm, FormField, FormItem, FormLabel, FormControl, FormMessage, Input, Button, Switch, PageBlock, RichTextEditor, useTranslation, } from '@deenruv/react-ui-devkit'; const productSchema = z.object({ name: z.string().min(1, 'Required'), slug: z.string(), description: z.string(), enabled: z.boolean(), }); type ProductFormValues = z.infer; function ProductDetailPage() { const { id } = useParams(); const { t } = useTranslation('catalog'); const form = useDeenruvForm({ schema: productSchema, defaultValues: { name: '', slug: '', description: '', enabled: true }, }); const handleSave = async (data: ProductFormValues) => { await apiClient('mutation')({ updateProduct: [ { input: { id, enabled: data.enabled, translations: [{ languageCode: LanguageCode.en, name: data.name, slug: data.slug, description: data.description, }], }, }, { id: true }, ], }); }; return ( ( {t('product.name')} )} /> ( {t('product.slug')} )} /> ( {t('product.description')} )} /> ), }, ]} sidebar={ ( {t('product.enabled')} )} /> } actions={} /> ); } ``` -------------------------------- ### Response for GetTopLevelCollections query Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/storefront/navigation-menu.mdx Example JSON response from the `GetTopLevelCollections` query, showing a flat list of top-level collections with their IDs, slugs, names, and featured asset previews. ```json { "data": { "collections": { "items": [ { "id": "2", "slug": "electronics", "name": "Electronics", "featuredAsset": { "id": "16", "preview": "https://demo.deenruv.com/assets/preview/5b/jakob-owens-274337-unsplash__preview.jpg" } }, { "id": "5", "slug": "home-garden", "name": "Home & Garden", "featuredAsset": { "id": "47", "preview": "https://demo.deenruv.com/assets/preview/3e/paul-weaver-1120584-unsplash__preview.jpg" } }, { "id": "8", "slug": "sports-outdoor", "name": "Sports & Outdoor", "featuredAsset": { "id": "24", "preview": "https://demo.deenruv.com/assets/preview/96/michael-guite-571169-unsplash__preview.jpg" } } ] } } } ``` -------------------------------- ### GraphQL query to fetch a product by slug Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/getting-started/graphql-intro.mdx Fetches the product with the slug "football" and returns its id, name, and slug fields. This is a basic example of a GraphQL query. ```graphql query { product(slug: "football") { id name slug } } ``` -------------------------------- ### Query eligibleShippingMethods with example result Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/storefront/checkout-flow.mdx Query the eligibleShippingMethods to retrieve available shipping methods and their prices. The result can be displayed to the customer for selection; if only one result is returned, it can be automatically selected. ```graphql query GetShippingMethods { eligibleShippingMethods { id price description } } ``` ```json { "data": { "eligibleShippingMethods": [ { "id": "1", "price": 545, "description": "Standard Shipping" }, { "id": "2", "price": 1250, "description": "Expedited Shipping" }, { "id": "3", "price": 1695, "description": "Overnight Shipping" } ] } } ``` -------------------------------- ### Scaffold a new Deenruv project with @deenruv/create Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/getting-started/installation.mdx Run this command to scaffold and configure a new Deenruv project named 'my-shop'. The tool will prompt you to select a database and whether to populate sample data. ```bash npx @deenruv/create my-shop ``` -------------------------------- ### Run jobs on the main process (src/index.ts) Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/developer-guide/worker-job-queue.mdx Starts the JobQueueService on the main server for testing or automated tasks. Not recommended for production because it negates the benefits of offloading long tasks. The process exits with code 1 on error. ```typescript import { bootstrap, JobQueueService } from '@deenruv/core'; import { config } from './deenruv-config'; bootstrap(config) .then(app => app.get(JobQueueService).start()) .catch(err => { console.log(err); process.exit(1); }); ``` -------------------------------- ### Using core services in a plugin Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/developer-guide/the-service-layer.mdx Shows how to set up a plugin to use core services: import PluginCommonModule and inject a service like ProductService into your own service's constructor. ```ts import { PluginCommonModule, VendurePlugin } from '@deenruv/core'; import { MyService } from './services/my.service'; @DeenruvPlugin({ imports: [PluginCommonModule], providers: [MyService], }) export class MyPlugin {} ``` ```ts import { Injectable } from '@nestjs/common'; import { ProductService } from '@deenruv/core'; @Injectable() export class MyService { constructor(private productService: ProductService) {} // you can now use the productService methods } ``` -------------------------------- ### OrderStateBadge usage example Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/extending-the-admin-ui/components.mdx Example of using the OrderStateBadge molecule component with the state prop. ```tsx import { OrderStateBadge } from '@deenruv/react-ui-devkit'; ``` -------------------------------- ### Migrate Deenruv plugins to static .init() method Source: https://github.com/aexol-studio/deenruv/blob/main/CHANGELOG_v1.md Shows the required migration from instantiating plugins with 'new' to using the static .init() method in the DeenruvConfig, as part of the breaking change in version 0.1.2-beta.9. ```javascript // before plugins: [ new AdminUiPlugin({ port: 3002 }) ], ``` ```javascript // after plugins: [ AdminUiPlugin.init({ port: 3002 }) ], ``` -------------------------------- ### JSON Response for Paginated Product Reviews Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/how-to/paginated-list.mdx Example response from the Admin API for the paginated product reviews query. Shows the structure with totalItems and items array, including review details such as id, createdAt, product name, text, and rating. ```json { "data": { "productReviews": { "totalItems": 3, "items": [ { "id": "12", "createdAt": "2023-08-23T12:00:00Z", "product": { "name": "Smartphone X" }, "text": "The best phone I've ever had!", "rating": 5 }, { "id": "42", "createdAt": "2023-08-22T15:30:00Z", "product": { "name": "Laptop Y" }, "text": "Impressive performance and build quality.", "rating": 4 }, { "id": "33", "createdAt": "2023-08-21T09:45:00Z", "product": { "name": "Headphones Z" }, "text": "Decent sound quality but uncomfortable.", "rating": 3 } ] } } } ``` -------------------------------- ### Project structure with plugins directory Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/developer-guide/plugins.mdx Shows the conventional project structure with a plugins directory containing multiple plugins. This is a suggested layout, not a requirement. ```txt ├──src ├── index.ts ├── deenruv-config.ts ├── plugins ├── reviews-plugin ├── cms-plugin ├── wishlist-plugin ├── stock-sync-plugin ``` -------------------------------- ### AssetsModalInput usage example Source: https://github.com/aexol-studio/deenruv/blob/main/packages/react-ui-devkit/docs/universal_components/AssetsModalInput.md Example usage of the AssetsModalInput component. The value prop expects an AssetsModalChangeType object, and setValue is a callback that receives the new value when the selection changes. ```tsx {}} /> ``` -------------------------------- ### Bootstrap the Deenruv server (src/index.ts) Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/deployment/docker.mdx Bootstraps the Deenruv server for handling HTTP requests. Place this in the server entry point. ```ts import { bootstrap } from '@deenruv/core'; import { config } from './deenruv-config'; bootstrap(config); ``` -------------------------------- ### Populate database with DB=sqlite Source: https://github.com/aexol-studio/deenruv/blob/main/apps/server/README.md Populate the database with test data using the populate script. Specify the database type with the DB environment variable as shown. ```bash DB=sqlite npm run populate ``` -------------------------------- ### Zustand selector best practice Source: https://github.com/aexol-studio/deenruv/blob/main/apps/docs/content/docs/guides/extending-the-admin-ui/state-management.mdx Use selector functions to avoid unnecessary re-renders. The good example only re-renders when token changes; the bad example re-renders on every store update. ```ts // ✅ Good — only re-renders when token changes const token = useSettings((s) => s.token); // ❌ Bad — re-renders on every store update const settings = useSettings(); const token = settings.token; ```