Skip to content

Commit eb6633e

Browse files
chore: housekeeping updates (#5)
This PR: - updates the README to follow the sample apps recommended format - bumps Circle SDKs and viem to latest versions - changes the site header from "top-up" to "arc-commerce" - replaces the default site metadata - removes unused dependencies from the package.json file
1 parent 5c39e29 commit eb6633e

File tree

7 files changed

+82
-58
lines changed

7 files changed

+82
-58
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ SUPABASE_SERVICE_ROLE_KEY=
77
CIRCLE_API_KEY=
88
CIRCLE_ENTITY_SECRET=
99
CIRCLE_BLOCKCHAIN=ARC-TESTNET
10-
CIRCLE_USDC_TOKEN_ID=
10+
CIRCLE_USDC_TOKEN_ID=15dc2b5d-0994-58b0-bf8c-3a0501148ee8
1111

1212
# Misc
1313
ADMIN_EMAIL=admin@admin.com

README.md

Lines changed: 74 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,119 @@
11
# Arc Commerce
22

3-
This project demonstrates how to integrate USDC as a payment method for purchasing credits on Arc.
3+
Integrate USDC as a payment method for purchasing credits on Arc. This sample application uses Next.js, Supabase, and Circle Developer Controlled Wallets to demonstrate a credit purchase flow with USDC payments on Arc testnet.
44

5-
## Table of Contents
5+
<img width="830" height="646" alt="User dashboard for credit purchase" src="public/screenshot.png" />
66

7-
- [Clone and Run Locally](#clone-and-run-locally)
8-
- [Environment Variables](#environment-variables)
7+
## Prerequisites
98

10-
## Clone and Run Locally
9+
- Node.js 20.x or newer
10+
- npm (automatically installed when Node.js is installed)
11+
- Docker (for running Supabase locally)
12+
- [ngrok](https://ngrok.com/) (for local webhook testing)
13+
- Circle Developer Controlled Wallets [API key](https://console.circle.com/signin) and [Entity Secret](https://developers.circle.com/wallets/dev-controlled/register-entity-secret)
1114

12-
1. **Clone and install dependencies:**
15+
## Getting Started
16+
17+
1. Clone the repository and install dependencies:
1318

1419
```bash
1520
git clone git@github.com:circlefin/arc-commerce.git
1621
cd arc-commerce
1722
npm install
1823
```
1924

20-
2. **Set up environment variables:**
25+
2. Create a `.env.local` file in the project root:
2126

2227
```bash
2328
cp .env.example .env.local
2429
```
2530

26-
Then edit `.env.local` and fill in all required values (see [Environment Variables](#environment-variables) section below).
31+
Required variables:
32+
33+
```bash
34+
# Supabase
35+
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
36+
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY=your_anon_key
37+
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
38+
39+
# Circle
40+
CIRCLE_API_KEY=your_circle_api_key
41+
CIRCLE_ENTITY_SECRET=your_entity_secret
42+
CIRCLE_BLOCKCHAIN=ARC-TESTNET
43+
CIRCLE_USDC_TOKEN_ID=15dc2b5d-0994-58b0-bf8c-3a0501148ee8
44+
45+
# Misc
46+
ADMIN_EMAIL=admin@admin.com
47+
```
2748

28-
3. **Start Supabase locally** (requires Docker):
49+
3. Start Supabase locally:
2950

3051
```bash
3152
npx supabase start
3253
npx supabase migration up
3354
```
3455

35-
4. **Start the development server:**
56+
4. Start the development server:
3657

3758
```bash
3859
npm run dev
3960
```
4061

41-
The app will be available at [http://localhost:3000](http://localhost:3000/). The admin wallet will be automatically created on first startup.
62+
The app will be available at `http://localhost:3000`. The admin wallet is automatically created on first startup.
4263

43-
5. **Set up Circle Webhooks:**
64+
5. Set up Circle Webhooks (for local development):
4465

45-
In a separate terminal, start ngrok to expose your local server:
66+
In a separate terminal, expose your local server:
4667

4768
```bash
4869
ngrok http 3000
4970
```
5071

51-
Copy the HTTPS URL from ngrok (e.g., `https://your-ngrok-url.ngrok.io`) and add it to your Circle Console webhooks section:
72+
Add the webhook endpoint in Circle Console:
5273
- Navigate to Circle Console → Webhooks
53-
- Add a new webhook endpoint: `https://your-ngrok-url.ngrok.io/api/circle/webhook`
54-
- Keep ngrok running while developing to receive webhook events
74+
- Add endpoint: `https://your-ngrok-url.ngrok.io/api/circle/webhook`
75+
- Keep ngrok running to receive webhook events
76+
77+
## How It Works
78+
79+
- Built with [Next.js](https://nextjs.org/) and [Supabase](https://supabase.com/)
80+
- Uses [Circle Developer Controlled Wallets](https://developers.circle.com/wallets/dev-controlled) for USDC transactions
81+
- Wallet operations handled server-side with `@circle-fin/developer-controlled-wallets`
82+
- Webhook signature verification ensures secure transaction notifications
83+
- Admin wallet automatically initialized on first run
5584

5685
## Environment Variables
5786

58-
Copy `.env.example` to `.env.local` and fill in the required values:
87+
| Variable | Scope | Purpose |
88+
| ------------------------------------- | ----------- | ------------------------------------------------------------------------ |
89+
| `NEXT_PUBLIC_SUPABASE_URL` | Public | Supabase project URL |
90+
| `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY` | Public | Supabase anonymous/public key |
91+
| `SUPABASE_SERVICE_ROLE_KEY` | Server-side | Service role for privileged database operations |
92+
| `CIRCLE_API_KEY` | Server-side | Circle API key for webhook signature verification |
93+
| `CIRCLE_ENTITY_SECRET` | Server-side | Circle entity secret for wallet operations |
94+
| `CIRCLE_BLOCKCHAIN` | Server-side | Blockchain network identifier (e.g., "ARC-TESTNET") |
95+
| `CIRCLE_USDC_TOKEN_ID` | Server-side | USDC token ID for the specified blockchain |
96+
| `ADMIN_EMAIL` | Server-side | Email address that determines which user gets admin dashboard access |
5997

60-
```bash
61-
# Supabase
62-
NEXT_PUBLIC_SUPABASE_URL=
63-
NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY=
64-
SUPABASE_SERVICE_ROLE_KEY=
98+
## Usage Notes
6599

66-
# Circle
67-
CIRCLE_API_KEY=
68-
CIRCLE_ENTITY_SECRET=
69-
CIRCLE_BLOCKCHAIN=ARC-TESTNET
70-
CIRCLE_USDC_TOKEN_ID=
100+
- Designed for Arc testnet only
101+
- Requires valid Circle API credentials and Supabase configuration
102+
- Admin wallet must have sufficient USDC and gas fees
103+
- ngrok (or similar) required for local webhook testing
71104

72-
# Misc
73-
ADMIN_EMAIL=admin@admin.com
74-
```
105+
## Scripts
75106

76-
| Variable | Scope | Purpose |
77-
| ------------------------------------- | ----------- | ------------------------------------------------------------------------ |
78-
| `NEXT_PUBLIC_SUPABASE_URL` | Public | Supabase project URL. |
79-
| `NEXT_PUBLIC_SUPABASE_PUBLISHABLE_OR_ANON_KEY` | Public | Supabase anonymous/public key. |
80-
| `SUPABASE_SERVICE_ROLE_KEY` | Server-side | Service role for privileged writes (e.g., transaction inserts). |
81-
| `CIRCLE_API_KEY` | Server-side | Used to fetch Circle webhook public keys for signature verification. |
82-
| `CIRCLE_ENTITY_SECRET` | Server-side | Circle entity secret for wallet operations. |
83-
| `CIRCLE_BLOCKCHAIN` | Server-side | Blockchain network identifier (e.g., "ARC-TESTNET"). |
84-
| `CIRCLE_USDC_TOKEN_ID` | Server-side | USDC token ID for the specified blockchain. |
85-
| `ADMIN_EMAIL` | Server-side | Admin user email address. |
107+
- `npm run dev`: Start Next.js development server with auto-reload
108+
- `npx supabase start`: Start local Supabase instance
109+
- `npx supabase migration up`: Apply database migrations
110+
111+
## Security & Usage Model
112+
113+
This sample application:
114+
- Assumes testnet usage only
115+
- Handles secrets via environment variables
116+
- Verifies webhook signatures for security
117+
- Is not intended for production use without modification
118+
119+
See `SECURITY.md` for vulnerability reporting guidelines. Please report issues privately via Circle's bug bounty program.

app/dashboard/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default function ProtectedLayout({
3636
<div className="w-full max-w-5xl flex justify-between items-center p-3 px-5 text-sm">
3737
<div className="flex gap-5 items-center font-semibold">
3838
<ThemeSwitcher />
39-
<Link href={"/"}>top-up</Link>
39+
<Link href={"/"}>arc-commerce</Link>
4040
</div>
4141
<div className="flex items-center gap-3">
4242
{/* The wallet buttons have been removed from here */}

app/layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ const defaultUrl = process.env.VERCEL_URL
2929

3030
export const metadata: Metadata = {
3131
metadataBase: new URL(defaultUrl),
32-
title: "Next.js and Supabase Starter Kit",
33-
description: "The fastest way to build apps with Next.js and Supabase",
32+
title: "Arc Commerce",
33+
description: "Platform credit purchases using USDC and Circle Wallets",
3434
};
3535

3636
export default function RootLayout({

app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export default function Home() {
3131
<div className="w-full max-w-5xl flex justify-between items-center p-3 px-5 text-sm">
3232
<div className="flex gap-5 items-center font-semibold">
3333
<ThemeSwitcher />
34-
<Link href={"/"}>top-up</Link>
34+
<Link href={"/"}>arc-commerce</Link>
3535
</div>
3636
{!hasEnvVars ? <EnvVarWarning /> : <AuthButton />}
3737
</div>

package.json

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,8 @@
77
"lint": "next lint"
88
},
99
"dependencies": {
10-
"@circle-fin/bridge-kit": "^1.1.2",
11-
"@circle-fin/developer-controlled-wallets": "^8.4.1",
12-
"@circle-fin/modular-wallets-core": "^1.0.11",
13-
"@hookform/resolvers": "^5.2.2",
14-
"@metamask/delegation-toolkit": "^0.13.0",
10+
"@circle-fin/developer-controlled-wallets": "^10.0.1",
1511
"@radix-ui/react-alert-dialog": "^1.1.15",
16-
"@radix-ui/react-checkbox": "^1.3.1",
1712
"@radix-ui/react-dialog": "^1.1.15",
1813
"@radix-ui/react-dropdown-menu": "^2.1.16",
1914
"@radix-ui/react-label": "^2.1.7",
@@ -27,31 +22,26 @@
2722
"@supabase/supabase-js": "latest",
2823
"@tanstack/react-query": "^5.90.2",
2924
"@tanstack/react-table": "^8.21.3",
30-
"axios": "^1.12.2",
3125
"class-variance-authority": "^0.7.1",
3226
"clsx": "^2.1.1",
33-
"cmdk": "^1.1.1",
3427
"date-fns": "^4.1.0",
3528
"lucide-react": "^0.511.0",
3629
"next": "latest",
3730
"next-themes": "^0.4.6",
3831
"react": "^19.0.0",
3932
"react-day-picker": "^9.11.0",
4033
"react-dom": "^19.0.0",
41-
"react-hook-form": "^7.63.0",
4234
"sonner": "^2.0.7",
4335
"tailwind-merge": "^3.3.0",
44-
"viem": "^2.38.0",
45-
"wagmi": "^2.17.5",
46-
"zod": "^4.1.11"
36+
"viem": "^2.44.4",
37+
"wagmi": "^2.19.5"
4738
},
4839
"devDependencies": {
4940
"@eslint/eslintrc": "^3",
5041
"@tailwindcss/postcss": "^4.1.13",
5142
"@types/node": "^20",
5243
"@types/react": "^19",
5344
"@types/react-dom": "^19",
54-
"baseline-browser-mapping": "^2.9.3",
5545
"eslint": "^9",
5646
"eslint-config-next": "15.3.1",
5747
"postcss": "^8",

public/screenshot.png

28.8 KB
Loading

0 commit comments

Comments
 (0)