> ## Documentation Index
> Fetch the complete documentation index at: https://docs.forest.app/llms.txt
> Use this file to discover all available pages before exploring further.

# forest projects:create:sql

> Create a Forest project and generate a Node.js back-end on a SQL database

# forest projects:create:sql

Create a new project on a PostgreSQL, MySQL, MariaDB or SQL Server database. The CLI registers the project on Forest, tests the database connection, and generates a Node.js back-end in a new directory named after the project.

## Usage

```bash theme={null}
forest projects:create:sql <APPLICATION_NAME> [options]
```

## Arguments

| Argument | Description |
| - | - |
| `APPLICATION_NAME` | Name of the project to create (required). Also the name of the generated directory |

## Options

| Option | Description |
| - | - |
| `-c, --databaseConnectionURL` | Database connection URL, such as `postgres://user:password@host:5432/db`. Replaces the individual connection options |
| `-d, --databaseDialect` | Database type: `postgres`, `mysql / mariadb` or `mssql` |
| `-h, --databaseHost` | Database hostname |
| `-p, --databasePort` | Database port |
| `-n, --databaseName` | Database name |
| `-u, --databaseUser` | Database user |
| `--databasePassword` | Database password |
| `-s, --databaseSchema` | Database schema. Defaults to `public` on PostgreSQL |
| `--databaseSslMode` | SSL mode: `preferred`, `verify`, `required` or `disabled` |
| `--databaseSSL` | Use SSL for the database connection. Use either this option or `--databaseSslMode` |
| `-l, --language` | Language of the generated back-end: `javascript` or `typescript` |
| `-H, --applicationHost` | Hostname the back-end runs on. Default `http://localhost` |
| `-P, --applicationPort` | Port the back-end runs on. Default `3310` |

`--databaseConnectionURL` cannot be combined with `--databaseDialect`, `--databaseHost`, `--databasePort`, `--databaseName`, `--databaseUser` or `--databasePassword`.

## Interactive prompts

The CLI prompts for every option you leave out. It first asks for a connection URL: paste one, or leave the answer blank to enter the host, port, name, user and password one by one. The URL is masked while you type it. The URL prompt is skipped when you pass any individual connection option.

Accepted URL schemes are `postgres://`, `postgresql://`, `mysql://` and `mssql://`. For MariaDB, use `mysql://`.

## What it generates

* A Node.js back-end connected to your database, with an embedded workflow executor that runs Forest workflows in the back-end process. It keeps workflow runs in memory, so they are lost when the back-end restarts.
* A `.env` file with `FOREST_ENV_SECRET`, `FOREST_AUTH_SECRET`, `APPLICATION_PORT` and the database settings (`DATABASE_URL`, `DATABASE_SSL_MODE`, `DATABASE_SCHEMA`).

> [!WARNING]
>
> The `.env` file holds your database credentials and the project's secrets. Keep it out of version control.

Then start the back-end:

```bash theme={null}
cd my-back-office
npm install
npm run build   # TypeScript projects only
npm start
```

On its first start, the back-end sends its schema to Forest and your development environment becomes active.

## Examples

```bash theme={null}
# Answer the prompts
forest projects:create:sql my-back-office

# Create a project from a connection URL, without prompts
forest projects:create:sql my-back-office \
  --databaseConnectionURL "postgres://user:password@localhost:5432/shop" \
  --databaseSchema public --language typescript \
  --applicationHost http://localhost --applicationPort 3310

# Create a project from individual settings
forest projects:create:sql my-back-office -d postgres -h localhost -p 5432 -n shop -u forest --databasePassword secret -l javascript
```

[`forest start --flow standalone`](https://docs.forest.app/reference/cli/start) runs this command, installs the dependencies and starts the back-end for you.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.