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

# Snag Template App

> A production-ready Next.js + Tailwind Web3 starter template with loyalty program and user profiles designed for Web3 projects

<head>
  <script type="application/ld+json">
    {JSON.stringify({
            "@context": "https://schema.org",
            "@type": "TechArticle",
            "headline": "Snag Template App",
            "description": "A production-ready Next.js + Tailwind Web3 starter template with loyalty program and user profiles designed for Web3 projects",
            "author": {"@type": "Organization", "name": "Snag Solutions", "url": "https://www.snagsolutions.io/"},
            "publisher": {"@type": "Organization", "name": "Snag Solutions", "url": "https://www.snagsolutions.io/", "logo": {"@type": "ImageObject", "url": "https://assets.snagsolutions.io/public/docs/snag-logo-dark-no-bg.svg"}},
            "mainEntityOfPage": "https://docs.snagsolutions.io/loyalty/nextjs-template"
          })}
  </script>
</head>

<Tip>
  **Using an AI coding assistant?** Connect Cursor, Claude, or Copilot to Snag Docs for context-aware help. [Learn how](/ai-coding-assistant).
</Tip>

Whether you're building a community rewards program, a gated Web3 experience, or a gamified platform, this template will get you up and running fast — fully integrated with the **Snag Solutions SDK**.

The starter kit is built with:

* **[Next.js](https://nextjs.org/docs) (App Router)** for modern, file-based routing
* **[Tailwind CSS](https://tailwindcss.com/docs)** for rapid styling
* **Snag Solutions SDK** for plug-and-play Web3 features

<CardGroup cols={1}>
  <Card title="View on GitHub" icon="github" href="https://github.com/Snag-Solutions/nextjs-template">
    Explore the codebase, star the repo, and fork to start quickly. This is the canonical template repository.
  </Card>
</CardGroup>

## What’s Included

This template showcases a simple Web3 application with:

* **Web3 Authentication** (wallet-based login)
* **Loyalty Program & Leaderboard**
* **User Profile Page** with wallet info and loyalty point history

## Getting Started

### Prerequisites

Before you start, make sure you have:

* [Node.js](https://nodejs.org/)
* [PNPM](https://pnpm.io/)

### Installation

Clone this repository and install the dependencies:

```bash theme={null}
pnpm install
```

### Environment Setup

Create a `.env` file in the project root with the following variables:

```env theme={null}
NEXT_PUBLIC_API_KEY=your_api_key
NEXT_PUBLIC_WEBSITE_ID=your_website_uuid
NEXT_PUBLIC_ORGANIZATION_ID=your_organization_uuid
LOYALTY_CURRENCY_ID=your_loyalty_currency_id
ENABLE_TWITTER_RULES=boolean # Optional
ENABLE_TELEGRAM_RULES=boolean # Optional
RULES_COLLECTIONS='[{"address":"0x123","network":"mainnet"}]' # Optional
```

You can find or generate your API key and UUIDs via the [**Admin Dashboard**](https://admin.snagsolutions.io).

## Development

To start the development server:

```bash theme={null}
pnpm dev
```

Visit [http://localhost:3000](http://localhost:3000) to see the app in action.

## Setup Scripts

### Add Initial Loyalty Rules

This sets up a base rule set for your website:

```bash theme={null}
pnpm rules:create
```

> Tip: Make sure your loyalty currency is created first.

### Remove All Loyalty Rules

To clear all existing rules:

```bash theme={null}
pnpm rules:remove
```

## Fork This Template

Want to create your own version of this template?

<CardGroup cols={1}>
  <Card title="Fork the Template on GitHub" icon="github" href="https://github.com/Snag-Solutions/nextjs-template">
    Create your own copy of the Next.js Template App to customize. After forking, follow the <a href="#getting-started">
    Getting Started</a>

    section above.
  </Card>
</CardGroup>

## Project Structure

```bash theme={null}
.
├── app/                   # App Router pages
├── components/            # Reusable UI components
├── lib/                   # Utility functions and SDK integrations
├── public/                # Static assets
├── scripts/               # Loyalty setup/teardown scripts
└── .env.example           # Environment variable template
```

## Related Docs

* [Next.js App Router Docs](https://nextjs.org/docs/app/building-your-application/routing)
* [Tailwind CSS Docs](https://tailwindcss.com/docs)
