# Build & Start command

### Overview

The **build command** and **run command** are essential for preparing and starting your application. These commands are executed inside the working directory and must be correctly defined to ensure the application runs smoothly.

* The **build command** installs dependencies and compiles or prepares the application for execution.
* The **run command** starts the application, making it available for requests.

###

### Example usage

#### Node.js application

**Repository structure**

```
/my-repo
│── package.json
│── server.js
│── .gitignore  # Ensure node_modules/ is ignored
```

**Build command**

```bash
npm install
```

**Run command**

```bash
node server.js
```

***

#### Fastapi application

**Repository structure**

```
/my-repo
│── requirements.txt
│── main.py
│── app/
```

**Build command**

```bash
pip install -r requirements.txt
```

**Run command**

```bash
uvicorn main:app --host 0.0.0.0 --port 8000
```

***

#### Django application

**Repository structure**

```
/my-repo
│── requirements.txt
│── manage.py
│── myproject/
```

**Build command**

```bash
pip install -r requirements.txt
```

**Run command**

```bash
python manage.py runserver 0.0.0.0:8000
```

***

#### Go application

**Repository structure**

```
/my-repo
│── main.go
│── go.mod
│── go.sum
```

**Build command**

```bash
go build -o app .
```

**Run command**

```bash
./app
```

###

### Advanced usage

Sometimes, additional commands need to be executed before starting the application. For example, running database migrations before launching the server. You can join multiple commands using `&&`, or simply place them on a new line, which automatically joins them with `&&`.

#### Running database migrations before starting the application

**Django example**

```bash
python manage.py migrate && python manage.py runserver 0.0.0.0:8000
```

Or written on multiple lines:

```bash
python manage.py migrate
python manage.py runserver 0.0.0.0:8000
```

**Fastapi example (using alembic migrations)**

```bash
alembic upgrade head && uvicorn main:app --host 0.0.0.0 --port 8000
```

Or written on multiple lines:

```bash
alembic upgrade head
uvicorn main:app --host 0.0.0.0 --port 8000
```

###

### Conclusion

Setting the correct **build command** and **run command** ensures your application installs dependencies and starts correctly. Always verify these commands based on your application’s framework and dependencies.


---

# 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://seenode.gitbook.io/docs/deploying/build-and-start-command.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.
