create-x402-app 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +120 -25
- package/dist/index.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Create a new x402 pay-per-request API project with one command.
|
|
4
4
|
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
`create-x402-app` is a CLI tool that scaffolds production-ready x402 projects with pre-configured examples, wallet integration, and payment handling. Get started with HTTP 402 payments on Mantle Network in minutes.
|
|
8
|
+
|
|
5
9
|
## Quick Start
|
|
6
10
|
|
|
7
11
|
```bash
|
|
@@ -10,25 +14,41 @@ cd my-app
|
|
|
10
14
|
npm run dev
|
|
11
15
|
```
|
|
12
16
|
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
No installation required. Use `npx` to run the CLI directly:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx create-x402-app [project-name]
|
|
23
|
+
```
|
|
24
|
+
|
|
13
25
|
## Usage
|
|
14
26
|
|
|
15
27
|
### Interactive Mode
|
|
16
28
|
|
|
29
|
+
Run without arguments to use interactive prompts:
|
|
30
|
+
|
|
17
31
|
```bash
|
|
18
32
|
npx create-x402-app
|
|
19
33
|
```
|
|
20
34
|
|
|
21
|
-
|
|
35
|
+
The CLI will prompt you for:
|
|
22
36
|
- Project name
|
|
37
|
+
- Project type (Fullstack or Backend only)
|
|
38
|
+
- Framework (Hono or Express)
|
|
23
39
|
- Package manager (npm, yarn, pnpm, bun)
|
|
24
40
|
- Whether to install dependencies
|
|
25
41
|
|
|
26
|
-
###
|
|
42
|
+
### Command Line Arguments
|
|
27
43
|
|
|
28
44
|
```bash
|
|
29
45
|
# Create project with specific name
|
|
30
46
|
npx create-x402-app my-api
|
|
31
47
|
|
|
48
|
+
# Specify project type and framework
|
|
49
|
+
npx create-x402-app my-api --fullstack --express
|
|
50
|
+
npx create-x402-app my-api --backend --hono
|
|
51
|
+
|
|
32
52
|
# Use specific package manager
|
|
33
53
|
npx create-x402-app my-api --bun
|
|
34
54
|
npx create-x402-app my-api --pnpm
|
|
@@ -38,43 +58,118 @@ npx create-x402-app my-api --yarn
|
|
|
38
58
|
npx create-x402-app my-api --skip-install
|
|
39
59
|
```
|
|
40
60
|
|
|
61
|
+
## Available Templates
|
|
62
|
+
|
|
63
|
+
The CLI provides 4 production-ready templates:
|
|
64
|
+
|
|
65
|
+
### Backend Templates
|
|
66
|
+
|
|
67
|
+
**backend-hono** - Standalone Hono API server
|
|
68
|
+
- Fast, lightweight Hono framework
|
|
69
|
+
- Web Standards based
|
|
70
|
+
- Minimal dependencies
|
|
71
|
+
|
|
72
|
+
**backend-express** - Standalone Express API server
|
|
73
|
+
- Popular Express.js framework
|
|
74
|
+
- Mature ecosystem
|
|
75
|
+
- Extensive middleware support
|
|
76
|
+
|
|
77
|
+
### Fullstack Templates
|
|
78
|
+
|
|
79
|
+
**fullstack-hono** - Next.js app with Hono API routes
|
|
80
|
+
- Next.js 16 with App Router
|
|
81
|
+
- Hono for API routes
|
|
82
|
+
- Complete frontend + backend
|
|
83
|
+
|
|
84
|
+
**fullstack-express** - Next.js app with Express-style API routes
|
|
85
|
+
- Next.js 16 with App Router
|
|
86
|
+
- Express-compatible API routes
|
|
87
|
+
- Complete frontend + backend
|
|
88
|
+
|
|
41
89
|
## What's Included
|
|
42
90
|
|
|
43
|
-
|
|
91
|
+
Each generated project includes:
|
|
44
92
|
|
|
45
|
-
- **
|
|
46
|
-
- **
|
|
47
|
-
- **TypeScript** configuration
|
|
93
|
+
- **x402-mantle-sdk** pre-installed and configured
|
|
94
|
+
- **TypeScript** configuration with strict mode
|
|
48
95
|
- **Tailwind CSS** for styling
|
|
49
96
|
- **Example API routes**:
|
|
50
|
-
- `/api/info` - Free endpoint
|
|
97
|
+
- `/api/info` - Free endpoint (no payment required)
|
|
51
98
|
- `/api/premium` - Paid endpoint (0.001 MNT)
|
|
52
99
|
- `/api/weather` - Paid endpoint (0.0005 MNT)
|
|
53
|
-
- **Demo frontend** with wallet connection
|
|
100
|
+
- **Demo frontend** with wallet connection UI
|
|
101
|
+
- **Payment modal** integration
|
|
102
|
+
- **Environment configuration** with `.env.example`
|
|
103
|
+
- **Git configuration** with `.gitignore`
|
|
104
|
+
|
|
105
|
+
## Getting Started
|
|
106
|
+
|
|
107
|
+
### 1. Get Your App ID
|
|
108
|
+
|
|
109
|
+
1. Visit the [x402 Dashboard](https://mantle-x402.vercel.app)
|
|
110
|
+
2. Connect your wallet
|
|
111
|
+
3. Create a new project
|
|
112
|
+
4. Copy your App ID
|
|
113
|
+
|
|
114
|
+
### 2. Configure Environment
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
cp .env.example .env
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Edit `.env` and add your App ID:
|
|
121
|
+
|
|
122
|
+
```env
|
|
123
|
+
X402_APP_ID=your-app-id-here
|
|
124
|
+
X402_PLATFORM_URL=https://mantle-x402.vercel.app
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 3. Start Development
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npm run dev
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Open [http://localhost:3000](http://localhost:3000) to see your app.
|
|
134
|
+
|
|
135
|
+
## Project Structure
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
my-app/
|
|
139
|
+
├── src/
|
|
140
|
+
│ ├── app/
|
|
141
|
+
│ │ ├── api/ # API routes
|
|
142
|
+
│ │ │ ├── info/ # Free endpoint
|
|
143
|
+
│ │ │ ├── premium/ # Paid endpoint
|
|
144
|
+
│ │ │ └── weather/ # Paid endpoint
|
|
145
|
+
│ │ ├── page.tsx # Demo frontend
|
|
146
|
+
│ │ └── layout.tsx # Root layout
|
|
147
|
+
│ ├── components/ # UI components
|
|
148
|
+
│ └── lib/ # Utilities
|
|
149
|
+
├── public/ # Static assets
|
|
150
|
+
├── .env.example # Environment template
|
|
151
|
+
└── package.json
|
|
152
|
+
```
|
|
54
153
|
|
|
55
|
-
##
|
|
154
|
+
## Next Steps
|
|
56
155
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
- Copy your App ID
|
|
156
|
+
- Read the [x402 Documentation](https://mantle-x402.vercel.app/dashboard?tab=docs)
|
|
157
|
+
- Explore the [x402-mantle-sdk API Reference](https://www.npmjs.com/package/x402-mantle-sdk)
|
|
158
|
+
- Customize API routes and pricing
|
|
159
|
+
- Deploy to production
|
|
62
160
|
|
|
63
|
-
|
|
64
|
-
```bash
|
|
65
|
-
cp .env.example .env
|
|
66
|
-
# Edit .env with your App ID
|
|
67
|
-
```
|
|
161
|
+
## Related Packages
|
|
68
162
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```
|
|
163
|
+
- **x402-mantle-sdk** - Core SDK for HTTP 402 payments
|
|
164
|
+
- [View on npm](https://www.npmjs.com/package/x402-mantle-sdk)
|
|
165
|
+
- Server middleware, client SDK, and React components
|
|
73
166
|
|
|
74
|
-
##
|
|
167
|
+
## Resources
|
|
75
168
|
|
|
76
|
-
- [x402 Documentation](https://mantle-x402.vercel.app)
|
|
169
|
+
- [x402 Documentation](https://mantle-x402.vercel.app/dashboard?tab=docs)
|
|
170
|
+
- [x402 Dashboard](https://mantle-x402.vercel.app)
|
|
77
171
|
- [x402-mantle-sdk on npm](https://www.npmjs.com/package/x402-mantle-sdk)
|
|
172
|
+
- [Mantle Network](https://mantle.xyz)
|
|
78
173
|
|
|
79
174
|
## License
|
|
80
175
|
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var require_package = __commonJS({
|
|
|
31
31
|
"package.json"(exports2, module2) {
|
|
32
32
|
module2.exports = {
|
|
33
33
|
name: "create-x402-app",
|
|
34
|
-
version: "0.1.
|
|
34
|
+
version: "0.1.7",
|
|
35
35
|
description: "Create a new x402 pay-per-request API project",
|
|
36
36
|
keywords: [
|
|
37
37
|
"x402",
|
|
@@ -50,7 +50,7 @@ var require_package = __commonJS({
|
|
|
50
50
|
license: "MIT",
|
|
51
51
|
repository: {
|
|
52
52
|
type: "git",
|
|
53
|
-
url: "https://github.com/
|
|
53
|
+
url: "git+https://github.com/Debanjannnn/x-402-mantle-sdk.git"
|
|
54
54
|
},
|
|
55
55
|
bin: {
|
|
56
56
|
"create-x402-app": "./dist/index.js"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-x402-app",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "Create a new x402 pay-per-request API project",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"x402",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "https://github.com/
|
|
22
|
+
"url": "git+https://github.com/Debanjannnn/x-402-mantle-sdk.git"
|
|
23
23
|
},
|
|
24
24
|
"bin": {
|
|
25
25
|
"create-x402-app": "./dist/index.js"
|