Search documentation

Search documentation

Getting Started

Installation

Install the Contoprix packages your application needs.

Install only what your application needs#

Contoprix packages are deliberately split by job. Start with the framework-independent client, then add a framework package only when it helps your application.

PackageUse it whenWhat it provides
@contoprix/clientEvery JavaScript or TypeScript integrationAuthenticated delivery, content, page, media, navigation, search, preview, and form API modules
@contoprix/typesYou want to import shared SDK types directlyTypes such as ContoprixContentEntry and ContoprixPage
@contoprix/reactYou render Contoprix page blocks in ReactPageRenderer, BlockRenderer, component-registry types, and visual-editing primitives
@contoprix/nextYou use Next.jsServer helpers, preview helpers, webhook handling, and revalidation helpers
@contoprix/cliYou want schema pull/push, generated types, or component scaffoldingLocal developer tooling; install as a development dependency

@contoprix/react and @contoprix/next bring the core client and shared types through their dependencies. Installing @contoprix/client directly is still useful when your own code constructs and uses the client.

Before you install#

You need:

  • a JavaScript or TypeScript application;
  • the base URL of a running Contoprix CMS API;
  • a delivery key for the website you want to render;
  • Node.js 22 or newer if you will use the Contoprix CLI.

For the current React/Next integration packages, use a compatible React 19 and Next.js 16 application. If your project uses another framework, the core client works without React or Next.js.

Important

Install SDK packages in the frontend project that will make requests. Do not put delivery keys, client secrets, or CLI credentials in source files or browser-exposed environment variables.

Option A: data delivery only#

Use this for a Node.js service, a custom frontend, or a React app where you will render the data yourself.

Terminal
npm install @contoprix/client

If you want to import shared types in application code, add them explicitly:

Terminal
npm install @contoprix/types

Option B: React page and block rendering#

Add React support when your frontend receives Contoprix page blocks and you want the SDK renderer to resolve a component registry.

Terminal
npm install @contoprix/client @contoprix/react @contoprix/types

You still write the visual components. The SDK supplies the renderer and the contract that passes a block's settings, content, or contents into your registered component.

Option C: Next.js#

For a Next.js application, install the core, React, and Next.js packages together:

Terminal
npm install @contoprix/client @contoprix/react @contoprix/next @contoprix/types

@contoprix/next/server is designed for server-side code. It reads the server environment variables described in Configure the SDK, then creates a client for delivery or preview requests.

Optional: install the CLI#

The CLI is not required to fetch published content. Add it when your team wants the content model in source control, TypeScript interfaces generated from the model, or component stubs for new component types.

Terminal
npm install --save-dev @contoprix/cli
npx contoprix --help

The safe first workflow is:

Terminal
npx contoprix init
npx contoprix login
npx contoprix pull
npx contoprix generate
npx contoprix validate

login uses SDK client credentials with schema permissions; a delivery key is for reading published content and is not a replacement for CLI credentials. Run npx contoprix components only when you want to scaffold component files after reviewing the pulled schema.

Verify the package installation#

Create a server-side module. Do not use real credentials in this source file; configuration belongs in environment variables.

src/lib/contoprix/client.ts
import { ContoprixClient } from "@contoprix/client";

export const client = new ContoprixClient({
  baseUrl: process.env.CONTOPRIX_BASE_URL!,
  auth: {
    type: "deliveryKey",
    deliveryKey: process.env.CONTOPRIX_DELIVERY_KEY!,
  },
  languageCode: "en",
});

If TypeScript recognizes the import, installation is complete. The request will work after you set valid environment values and publish content for the same website as the delivery key.

Common installation mistakes#

SymptomCheck first
Package cannot be foundRun the install command from the frontend project's directory.
Request URL includes /api/api/...Set CONTOPRIX_BASE_URL to the API origin; do not append /api.
401 or 403 from a delivery callVerify the delivery key belongs to the intended website and has delivery-read access.
Secret appears in browser JavaScriptRemove NEXT_PUBLIC_ from secret and delivery-key variables; fetch from server-side code instead.
CLI cannot pull the schemaRun npx contoprix login with a client that has schema:read; a delivery key alone is insufficient.

Next step#

Continue with Create your first project. It creates a small Article model, a published entry, and a real SDK request you can verify end to end.