# Project Setup

> Run the setup generator and understand exactly what it changes in your checkout.

*Canonical: https://makerkit.dev/docs/tanstack-prisma/installation/project-setup*

---

Run `pnpm turbo gen setup` from an existing checkout to initialize Makerkit-specific metadata and Git defaults.

This guide is part of the [TanStack Start Prisma SaaS Kit installation](./overview).

{% sequence title="Project Setup" description="Run the setup generator and review the resulting Git configuration." %}
[What the setup generator does](#what-the-setup-generator-does)

[Run the generator](#run-the-generator)

[Review your remotes](#review-your-remotes)

[Optional manual setup](#optional-manual-setup)
{% /sequence %}

## What the setup generator does

The `setup` generator does **not** clone the repository for you. It assumes you already cloned the project and then:

- checks local requirements
- asks for your GitHub username
- asks for a project name
- writes a `makerkit` block into the root `package.json`
- can create a `.git/hooks/pre-commit` hook
- rewrites the current `origin` remote to `upstream` if the current remote is a GitHub URL
- runs the Makerkit license script

Because it mutates Git configuration, run it once and inspect the result before continuing.

## Run the generator

```bash
pnpm turbo gen setup
```

If you enable the optional health-check hook during setup, the generated pre-commit hook runs:

```bash
pnpm run lint:fix
pnpm run typecheck
pnpm run --filter scripts license
```

If you skip it, the hook only runs the license step.

## Review your remotes

After setup, verify the final remote state:

```bash
git remote -v
```

Important:

- the generator may rename your current `origin` URL to `upstream`
- it does **not** create a replacement `origin`
- if you work from a fork, add `origin` yourself after setup

Example:

```bash
git remote add origin git@github.com:<your-user>/<your-repo>.git
```

If you plan to pull Makerkit updates, keep `upstream` pointed at the Makerkit source you cloned from and verify it before using `git pull upstream main`.

## Optional manual setup

If you prefer not to run the generator, you can do the equivalent pieces manually:

1. Set your Git identity.
2. Add the `makerkit` metadata block to `package.json` if you need it.
3. Create any Git remotes you want (`origin`, `upstream`, or both).
4. Add your own pre-commit hook if desired.

Set your Git identity with:

```bash
git config user.name "<your-name>"
git config user.email "<your-email>"
```

## Common Pitfalls

- Running `pnpm turbo gen setup` before cloning the repo. It only works inside an existing checkout.
- Assuming the generator preserves `origin`. Check `git remote -v` after it runs.
- Assuming the pre-commit hook runs tests. It does not run `pnpm test:unit`.
- Forgetting to re-add `origin` if your workflow depends on pushing to a fork.

---

**Next:** [Environment Variables →](./environment-variables)
