Skip to content

Commit 254546e

Browse files
AyushBherwani1998AyushBherwani1998
andauthored
Add Farcaster template
* add farcaster template * remove demo * update template * update chain * resolve reviewers comments * remove unwanted console logs --------- Co-authored-by: AyushBherwani1998 <“ayush.bherwani1998@gmail.com”>
1 parent ff68afb commit 254546e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1737
-0
lines changed

packages/create-gator-app/src/lib/choices/templates.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ const NEXTJS_TEMPLATE_OPTIONS: ITemplate[] = [
1717
isWeb3AuthSupported: true,
1818
areLLMRulesSupported: false,
1919
},
20+
{
21+
name: "Farcaster Mini App Delegation Starter",
22+
value: "farcaster-starter",
23+
description: "A basic Next.js Farcaster Mini App Delegation starter",
24+
framework: "nextjs",
25+
isWeb3AuthSupported: false,
26+
areLLMRulesSupported: false,
27+
},
2028
{
2129
name: "Experimental: ERC7715 Permissions starter",
2230
value: "erc7715-starter",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
NEXT_PUBLIC_PIMLICO_API_KEY=
2+
NEXT_PUBLIC_URL=
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# MetaMask Smart Accounts x Farcaster starter template
2+
3+
This is a NextJS MetaMask Smart Accounts x Farcaster starter template created with `@metamask/create-gator-app`.
4+
5+
This template helps you quickly bootstrap your project with a Farcaster mini app and MetaMask Smart Accounts. It
6+
provides a foundation for building mini apps that leverage account abstraction and powerful delegation features to
7+
deliver seamless, secure, and flexible user experiences.
8+
9+
Learn more about [Metamask Smart Accounts](https://docs.metamask.io/delegation-toolkit/concepts/smart-accounts/).
10+
11+
## Prerequisites
12+
13+
1. **Pimlico API Key**: In this template, you’ll use Pimlico’s bundler and paymaster
14+
services to submit user operations and sponsor transactions. You can get
15+
your API key from [Pimlico’s dashboard](https://dashboard.pimlico.io/apikeys).
16+
17+
18+
## Project structure
19+
20+
```bash
21+
template/
22+
├── public/ # Static assets
23+
├── src/
24+
│ ├── app/ # App router pages
25+
│ ├── components/ # UI Components
26+
│ ├── hooks/ # Custom React hooks
27+
│ ├── providers/ # Custom React Context Provider
28+
│ └── utils/ # Utils for the starter
29+
├── .env # Environment variables
30+
├── .gitignore # Git ignore rules
31+
├── next.config.ts # Next.js configuration
32+
└── tsconfig.json # TypeScript configuration
33+
```
34+
35+
## Setup environment variables
36+
37+
Update the following environment variables in the `.env` file at the root of your project.
38+
39+
```
40+
NEXT_PUBLIC_PIMLICO_API_KEY =
41+
```
42+
43+
## Getting started
44+
45+
First, start the development server using the package manager you chose during setup.
46+
47+
```bash
48+
npm run dev
49+
# or
50+
yarn dev
51+
# or
52+
pnpm dev
53+
```
54+
55+
Open [http://localhost:3000](http://localhost:3000) in your browser to view the app.
56+
57+
## View with Farcaster Embed tool
58+
59+
Farcaster offers a handy [Embed tool](https://farcaster.xyz/~/developers/mini-apps/embed) that lets you preview and inspect your Mini App before publishing it. This tool
60+
works only with hosted URLs. To make your local project accessible remotely, you can create a tunnel using tools like
61+
ngrok or cloudflared.
62+
63+
In this guide, we’re using cloudflared, but you’re free to choose whichever tool you prefer.
64+
65+
### Create a tunnel
66+
67+
```bash
68+
cloudflared tunnel --url http://localhost:3000
69+
```
70+
71+
### Update environment variable
72+
73+
```
74+
NEXT_PUBLIC_URL = "CLOUDFLARED_URL"
75+
```
76+
77+
### Test the mini app
78+
79+
Once you have the remote url, you can view the app in [embed tool](https://farcaster.xyz/~/developers/mini-apps/embed) by entering the url.
80+
81+
![Embed Tool Screenshot](./screenshots/embed-tool.png)
82+
83+
84+
## Learn more
85+
86+
To learn more about MetaMask Smart Accounts, take a look at the following resources:
87+
88+
- [Quickstart](https://docs.metamask.io/delegation-toolkit/get-started/quickstart/) - Get started quickly with the MetaMask Smart Accounts
89+
- [Delegation quickstart](https://docs.metamask.io/delegation-toolkit/get-started/delegation-quickstart/) - Get started quickly with creating a MetaMask smart account and completing the delegation lifecycle (creating, signing, and redeeming a delegation).
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { dirname } from "path";
2+
import { fileURLToPath } from "url";
3+
import { FlatCompat } from "@eslint/eslintrc";
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = dirname(__filename);
7+
8+
const compat = new FlatCompat({
9+
baseDirectory: __dirname,
10+
});
11+
12+
const eslintConfig = [
13+
...compat.extends("next/core-web-vitals", "next/typescript"),
14+
];
15+
16+
export default eslintConfig;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import type { NextConfig } from "next";
2+
3+
const nextConfig: NextConfig = {
4+
/* config options here */
5+
};
6+
7+
export default nextConfig;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"name": "farcaster-starter",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"dev": "next dev",
7+
"build": "next build",
8+
"start": "next start",
9+
"lint": "next lint"
10+
},
11+
"dependencies": {
12+
"@farcaster/miniapp-sdk": "^0.1.7",
13+
"@farcaster/miniapp-wagmi-connector": "^1.0.0",
14+
"@metamask/delegation-toolkit": "^0.11.0",
15+
"@tanstack/react-query": "^5.76.1",
16+
"permissionless": "^0.2.46",
17+
"viem": "^2.29.2",
18+
"wagmi": "^2.15.3",
19+
"react": "19.1.0",
20+
"react-dom": "19.1.0",
21+
"next": "15.4.3"
22+
},
23+
"devDependencies": {
24+
"typescript": "^5",
25+
"@types/node": "^20",
26+
"@types/react": "^19",
27+
"@types/react-dom": "^19",
28+
"@tailwindcss/postcss": "^4",
29+
"tailwindcss": "^4",
30+
"eslint": "^9",
31+
"eslint-config-next": "15.4.3",
32+
"@eslint/eslintrc": "^3"
33+
}
34+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const config = {
2+
plugins: ["@tailwindcss/postcss"],
3+
};
4+
5+
export default config;
Lines changed: 1 addition & 0 deletions
Loading
132 KB
Loading
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)