---
title: ShopSettings
tags: [data-model, mongoose]
aliases: [Shop, Storefront, IShopSettings]
---

# ShopSettings

> **Last updated:** 2026-05-31 — store-level payment rail defaults documented.

One-to-one storefront configuration for a seller. Holds the shop name, description, avatar, cover image, public visibility flag, review toggles (`allowSellerReviews`, `allowTemplateReviews`), social links, and store-level payment rail defaults. The unique constraint on `sellerId` enforces the one-shop-per-seller invariant.

> [!note] Source
> `backend/src/models/ShopSettings.ts:22` — schema definition
> `backend/src/models/ShopSettings.ts:86` — model export

## Schema

| Field | Type | Required | Default | Validation | Index | Description |
| --- | --- | --- | --- | --- | --- | --- |
| `sellerId` | ObjectId → [[User]] | yes | — | — | unique | Owning seller (one shop per seller). |
| `name` | String | yes | — | trim | — | Shop name. |
| `description` | String | no | `""` | trim | — | Shop description. |
| `avatar` | String | no | `""` | — | — | Avatar URL. |
| `coverImage` | String | no | `""` | — | — | Cover image URL. |
| `isPublic` | Boolean | no | `true` | — | — | Public visibility flag. |
| `allowSellerReviews` | Boolean | no | `true` | — | — | Whether buyers can review the seller. |
| `allowTemplateReviews` | Boolean | no | `true` | — | — | Whether buyers can review templates. |
| `socialLinks.facebook` | String | no | `""` | — | — | Facebook URL. |
| `socialLinks.instagram` | String | no | `""` | — | — | Instagram URL. |
| `socialLinks.linkedin` | String | no | `""` | — | — | LinkedIn URL. |
| `socialLinks.twitter` | String | no | `""` | — | — | Twitter / X URL. |
| `paymentConfig.allowedChains[]` | Number[] | no | `[1, 56]` | update route requires at least one chain when supplied | — | Store-level accepted chain ids used by templates with `paymentConfig.useShopDefault === true`. |
| `paymentConfig.allowedTokens[]` | String[] | no | `["USDC", "USDT"]` | update route requires at least one token when supplied | — | Store-level accepted settlement tokens. |
| `createdAt` | Date | auto | — | — | — | Mongoose timestamp. |
| `updatedAt` | Date | auto | — | — | — | Mongoose timestamp. |

## Virtuals

None defined.

## Indexes

- Implicit unique index on `sellerId` (from `unique: true`). No additional indexes are declared (see comment at `backend/src/models/ShopSettings.ts:84`).

## Pre/Post Hooks

None declared.

## Instance Methods

None defined.

## Static Methods

None defined.

## Relationships

- **References**: [[User]] (`sellerId`).
- **Referenced by**: none. [[Review]] toggles for the seller are read from here.

## State Transitions

No status field. The `isPublic` boolean is the only visibility control:

```mermaid
stateDiagram-v2
    [*] --> public
    public --> private : seller toggles off
    private --> public : seller toggles on
```

## Common Queries

```ts
// Fetch the seller's shop
ShopSettings.findOne({ sellerId });

// Upsert on first save
ShopSettings.findOneAndUpdate(
  { sellerId },
  { $set: { name, description, ... } },
  { upsert: true, new: true }
);

// Public shop directory
ShopSettings.find({ isPublic: true }).sort({ createdAt: -1 });

// Resolve seller-level payment rails for template checkout
ShopSettings.findOne({ sellerId }).select('paymentConfig');
```

> [!warning] Creating two shops will fail
> Inserting a second `ShopSettings` document with the same `sellerId` will fail with `E11000 duplicate key`. Application code should always use `findOneAndUpdate` with `upsert: true`.

Related: [[User]], [[Review]], [[RequestTemplate]].
