@nitrostack/cli 1.0.4 → 1.0.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/LICENSE +201 -0
- package/README.md +39 -96
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +4 -1
- package/dist/commands/dev.d.ts.map +1 -1
- package/dist/commands/dev.js +24 -52
- package/dist/commands/generate-types.d.ts +0 -1
- package/dist/commands/generate-types.d.ts.map +1 -1
- package/dist/commands/generate-types.js +18 -39
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +23 -15
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +18 -17
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +3 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +4 -4
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +92 -77
- package/dist/ui/branding.d.ts +21 -4
- package/dist/ui/branding.d.ts.map +1 -1
- package/dist/ui/branding.js +121 -52
- package/package.json +6 -7
- package/templates/typescript-oauth/.env.example +5 -5
- package/templates/typescript-oauth/README.md +36 -231
- package/templates/typescript-oauth/package.json +1 -1
- package/templates/typescript-oauth/src/app.module.ts +1 -1
- package/templates/typescript-oauth/src/guards/oauth.guard.ts +1 -1
- package/templates/typescript-oauth/src/health/system.health.ts +1 -1
- package/templates/typescript-oauth/src/index.ts +1 -1
- package/templates/typescript-oauth/src/modules/flights/booking.tools.ts +1 -1
- package/templates/typescript-oauth/src/modules/flights/flights.module.ts +1 -1
- package/templates/typescript-oauth/src/modules/flights/flights.prompts.ts +1 -1
- package/templates/typescript-oauth/src/modules/flights/flights.resources.ts +1 -1
- package/templates/typescript-oauth/src/modules/flights/flights.tools.ts +1 -1
- package/templates/typescript-oauth/src/services/duffel.service.ts +1 -1
- package/templates/typescript-pizzaz/.env.example +8 -0
- package/templates/typescript-pizzaz/README.md +42 -217
- package/templates/typescript-pizzaz/package.json +1 -1
- package/templates/typescript-pizzaz/src/app.module.ts +1 -1
- package/templates/typescript-pizzaz/src/index.ts +1 -1
- package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.module.ts +3 -2
- package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.service.ts +1 -1
- package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.tasks.ts +294 -0
- package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.tools.ts +1 -1
- package/templates/typescript-starter/.env.example +7 -0
- package/templates/typescript-starter/README.md +51 -284
- package/templates/typescript-starter/package.json +1 -1
- package/templates/typescript-starter/src/app.module.ts +1 -1
- package/templates/typescript-starter/src/health/system.health.ts +1 -1
- package/templates/typescript-starter/src/index.ts +1 -1
- package/templates/typescript-starter/src/modules/calculator/calculator.module.ts +1 -1
- package/templates/typescript-starter/src/modules/calculator/calculator.prompts.ts +1 -1
- package/templates/typescript-starter/src/modules/calculator/calculator.resources.ts +1 -1
- package/templates/typescript-starter/src/modules/calculator/calculator.tools.ts +1 -1
|
@@ -1,263 +1,68 @@
|
|
|
1
1
|
# ✈️ NitroStack Flight Booking
|
|
2
2
|
|
|
3
|
-
A production-ready
|
|
3
|
+
A production-ready template showcasing real-time flight search and booking with **Duffel API** integration. Learn how to build complex, authenticated MCP servers with high-impact visual widgets.
|
|
4
4
|
|
|
5
5
|
## ✨ Features
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
- Booking and order management
|
|
7
|
+
- **Real-time Search** — Powered by the Duffel API (300+ airlines).
|
|
8
|
+
- **Seat Selection** — Interactive visual cabin maps with seat pickers.
|
|
9
|
+
- **Secure Payments** — Simulated secure booking and confirmation flows.
|
|
10
|
+
- **Advanced Auth** — Optional OAuth 2.1 support for protected MCP servers.
|
|
12
11
|
|
|
13
|
-
|
|
14
|
-
- **Airport Search** - Autocomplete airport selection
|
|
15
|
-
- **Flight Search Results** - Compare flights with prices
|
|
16
|
-
- **Flight Details** - Comprehensive flight information
|
|
17
|
-
- **Seat Selection** - Visual cabin map with seat picker
|
|
18
|
-
- **Order Summary** - Complete booking overview
|
|
19
|
-
- **Payment Confirmation** - Secure payment flow
|
|
20
|
-
|
|
21
|
-
### 🛠️ **MCP Tools**
|
|
22
|
-
- `search_airports` - Find airports by name/code
|
|
23
|
-
- `search_flights` - Search available flights
|
|
24
|
-
- `show_flight_details` - Detailed flight information
|
|
25
|
-
- `select_seats` - Interactive seat selection
|
|
26
|
-
- `create_booking` - Book flights
|
|
27
|
-
- `get_order` - Retrieve booking details
|
|
12
|
+
---
|
|
28
13
|
|
|
29
14
|
## 🚀 Quick Start
|
|
30
15
|
|
|
31
|
-
###
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
# Install NitroStack CLI globally
|
|
35
|
-
npm install -g nitrostack
|
|
36
|
-
|
|
37
|
-
# Or use npx
|
|
38
|
-
npx nitrostack --version
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### 1. Create Your Project
|
|
16
|
+
### 1. Initialize Your Project
|
|
42
17
|
|
|
43
18
|
```bash
|
|
44
|
-
|
|
45
|
-
nitrostack init my-flight-app --template typescript-oauth
|
|
19
|
+
npx nitrostack init my-flight-app --template typescript-oauth
|
|
46
20
|
cd my-flight-app
|
|
47
|
-
|
|
48
|
-
# Install all dependencies (root + widgets)
|
|
49
|
-
nitrostack install
|
|
50
21
|
```
|
|
51
22
|
|
|
52
|
-
### 2.
|
|
53
|
-
|
|
54
|
-
[Duffel](https://duffel.com/) provides a free API for flight search and booking:
|
|
55
|
-
|
|
56
|
-
1. **Sign up** at [duffel.com](https://duffel.com/) (click "Start now" - it's free!)
|
|
57
|
-
2. Create a free account (no credit card required)
|
|
58
|
-
3. Go to your **Dashboard** → **Developers** → **Access tokens**
|
|
59
|
-
4. Click **"Create token"** to generate your API key
|
|
60
|
-
5. Copy the token (starts with `duffel_test_` for sandbox)
|
|
61
|
-
|
|
62
|
-
> 💡 **Tip**: The test mode (`duffel_test_*` tokens) gives you access to realistic mock data for development. Production tokens (`duffel_live_*`) connect to real airlines.
|
|
63
|
-
|
|
64
|
-
### 3. Configure Environment
|
|
65
|
-
|
|
66
|
-
Copy the example environment file and add your Duffel API key:
|
|
23
|
+
### 2. Install Dependencies
|
|
67
24
|
|
|
68
25
|
```bash
|
|
69
|
-
|
|
26
|
+
npm run install:all
|
|
70
27
|
```
|
|
71
28
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
```env
|
|
75
|
-
# Duffel API Configuration
|
|
76
|
-
DUFFEL_API_KEY=duffel_test_your_api_key_here
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### 4. Run Development Server
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
npm run dev
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
This starts:
|
|
86
|
-
- **MCP Server** - Hot reloads on code changes
|
|
87
|
-
- **Studio** on http://localhost:3000 - Visual testing environment
|
|
88
|
-
- **Widget Dev Server** on http://localhost:3001 - Hot module replacement
|
|
89
|
-
|
|
90
|
-
### 5. Test in Studio
|
|
91
|
-
|
|
92
|
-
Try these prompts in Studio chat:
|
|
93
|
-
- "Search flights from London to New York for next week"
|
|
94
|
-
- "Show me flight details"
|
|
95
|
-
- "I want to select seats"
|
|
96
|
-
- "Show me flights from JFK to LAX"
|
|
97
|
-
|
|
98
|
-
## 📁 Project Structure
|
|
99
|
-
|
|
100
|
-
```
|
|
101
|
-
typescript-oauth/
|
|
102
|
-
├── src/
|
|
103
|
-
│ ├── index.ts # Main server entry
|
|
104
|
-
│ ├── app.module.ts # App module
|
|
105
|
-
│ ├── services/
|
|
106
|
-
│ │ └── duffel.service.ts # Duffel API client
|
|
107
|
-
│ └── modules/
|
|
108
|
-
│ └── flights/
|
|
109
|
-
│ ├── flights.module.ts # Module definition
|
|
110
|
-
│ ├── flights.tools.ts # Search & display tools
|
|
111
|
-
│ ├── flights.prompts.ts # AI prompts
|
|
112
|
-
│ ├── flights.resources.ts # Static resources
|
|
113
|
-
│ └── booking.tools.ts # Booking tools
|
|
114
|
-
│ └── widgets/
|
|
115
|
-
│ ├── app/
|
|
116
|
-
│ │ ├── airport-search/ # Airport autocomplete
|
|
117
|
-
│ │ ├── flight-search-results/ # Results list
|
|
118
|
-
│ │ ├── flight-details/ # Flight info
|
|
119
|
-
│ │ ├── seat-selection/ # Seat picker
|
|
120
|
-
│ │ ├── order-summary/ # Booking summary
|
|
121
|
-
│ │ └── payment-confirmation/ # Payment widget
|
|
122
|
-
├── .env.example # Environment template
|
|
123
|
-
├── OAUTH_SETUP.md # OAuth configuration guide
|
|
124
|
-
├── package.json
|
|
125
|
-
└── README.md
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
## 🔧 Commands
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
# Installation
|
|
132
|
-
npm install # Install all dependencies (root + widgets)
|
|
133
|
-
nitrostack install # Same as above
|
|
29
|
+
### 3. Get NitroStudio
|
|
134
30
|
|
|
135
|
-
|
|
136
|
-
npm run dev # Start dev server with Studio
|
|
137
|
-
npm run build # Build TypeScript and widgets for production
|
|
138
|
-
npm start # Run production server
|
|
31
|
+
Experience the visual seat selection and flight search as your users would see it.
|
|
139
32
|
|
|
140
|
-
|
|
141
|
-
|
|
33
|
+
1. **Download NitroStudio**: [nitrostack.ai/studio](https://nitrostack.ai/studio)
|
|
34
|
+
2. **Open Project**: Launch NitroStudio and select your project folder.
|
|
142
35
|
|
|
143
|
-
|
|
144
|
-
npm run widget <command> # Run npm command in widgets directory
|
|
145
|
-
npm run widget add <pkg> # Add a widget dependency
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## 🔐 OAuth Setup (Optional)
|
|
149
|
-
|
|
150
|
-
This template includes OAuth 2.1 authentication support. If you want to protect your MCP server with authentication:
|
|
151
|
-
|
|
152
|
-
1. Read the detailed guide: **[OAUTH_SETUP.md](./OAUTH_SETUP.md)**
|
|
153
|
-
2. Configure Auth0 (or your OAuth provider)
|
|
154
|
-
3. Update your `.env` with OAuth credentials
|
|
155
|
-
|
|
156
|
-
> **Note**: OAuth is optional for local development. The template works without it using Duffel's test API.
|
|
157
|
-
|
|
158
|
-
## 📊 Duffel API Features
|
|
159
|
-
|
|
160
|
-
### Test Mode vs Live Mode
|
|
161
|
-
|
|
162
|
-
| Feature | Test Mode (`duffel_test_*`) | Live Mode (`duffel_live_*`) |
|
|
163
|
-
|---------|----------------------------|----------------------------|
|
|
164
|
-
| API Access | ✅ Full access | ✅ Full access |
|
|
165
|
-
| Pricing | Mock data | Real prices |
|
|
166
|
-
| Bookings | Simulated | Real bookings |
|
|
167
|
-
| Credit Card | Not charged | Charged |
|
|
168
|
-
| Rate Limits | Generous | Production limits |
|
|
169
|
-
|
|
170
|
-
### Supported Airlines
|
|
171
|
-
|
|
172
|
-
Duffel provides access to 300+ airlines including:
|
|
173
|
-
- Major carriers (British Airways, Lufthansa, Emirates, etc.)
|
|
174
|
-
- Low-cost carriers (Ryanair, EasyJet, Spirit, etc.)
|
|
175
|
-
- Regional airlines
|
|
176
|
-
|
|
177
|
-
### API Capabilities
|
|
178
|
-
|
|
179
|
-
- **Search**: Real-time availability and pricing
|
|
180
|
-
- **Ancillaries**: Seats, bags, meals
|
|
181
|
-
- **Booking**: Create and manage orders
|
|
182
|
-
- **Changes**: Modify existing bookings
|
|
183
|
-
- **Cancellations**: Cancel and refund
|
|
184
|
-
|
|
185
|
-
## 🎨 Widget Features
|
|
186
|
-
|
|
187
|
-
### Airport Search Widget
|
|
188
|
-
- Autocomplete with IATA codes
|
|
189
|
-
- City and airport name search
|
|
190
|
-
- Recent searches
|
|
191
|
-
|
|
192
|
-
### Flight Search Results Widget
|
|
193
|
-
- Compare multiple flights
|
|
194
|
-
- Filter by stops, price, time
|
|
195
|
-
- Sort options
|
|
196
|
-
- Airline logos
|
|
197
|
-
|
|
198
|
-
### Flight Details Widget
|
|
199
|
-
- Complete itinerary
|
|
200
|
-
- Fare breakdown
|
|
201
|
-
- Baggage allowance
|
|
202
|
-
- Flight duration and stops
|
|
203
|
-
|
|
204
|
-
### Seat Selection Widget
|
|
205
|
-
- Visual cabin map
|
|
206
|
-
- Seat categories (standard, extra legroom, etc.)
|
|
207
|
-
- Price per seat
|
|
208
|
-
- Real-time availability
|
|
209
|
-
|
|
210
|
-
## 🛠️ Customization
|
|
211
|
-
|
|
212
|
-
### Adding New Airlines
|
|
213
|
-
|
|
214
|
-
Duffel handles airline integrations automatically. You don't need to configure individual airlines.
|
|
215
|
-
|
|
216
|
-
### Modifying Search Parameters
|
|
217
|
-
|
|
218
|
-
Edit `src/modules/flights/flights.tools.ts` to customize:
|
|
219
|
-
- Default passenger counts
|
|
220
|
-
- Cabin class options
|
|
221
|
-
- Date ranges
|
|
222
|
-
- Result limits
|
|
223
|
-
|
|
224
|
-
### Styling Widgets
|
|
225
|
-
|
|
226
|
-
Each widget in `src/widgets/app/` can be customized:
|
|
227
|
-
- Edit page.tsx for layout
|
|
228
|
-
- Add custom CSS
|
|
229
|
-
- Modify component styles
|
|
36
|
+
---
|
|
230
37
|
|
|
231
|
-
##
|
|
38
|
+
## ⚙️ Configuration
|
|
232
39
|
|
|
233
|
-
### Duffel
|
|
234
|
-
- [Duffel API Docs](https://duffel.com/docs/api)
|
|
235
|
-
- [Duffel SDK (Node.js)](https://github.com/duffel/duffel-api-javascript)
|
|
236
|
-
- [Duffel Postman Collection](https://duffel.com/docs/postman)
|
|
40
|
+
### 1. Duffel API Key
|
|
237
41
|
|
|
238
|
-
|
|
239
|
-
- [NitroStack Docs](https://nitrostack.ai/docs)
|
|
240
|
-
- [Widget Development Guide](https://nitrostack.ai/docs/widgets)
|
|
42
|
+
You need a free Duffel API key to see live flight data:
|
|
241
43
|
|
|
242
|
-
|
|
44
|
+
1. Sign up at [duffel.com](https://duffel.com/).
|
|
45
|
+
2. Copy your **Test Token** from the dashboard.
|
|
46
|
+
3. Create `.env` from the example:
|
|
47
|
+
```bash
|
|
48
|
+
cp .env.example .env
|
|
49
|
+
```
|
|
50
|
+
4. Update `DUFFEL_API_KEY` in your `.env`.
|
|
243
51
|
|
|
244
|
-
|
|
245
|
-
- **Check Rate Limits**: Duffel has rate limits - cache searches when possible
|
|
246
|
-
- **Error Handling**: The template includes comprehensive error handling
|
|
247
|
-
- **Responsive Design**: Widgets are mobile-friendly out of the box
|
|
52
|
+
### 2. OAuth (Optional)
|
|
248
53
|
|
|
249
|
-
|
|
54
|
+
For production scenarios requiring user authentication, refer to [OAUTH_SETUP.md](./OAUTH_SETUP.md).
|
|
250
55
|
|
|
251
|
-
|
|
252
|
-
- Try the **Pizza Shop Template** - Interactive maps with Mapbox
|
|
253
|
-
- Read the [Duffel Getting Started Guide](https://duffel.com/docs/guides/getting-started)
|
|
56
|
+
---
|
|
254
57
|
|
|
255
|
-
##
|
|
58
|
+
## 🛠️ Commands
|
|
256
59
|
|
|
257
|
-
|
|
60
|
+
- `npm run dev` — Start the development ecosystem.
|
|
61
|
+
- `npm run build` — Bundle TypeScript and widgets for deployment.
|
|
62
|
+
- `npm run upgrade` — Keep NitroStack core up to date.
|
|
258
63
|
|
|
259
64
|
---
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
65
|
+
**Official Resources**
|
|
66
|
+
- [Website](https://nitrostack.ai)
|
|
67
|
+
- [Docs](https://docs.nitrostack.ai)
|
|
68
|
+
- [Duffel API](https://duffel.com/docs)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { McpApp, Module, ConfigModule, OAuthModule } from 'nitrostack';
|
|
1
|
+
import { McpApp, Module, ConfigModule, OAuthModule } from '@nitrostack/core';
|
|
2
2
|
import { FlightsModule } from './modules/flights/flights.module.js';
|
|
3
3
|
import { SystemHealthCheck } from './health/system.health.js';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToolDecorator as Tool, Widget, ExecutionContext, z, UseGuards, Injectable } from 'nitrostack';
|
|
1
|
+
import { ToolDecorator as Tool, Widget, ExecutionContext, z, UseGuards, Injectable } from '@nitrostack/core';
|
|
2
2
|
import { OAuthGuard } from '../../guards/oauth.guard.js';
|
|
3
3
|
import { DuffelService } from '../../services/duffel.service.js';
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PromptDecorator as Prompt, ExecutionContext, Injectable } from 'nitrostack';
|
|
1
|
+
import { PromptDecorator as Prompt, ExecutionContext, Injectable } from '@nitrostack/core';
|
|
2
2
|
import { DuffelService } from '../../services/duffel.service.js';
|
|
3
3
|
|
|
4
4
|
// Note: Using explicit deps for ESM compatibility
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ResourceDecorator as Resource, ExecutionContext, z, Injectable } from 'nitrostack';
|
|
1
|
+
import { ResourceDecorator as Resource, ExecutionContext, z, Injectable } from '@nitrostack/core';
|
|
2
2
|
import { DuffelService } from '../../services/duffel.service.js';
|
|
3
3
|
|
|
4
4
|
// Note: Using explicit deps for ESM compatibility
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ToolDecorator as Tool, Widget, ExecutionContext, z, UseGuards, Injectable } from 'nitrostack';
|
|
1
|
+
import { ToolDecorator as Tool, Widget, ExecutionContext, z, UseGuards, Injectable } from '@nitrostack/core';
|
|
2
2
|
import { OAuthGuard } from '../../guards/oauth.guard.js';
|
|
3
3
|
import { DuffelService } from '../../services/duffel.service.js';
|
|
4
4
|
import { format } from 'date-fns';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Mapbox Configuration (Optional)
|
|
2
|
+
# =============================================================================
|
|
3
|
+
# The map widget uses Mapbox GL for interactive maps.
|
|
4
|
+
# Get a free API key at: https://www.mapbox.com/
|
|
5
|
+
# =============================================================================
|
|
6
|
+
|
|
7
|
+
# Your Mapbox Public Token (starts with pk.)
|
|
8
|
+
NEXT_PUBLIC_MAPBOX_TOKEN=pk.your_mapbox_token_here
|