> ## 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:nosql

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

# forest projects:create:nosql

Create a new project on a MongoDB 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:nosql <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 `mongodb://user:password@host:27017/db`. Replaces the individual connection options |
| `-h, --databaseHost` | Database hostname |
| `-p, --databasePort` | Database port |
| `-n, --databaseName` | Database name |
| `-u, --databaseUser` | Database user |
| `--databasePassword` | Database password |
| `--mongoDBSRV` | Use an SRV DNS record to connect |
| `--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 `--databaseHost`, `--databasePort`, `--databaseName`, `--databaseUser`, `--databasePassword` or `--mongoDBSRV`.

## 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 connection settings 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 `mongodb://` and `mongodb+srv://`, in lowercase.

## 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 `DATABASE_URL`.

> [!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:nosql my-back-office

# Create a project from a connection URL, without prompts
forest projects:create:nosql my-back-office \
  --databaseConnectionURL "mongodb+srv://user:password@cluster0.example.mongodb.net/shop" \
  --language typescript --applicationHost http://localhost --applicationPort 3310
```


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