npm package: @fsco/kcsetup
Description: CLI tool for setting up and configuring Keycloak instances with organizations, roles, users, and themes
Author: FSCO
Latest version: 0.0.1

<p align="center">
  <img src="https://dev.fsco.io/assets/logo-documentation.svg" alt="@fsco/kcsetup" width="140"/>
</p>

<h1 align="center">@fsco/kcsetup</h1>

<p align="center">
  🔐 CLI tool for setting up and configuring Keycloak instances with organizations, roles, users, and themes.
</p>

<p align="center">
  <a href="https://www.npmjs.com/package/@fsco/kcsetup"><img src="https://img.shields.io/npm/v/@fsco/kcsetup.svg" alt="npm version"></a>
  <a href="https://github.com/fsco/kcsetup"><img src="https://img.shields.io/github/stars/fsco/kcsetup?style=social" alt="GitHub stars"></a>
</p>

---

## 🚀 Features

- 🏢 **Organization Management** — Create and configure Keycloak organizations
- 👥 **User Management** — Bulk user creation with role assignments
- 🔑 **Role Management** — Define and assign custom roles
- 🎨 **Theme Configuration** — Customize Keycloak appearance
- 📧 **SMTP Setup** — Configure email providers
- 🔌 **Provider Integration** — Set up identity providers
- 📋 **Multi-stage Support** — Different configs for local, dev, staging, production
- ⚡ **Fast Setup** — Automated Keycloak configuration
- 🔧 **Configurable** — Flexible YAML/JSON configuration

---

## 📦 Installation

```bash
# Recommended
bunx @fsco/kcsetup init

# Or globally
bun add -g @fsco/kcsetup
```

_NPM/Yarn supported too:_

```bash
npm install -g @fsco/kcsetup
npx @fsco/kcsetup init
```

---

## ⚡ Quick Start

```bash
# 1. Initialize configuration
kcsetup init

# 2. Run complete setup
kcsetup run

# 3. Validate configuration
kcsetup validate

# 4. Check setup status
kcsetup status
```

---

## 🔧 Configuration (`fsco.yaml`)

```yaml
identity:
  realm: "your-realm"
  clientId: "admin-cli"
  clientSecret: "your-secret"
  urls:
    local: "http://localhost:8080"
    development: "https://dev.example.com"
    staging: "https://staging.example.com"
    production: "https://prod.example.com"
  organizations:
    - name: "Engineering"
      description: "Engineering team"
      attributes:
        department: "IT"
  roles:
    - name: "admin"
      description: "Administrator role"
  users:
    - username: "admin"
      email: "admin@example.com"
      firstName: "Admin"
      lastName: "User"
      roles: ["admin"]
```

### Supported Keys

| Key             | Description                                    |
|-----------------|------------------------------------------------|
| `organizations` | Create and configure Keycloak organizations  |
| `roles`         | Define custom roles and permissions          |
| `users`         | Bulk user creation with role assignments     |
| `theme`         | Customize Keycloak appearance and branding  |
| `smtp`          | Configure email providers and templates      |
| `providers`     | Set up identity providers (OAuth, SAML, etc)|

---

## 📚 Commands

| Command                 | Description                              |
|-------------------------|------------------------------------------|
| `kcsetup init`          | Create configuration file interactively   |
| `kcsetup run`           | Run complete Keycloak setup              |
| `kcsetup validate`      | Validate current configuration           |
| `kcsetup status`        | Check current setup status               |
| `kcsetup --help`        | Show detailed help menu                  |