# serve

Starts a Frontity server in production mode.

```
npx frontity serve [options]
```

This `frontity serve` command will use the files generated by [`frontity build`](/frontity-cli/build-commands/build.md)

## Arguments

### **`[options]`**

|      Option     | Description                                                                                                                                                       |
| :-------------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--port <port>` | Runs the server on a custom port. Default is 3000. Related environment variable: [`FRONTITY_SERVE_PORT`](/frontity-cli/run-commands/serve.md#frontity_serve_port) |
|    `--https`    | Runs the server using https. Related environment variable: [`FRONTITY_SERVE_HTTPS`](/frontity-cli/run-commands/serve.md#frontity_serve_https)                     |
|     `--help`    | Output usage information                                                                                                                                          |

**Examples**

* Starts a server (using the code in the `build` folder generated by the `npx frontity build` command) using https and port 3002

```
npx frontity serve --https --port 3002
```

## Environment Variables

### `FRONTITY_SERVE_PORT`

Runs the server on a custom port. Default is `3000`.

If detected, and no `--port <port>` option is defined for [`serve`](/frontity-cli/run-commands/serve.md#serve) Frontity command, this environment variable value will be applied.

*Example:*

```
FRONTITY_SERVE_PORT=3002
```

### `FRONTITY_SERVE_HTTPS`

Runs the server using https.

*Example:*

```
FRONTITY_SERVE_HTTPS=true
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.frontity.org/frontity-cli/run-commands/serve.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
