DeenruvDeenruv
Deployment

Deployment Overview

Learn how to deploy Deenruv to production, including server requirements, configuration, and deployment strategies

This guide covers the key considerations and steps for deploying a Deenruv e-commerce application to a production environment.

Prerequisites

Before deploying, ensure you have:

  • Node.js v18+ installed on your server
  • A supported database — PostgreSQL is recommended for production (MySQL and MariaDB are also supported)
  • Redis — required if using the BullMQ job queue plugin (recommended for production)
  • An object storage service for assets (e.g., S3, MinIO, or a compatible provider) — or sufficient disk storage for the local asset strategy
  • A reverse proxy such as Nginx or Caddy for TLS termination and load balancing

Production configuration

When moving from development to production, several configuration changes are essential:

Database

Switch from SQLite (if used in development) to PostgreSQL for production:

src/deenruv-config.ts
import { DeenruvConfig } from '@deenruv/core';

export const config: DeenruvConfig = {
    dbConnectionOptions: {
        type: 'postgres',
        // Use environment variables for sensitive values
        host: process.env.DB_HOST,
        port: +(process.env.DB_PORT || 5432),
        username: process.env.DB_USERNAME,
        password: process.env.DB_PASSWORD,
        database: process.env.DB_NAME,
        // IMPORTANT: disable synchronize in production
        synchronize: false,
        migrations: [path.join(__dirname, 'migrations/*.js')],
    },
};

Never set synchronize: true in production. This option auto-modifies your database schema and can cause data loss. Always use migrations instead.

Authentication

Update the default superadmin credentials and authentication settings:

src/deenruv-config.ts
export const config: DeenruvConfig = {
    authOptions: {
        tokenMethod: ['bearer', 'cookie'],
        requireVerification: true,
        superadminCredentials: {
            identifier: process.env.SUPERADMIN_IDENTIFIER || 'superadmin',
            password: process.env.SUPERADMIN_PASSWORD,
        },
        cookieOptions: {
            secret: process.env.COOKIE_SECRET,
        },
    },
};

API options

Disable debug tools in production:

src/deenruv-config.ts
export const config: DeenruvConfig = {
    apiOptions: {
        port: +(process.env.PORT || 3000),
        adminApiPlayground: false,
        adminApiDebug: false,
        shopApiPlayground: false,
        shopApiDebug: false,
    },
};

Asset storage

Configure an external asset storage strategy (e.g., S3) instead of local file storage:

src/deenruv-config.ts
import { AssetServerPlugin, configureS3AssetStorage } from '@deenruv/asset-server-plugin';

export const config: DeenruvConfig = {
    plugins: [
        AssetServerPlugin.init({
            route: 'assets',
            assetUploadDir: '/tmp/deenruv-assets',
            assetUrlPrefix: process.env.ASSET_URL_PREFIX,
            storageStrategyFactory: configureS3AssetStorage({
                bucket: process.env.S3_BUCKET,
                credentials: {
                    accessKeyId: process.env.S3_ACCESS_KEY_ID,
                    secretAccessKey: process.env.S3_SECRET_ACCESS_KEY,
                },
                nativeS3Configuration: {
                    region: process.env.S3_REGION,
                },
            }),
        }),
    ],
};

Job queue

Use the BullMQ job queue plugin with Redis for production workloads:

src/deenruv-config.ts
import { BullMQJobQueuePlugin } from '@deenruv/job-queue-plugin/package/bullmq';

export const config: DeenruvConfig = {
    plugins: [
        BullMQJobQueuePlugin.init({
            connection: {
                host: process.env.REDIS_HOST,
                port: +(process.env.REDIS_PORT || 6379),
                password: process.env.REDIS_PASSWORD,
            },
        }),
    ],
};

Server resource requirements

The minimum recommended server resources for a production Deenruv deployment:

ComponentMinimumRecommended
CPU1 vCPU2+ vCPU
Memory1 GB RAM2+ GB RAM
Storage10 GBDepends on catalog size and asset storage
DatabasePostgreSQL 14+PostgreSQL 16+ with dedicated resources

These requirements assume a single-server deployment with moderate traffic. For high-traffic stores, consider horizontal scaling with a load balancer and separate database server.

Environment variables

Use environment variables for all sensitive and environment-specific configuration:

VariableDescription
DB_HOSTDatabase server hostname
DB_PORTDatabase server port
DB_USERNAMEDatabase username
DB_PASSWORDDatabase password
DB_NAMEDatabase name
REDIS_HOSTRedis server hostname
REDIS_PORTRedis server port
REDIS_PASSWORDRedis password
COOKIE_SECRETSecret for signing session cookies
SUPERADMIN_IDENTIFIERSuperadmin login identifier
SUPERADMIN_PASSWORDSuperadmin login password
S3_BUCKETS3 bucket name for asset storage
S3_ACCESS_KEY_IDS3 access key
S3_SECRET_ACCESS_KEYS3 secret key
S3_REGIONS3 region
ASSET_URL_PREFIXPublic URL prefix for assets

Deploying the Admin UI

The Deenruv Admin UI can be deployed in several ways:

Bundled with the server

By default, the AdminUiPlugin serves the admin UI from the same server:

AdminUiPlugin.init({
    route: 'admin',
    port: 3002,
}),

For production, you should pre-compile the Admin UI during your build step to avoid compiling it on the production server:

# During your build process
pnpm build

As a standalone static app

Alternatively, you can build the admin UI as a standalone static app and host it separately (e.g., on a CDN):

AdminUiPlugin.init({
    route: 'admin',
    port: 3002,
    app: compileUiExtensions({
        outputPath: path.join(__dirname, '../admin-ui'),
        devMode: false,
    }),
}),

Then deploy the contents of the admin-ui directory to your static hosting provider.

Next steps

On this page