# Getting started

> Clone the template, bring up local infrastructure, and run both the API and the frontend.

## Prerequisites

You will need the following installed:

- **.NET 10 SDK**
- **Node.js 22+** and **pnpm**
- **Docker** (for local infrastructure and the integration test suite)

## Clone the template

```sh
git clone https://github.com/slicekit/slicekit.git
cd slicekit
```

## Or scaffold your own project

To start a real product rather than explore the template, use the scaffold script instead. It
clones the template and renames everything across all three apps (API, SPA and the landing site):
project name, namespaces, domains, support email and API-key prefix. It also regenerates dev and
prod secrets, writes the env files and reinitialises git:

```sh
curl -fsSL https://raw.githubusercontent.com/gwku/slicekit/main/scripts/new-slicekit.sh | bash -s -- \
  --name MyApp --domain myapp.com --repo https://github.com/me/myapp.git
```

Run it with `--help` for every flag; anything required but omitted is prompted for interactively.

<!-- demo:begin -->
It also asks whether to keep the public [demo environment](/docs/demo-environment) (default no); pass
`--demo` or `--no-demo` to decide non-interactively.
<!-- demo:end -->

## 1. Start local infrastructure

A single Compose file brings up Postgres, Redis, RabbitMQ, MinIO, Mailpit and the full observability
stack:

```sh
docker compose up -d
```

This is everything the API depends on at runtime. The services and their ports are listed in
[project structure](/docs/project-structure#port-map).

## 2. Run the API

```sh
dotnet run --project api/src/Slicekit.Api
```

The API starts on `http://localhost:5076` (and `https://localhost:5077`). Its interactive OpenAPI reference is served at
`/scalar`, and applying database migrations happens automatically on start in development.

## 3. Run the frontend

```sh
cd frontend
pnpm install
pnpm dev
```

The SPA starts on `http://localhost:3003`, which matches the `Cors:AllowedOrigins` the API allows by
default.

## Verify it works

Open `http://localhost:3003` and register an account; you should land on the dashboard. To make
that account an admin, add its email to the `Admin:AdminEmails` array in
`api/src/Slicekit.Api/appsettings.json`:

```json
"Admin": {
  "AdminEmails": ["you@example.com"]
}
```

Set this before you first start the API and the account is an admin the moment you register. If the
API is already running, restart it to pick up the change.

Open Grafana at `http://localhost:3010` and you will see traces and metrics already flowing for the
requests you just made.

## The fast test loop

Most of the time you want the quick unit + architecture suite, which runs in a few seconds and needs
no Docker:

```sh
dotnet test api/tests/Slicekit.Unit.Tests api/tests/Slicekit.Architecture.Tests --nologo
```

The full suite, including integration tests backed by Testcontainers, runs with:

```sh
dotnet test api/slicekit.slnx --nologo
```

## Next steps

- Learn the [repository layout](/docs/project-structure).
- Read the [architecture overview](/docs/architecture).
- Add your first feature by following the [vertical slice recipe](/docs/vertical-slices).
