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

# Quickstart

> Get GoBetter up and running on your local machine in minutes

Follow this guide to set up the GoBetter backend and frontend applications locally.

## Prerequisites

Ensure you have the following installed on your system:

* [Node.js](https://nodejs.org/) 22 LTS
* [pnpm](https://pnpm.io/) 10.33.0 or Corepack
* [Docker](https://www.docker.com/) (recommended for PostgreSQL and Redis)
* An AI provider API key (e.g. OpenAI, OpenRouter) or access to platform models

***

## 1. Clone the Repository

```bash theme={null}
git clone https://github.com/dev-hari-prasad/go-better.git
cd go-better
```

***

## 2. Start Infrastructure (PostgreSQL & Redis)

GoBetter uses PostgreSQL for primary data storage and Redis for BullMQ task queues and user sessions.

<CodeGroup>
  ```bash Docker theme={null}
  # Start PostgreSQL (Port 5432) and Redis (Port 6379)
  docker run -d --name gobetter-postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=gobetter_db -p 5432:5432 postgres:16
  docker run -d --name gobetter-redis -p 6379:6379 redis:7-alpine
  ```

  ```bash Local Service theme={null}
  # If running natively
  brew services start postgresql@16
  brew services start redis
  ```
</CodeGroup>

***

## 3. Configure Environment Variables

### Backend Configuration

Install the backend dependencies and generate the local environment file from the checked-in template:

```bash theme={null}
cd backend
pnpm install
pnpm run copy-env
```

This creates `backend/src/.env` from `backend/src/.env.example`. Fill in the database, Redis, AI provider, GitHub, encryption, authentication, and email values before starting the server. The backend loads this file from `src/config/env.ts`.

### Client Configuration

Create the client environment file from the checked-in template:

```bash theme={null}
cp client/.env.example client/.env
```

```bash client/.env theme={null}
VITE_API_BASE_URL=http://localhost:5000
VITE_ENABLE_PUBLIC_REPOS=true
VITE_USER_ID=00000000-0000-0000-0000-000000000001
```

***

## 4. Install Dependencies & Run Migrations

Install dependencies in both directories and apply the database schema using Drizzle:

```bash theme={null}
# Backend setup
cd backend
pnpm run db:gen
pnpm run db:migrate

# Client setup
cd ../client
pnpm install
```

***

## 5. Launch the Development Servers

Start both services in development mode:

<CodeGroup>
  ```bash Terminal 1 (Backend) theme={null}
  cd backend
  pnpm run dev
  # Server running at http://localhost:5000
  ```

  ```bash Terminal 2 (Client) theme={null}
  cd client
  pnpm run dev
  # Web app running at http://localhost:3000
  ```
</CodeGroup>

Open [http://localhost:3000](http://localhost:3000) in your browser to start reviewing pull requests with GoBetter.

## Production Builds

The backend build type-checks the source and creates a tree-shaken esbuild bundle at `backend/dist/server.js`. The frontend uses Vite production bundling with tree shaking and writes static assets to `client/dist`.

```bash theme={null}
cd backend
pnpm run build
pnpm start

cd ../client
pnpm run build
```

## Docker Compose

The current Compose file starts the backend service on port `5000`. The frontend service is present but commented out, because the frontend can be deployed separately as an Nginx static image.

```bash theme={null}
docker compose config
docker compose up --build
```

To build the frontend image directly:

```bash theme={null}
docker compose build frontend
```

The backend image uses Node 22 and the frontend image uses a Node 22 build stage with Nginx as the runtime server.
