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

# Quick Start

> Creating your first project - pnpm create sonamu

This guide walks you through the steps to run the development environment after installing a Sonamu project.

## Prerequisites

You must have completed the [Installation](/en/getting-started/installation) guide and have a project created.

## Running the Development Environment

The Sonamu development environment consists of three servers:

* **PostgreSQL** - Database
* **API Server** - Backend REST API (includes Sonamu UI)
* **Web Server** - Frontend application

<Steps>
  <Step title="Start Database">
    Navigate to your project's `api` directory and start the PostgreSQL container:

    ```bash theme={null}
    cd myapp/packages/api
    pnpm docker:up
    ```

    <Frame caption="Success message and container startup logs after running docker:up">
      <video autoPlay muted loop playsInline controls className="w-full rounded-xl" src="https://mintcdn.com/cartanova-7788888c/mRzLpig-R41-Dqkz/images/quickstart1.mp4?fit=max&auto=format&n=mRzLpig-R41-Dqkz&q=85&s=8efa41dc7b5be7477a56478dc0c73ebf" data-path="images/quickstart1.mp4" />
    </Frame>

    This command uses Docker Compose to run the PostgreSQL database in the background.

    <Tip>
      To verify the database is running correctly, you can check the container status with the `docker
              ps` command.
    </Tip>

    <Frame caption="docker ps execution result (PostgreSQL container in Up state)">
      <img src="https://mintcdn.com/cartanova-7788888c/mRzLpig-R41-Dqkz/images/quickstart2.png?fit=max&auto=format&n=mRzLpig-R41-Dqkz&q=85&s=1437eab42da7e6fa961f090cd6aae929" alt="docker ps result" width="3386" height="272" data-path="images/quickstart2.png" />
    </Frame>
  </Step>

  <Step title="Run API Server">
    In the same `api` directory, start the development server:

    ```bash theme={null}
    pnpm dev
    ```

    <Frame caption="Server startup logs after running pnpm dev">
      <video autoPlay muted loop playsInline controls className="w-full rounded-xl" src="https://mintcdn.com/cartanova-7788888c/mRzLpig-R41-Dqkz/images/quickstart3.mp4?fit=max&auto=format&n=mRzLpig-R41-Dqkz&q=85&s=f52f4ec8a6deafb4c9bfe6a773911cee" data-path="images/quickstart3.mp4" />
    </Frame>

    When the server starts successfully, you'll see the following message:

    ```
    🌲 Sonamu v1.x.x

    ✓ Config loaded (...)
    ✓ DB
      ▸ development_master @ localhost:5432/myapp
    ✓ Sonamu ready (...)
    ```

    This single command runs everything:

    * **Web App**: [http://localhost:34900](http://localhost:34900)
    * **API Endpoints**: [http://localhost:34900/api](http://localhost:34900/api)
    * **Sonamu UI**: [http://localhost:34900/sonamu-ui](http://localhost:34900/sonamu-ui)

    The API server supports Hot Module Replacement (HMR), so it automatically restarts when code changes.

    <Note>
      In the local development environment, the API server integrates and serves the Web app. It
      connects the Web directory's Vite Dev Server as middleware to the API server, allowing everything
      to run on a single port.
    </Note>

    <Warning>Keep this terminal window open. It maintains the running API server.</Warning>
  </Step>

  <Step title="Run Web Server (Optional)">
    If you want to focus on Web development or utilize Vite's full features, open a **new terminal window** and start the development server separately in the `web` directory:

    ```bash theme={null}
    cd myapp/packages/web
    pnpm dev
    ```

    <Frame caption="Vite startup logs after running pnpm dev in web directory">
      <video autoPlay muted loop playsInline controls className="w-full rounded-xl" src="https://mintcdn.com/cartanova-7788888c/wk-O_9zBoKGthXNV/images/quickstart4.mp4?fit=max&auto=format&n=wk-O_9zBoKGthXNV&q=85&s=c2dd8542919b52644b0be5a2ef415b20" data-path="images/quickstart4.mp4" />
    </Frame>

    When the Vite development server starts, you'll see the following message:

    ```
      VITE v5.x.x  ready in xxx ms

      ➜  Local:   http://localhost:5173/
      ➜  Network: http://192.168.x.x:5173/
    ```

    If you run the Web server separately, you can access the frontend at [http://localhost:5173](http://localhost:5173). The Web server automatically proxies `/api/*` path requests to the API server (localhost:34900).

    <Info>
      **Two Development Modes**

      * **Integrated mode** (recommended): Run only API server → Access everything at `localhost:34900`
      * **Separated mode**: Run API + Web separately → API at `localhost:34900`, Web at `localhost:5173`

      The integrated mode is sufficient for most cases. Use separated mode only when focusing on Web development.
    </Info>
  </Step>
</Steps>

## Verify Access

### Integrated Mode (API server only)

You can access the following URLs in your browser:

| Service    | URL                                                                  | Description                 |
| ---------- | -------------------------------------------------------------------- | --------------------------- |
| Web App    | [http://localhost:34900](http://localhost:34900)                     | Frontend application        |
| API Server | [http://localhost:34900/api](http://localhost:34900/api)             | REST API endpoints          |
| Sonamu UI  | [http://localhost:34900/sonamu-ui](http://localhost:34900/sonamu-ui) | Entity management interface |

### Separated Mode (Both API + Web servers running)

| Service    | URL                                                                  | Description                 |
| ---------- | -------------------------------------------------------------------- | --------------------------- |
| Web App    | [http://localhost:5173](http://localhost:5173)                       | Frontend application        |
| API Server | [http://localhost:34900/api](http://localhost:34900/api)             | REST API endpoints          |
| Sonamu UI  | [http://localhost:34900/sonamu-ui](http://localhost:34900/sonamu-ui) | Entity management interface |

<Check>Access the Web app to verify the Sonamu application is running correctly.</Check>

### Sonamu UI Features

When you access [http://localhost:34900/sonamu-ui](http://localhost:34900/sonamu-ui) in your browser, you can perform the following tasks:

* Create and edit entities
* Manage database migrations
* View API endpoints
* Visualize database schema

<Frame caption="Sonamu UI Main Screen">
  <img src="https://mintcdn.com/cartanova-7788888c/wk-O_9zBoKGthXNV/images/sonamuUI1.png?fit=max&auto=format&n=wk-O_9zBoKGthXNV&q=85&s=637d6e1a97b920da63a7409013c92159" alt="Sonamu UI" width="3456" height="1916" data-path="images/sonamuUI1.png" />
</Frame>

## Stopping Servers

To stop the servers when you're done developing:

1. **API Server** (and Web server if running): Press `Ctrl + C` in each terminal to stop.

2. **Database**: Run the following command in the `api` directory:

```bash theme={null}
pnpm docker:down
```

<Warning>
  The `docker:down` command only stops the container; data is preserved. To completely reset the
  database, refer to the [Database Management](/en/database/management) documentation.
</Warning>

## Next Steps

Your development environment is ready! Now learn Sonamu's core features through the following guides:

<CardGroup cols={2}>
  <Card title="Creating Your First Entity" icon="database" href="/en/getting-started/first-entity">
    Use Sonamu UI to create your first entity and define the database schema.
  </Card>

  <Card title="API Development" icon="code" href="/en/api-development/creating-apis">
    Create REST APIs based on entities and implement business logic.
  </Card>

  <Card title="Frontend Integration" icon="browser" href="/en/frontend-integration/generated-services/how-services-work">
    Use the auto-generated service layer to call APIs from the frontend.
  </Card>

  <Card title="Project Structure" icon="folder" href="/en/getting-started/project-structure">
    Understand the directory structure and key files of a Sonamu project.
  </Card>
</CardGroup>
