Commercio Docs

Installation

Get started with Commercio in your Node.js project.

Install Package

Install Commercio using npm or your preferred package manager

npm install commercio

Requirements

Node.js 18+

or Bun

PostgreSQL 14+

Database

TypeScript 5+

Recommended

Database Setup

Create Database

Create a PostgreSQL database for your project

CREATE DATABASE my_erp_db;

Configuration

Option A: Environment Variable (Recommended)

Create a .env file in your project root

DATABASE_URL=postgresql://user:password@localhost:5432/my_erp_db

The package automatically reads the DATABASE_URL environment variable.

Run Migrations

Automatic Migration (Recommended)

Migrations run automatically when initializing the database

import { initDatabase } from "commercio";

initDatabase({
  connectionString: process.env.DATABASE_URL,
  runMigrations: true, // Automatically run migrations
});