# Install OpenPlatform with Node.js and PostgreSQL, Docker or Docker Compose

> Start OpenPlatform by hand, with the Docker Hub image or with Docker Compose, what happens on the first start and what to configure right after signing in.

Framework: openplatform
Product: OpenPlatform (openplatform@5)
Language: en
Content-SHA256: 73796b2e998f1ca4314bd68628ca8277d707cae92f47c58d14f96500b08b1b82
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: 
Review: not-recorded

OpenPlatform needs the latest **Node.js** and a **PostgreSQL** database. There are three ways to start it, all from the README of the repository. Do **not** run `database.sql` yourself: OpenPlatform uses that script internally on the first start.

## By hand

1. Install Node.js and PostgreSQL and create an empty database for OpenPlatform.
2. Download the [source code](https://github.com/totaljs/openplatform).
3. Install the dependencies in the root of the application:

```bash
npm install
```

4. Put the connection string in the file `config` (the file has the line `database : postgresql://user:pass@localhost:5432/database` as a model, and a line `database (env) : DATABASE` that reads it from the environment variable `DATABASE`).
5. Start it (the `start` script of `package.json` runs `node index.js 8000`):

```bash
node index.js
```

6. Open `http://127.0.0.1:8000` and, **before anything else, open the settings and configure the platform** (the README marks this step as important; the settings are in [settings and database](/en/openplatform/settings-and-database/)).

## Docker Hub

```bash
docker pull totalplatform/openplatform
docker run --env DATABASE='postgresql://user:pass@hostname/database' -p 8000:8000 totalplatform/openplatform
```

## Docker Compose

```bash
git clone https://github.com/totaljs/openplatform.git
cd openplatform
docker compose up
```

## What the first start does

When the database has no OpenPlatform tables yet (it looks for the table `cl_config` in the schema `op`), the application loads `database.sql`, replacing its placeholders with values it generates: the identifier of the installation, the cookie name, the secrets and salts, the tokens, and the first user and group. It then loads the configuration and starts the authentication (`definitions/init.js`). With the environment variable `DATABASE` (Docker) it waits three seconds before this, so that the database can be up. In both cases the server is paused (`PAUSESERVER('Database')`) until the database is ready.

## The first sign-in

The README gives the default account:

```text
login : info@totaljs.com
password : admin
```

Sign in, **change that password** (the portal has the account action for it) and configure the settings. Remember the rule of the README: every application that you add must be assigned to a group, or nobody sees it ([groups and permissions](/en/openplatform/groups-and-permissions/)).
