create-bluecopa-react-app 1.0.1 → 1.0.2

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 CHANGED
@@ -4,13 +4,15 @@ A CLI tool to bootstrap modern React applications for BlueCopa with built-in UI
4
4
 
5
5
  ## Features
6
6
 
7
- - 🚀 **Modern React Stack**: React 18, TypeScript, Next.js 14
7
+ - 🚀 **Modern React Stack**: React 18, TypeScript, React Router v6, Vite
8
8
  - 📊 **Data Visualization**: Recharts integration for charts and analytics
9
9
  - 🎨 **UI Components**: Radix UI primitives with custom styling
10
- - 📡 **BlueCopa React Components**: Pre-configured @bluecopa/react package
10
+ - 📡 **BlueCopa React Components**: Pre-configured @bluecopa/react package with hooks
11
11
  - 🎯 **Type Safety**: Full TypeScript support
12
- - 📱 **Responsive Design**: Tailwind CSS with mobile-first approach
13
- - 🛠️ **Development Tools**: ESLint, TypeScript checking, and Next.js build optimization
12
+ - 📱 **Responsive Design**: Tailwind CSS with mobile-first approach and BlueCopa design system
13
+ - 🛠️ **Development Tools**: ESLint, TypeScript checking, and Vite fast build system
14
+ - ⚡ **Fast Development**: Hot module replacement with Vite
15
+ - 🔄 **Client-side Routing**: React Router v6 for SPA navigation
14
16
 
15
17
  ## Quick Start
16
18
 
@@ -36,17 +38,18 @@ npm run dev
36
38
 
37
39
  ## Template Included
38
40
 
39
- ### BlueCopa Next.js Template
41
+ ### BlueCopa React Router Template
40
42
 
41
43
  A foundational template that provides:
42
44
 
43
- - **Modern Next.js Setup**: Next.js 14 with React 18, TypeScript and App Router
44
- - **BlueCopa Components**: Pre-configured @bluecopa/react component library
45
+ - **Modern React Setup**: React 18 with TypeScript, React Router v6, and Vite
46
+ - **BlueCopa Components**: Pre-configured @bluecopa/react component library with hooks
45
47
  - **UI Foundation**: Radix UI primitives with custom styling system
46
48
  - **Data Visualization**: Recharts for charts and analytics
47
- - **Styling System**: Tailwind CSS with BlueCopa design tokens
48
- - **Development Setup**: ESLint, TypeScript configuration, and Next.js optimization
49
+ - **Styling System**: Tailwind CSS with BlueCopa design tokens and navy theme
50
+ - **Development Setup**: ESLint, TypeScript configuration, and Vite optimization
49
51
  - **Environment Configuration**: Ready-to-use environment variable setup
52
+ - **Client-side Routing**: React Router v6 for smooth SPA navigation
50
53
 
51
54
  #### Key Dependencies Included
52
55
 
@@ -54,20 +57,22 @@ A foundational template that provides:
54
57
  // Core BlueCopa and React ecosystem
55
58
  "@bluecopa/react": "^0.1.3"
56
59
  "react": "^18.3.0"
57
- "next": "^14.2.0"
60
+ "react-dom": "^18.3.0"
61
+ "react-router-dom": "^6.26.0"
58
62
  "typescript": "^5.6.0"
59
63
 
60
64
  // UI and Styling
61
65
  "@radix-ui/*": "Latest versions"
62
- "tailwindcss": "^3.4.0"
66
+ "tailwindcss": "^3.4.17"
63
67
  "lucide-react": "^0.445.0"
64
68
 
65
69
  // Data Visualization
66
70
  "recharts": "^2.12.0"
67
71
 
68
72
  // Development and Build
73
+ "vite": "^5.4.20"
69
74
  "eslint": "^8.57.0"
70
- "eslint-config-next": "^14.2.0"
75
+ "@vitejs/plugin-react": "^4.3.0"
71
76
  ```
72
77
 
73
78
  ## Project Structure
@@ -77,47 +82,77 @@ The generated project follows a clean, scalable structure:
77
82
  ```text
78
83
  my-bluecopa-app/
79
84
  ├── src/
80
- │ ├── app/ # Next.js App Router pages
81
- │ │ ├── layout.tsx # Root layout component
82
- │ │ ├── page.tsx # Home page component
83
- │ └── globals.css # Global styles and Tailwind imports
84
- ├── components/
85
- ├── ui/ # Reusable UI components
86
- │ │ ├── charts/ # Chart components using Recharts
87
- │ └── layouts/ # Layout components
88
- │ ├── lib/ # Utilities and helpers
89
- │ │ ├── utils.ts # Common utility functions
90
- │ └── cn.ts # Tailwind class name utilities
91
- │ └── types/ # TypeScript type definitions
92
- ├── public/ # Static assets
93
- ├── .env # Environment variables
94
- ├── .env.example # Environment variables template
95
- ├── package.json # Dependencies and scripts
96
- ├── next.config.js # Next.js configuration
97
- ├── tailwind.config.js # Tailwind CSS configuration
98
- ├── tsconfig.json # TypeScript configuration
99
- ├── postcss.config.js # PostCSS configuration
100
- └── README.md # Project documentation
85
+ │ ├── components/ # Reusable UI components
86
+ │ │ ├── ui/ # Base UI components (buttons, cards, etc.)
87
+ │ │ └── navbar.tsx # Navigation component
88
+ ├── hooks/ # Custom React hooks
89
+ │ └── use-api.ts # Bluecopa API hooks
90
+ │ ├── lib/ # Utilities and helpers
91
+ │ │ └── utils.ts # Helper functions and utilities
92
+ ├── pages/ # Route components
93
+ ├── Home.tsx # Home page component
94
+ │ │ └── Dashboard.tsx # Dashboard page component
95
+ ├── providers/ # React context providers
96
+ └── query-provider.tsx # TanStack Query provider
97
+ ├── types/ # TypeScript type definitions
98
+ ├── App.tsx # Main app component with routing
99
+ ├── main.tsx # Application entry point
100
+ │ └── index.css # Global styles and Tailwind imports
101
+ ├── public/ # Static assets
102
+ ├── .env.example # Environment variables template
103
+ ├── package.json # Dependencies and scripts
104
+ ├── vite.config.ts # Vite configuration
105
+ ├── tailwind.config.js # Tailwind CSS configuration
106
+ ├── tsconfig.json # TypeScript configuration
107
+ ├── postcss.config.js # PostCSS configuration
108
+ └── README.md # Project documentation
101
109
  ```
102
110
 
103
111
  ## Getting Started with Development
104
112
 
105
- ### Adding BlueCopa Components
113
+ ### Adding BlueCopa Components and Hooks
106
114
 
107
- The template includes @bluecopa/react components. Start building by importing and using them:
115
+ The template includes @bluecopa/react components and hooks. Start building by importing and using them:
108
116
 
109
117
  ```typescript
110
- import { SomeBlueCopaComponent } from '@bluecopa/react';
118
+ import { useUserData, useMetricDataDemo, useDatasetDataDemo } from '@/hooks/use-api';
111
119
 
112
120
  function MyComponent() {
121
+ const { data: userData, isLoading, error } = useUserData();
122
+ const { data: metrics } = useMetricDataDemo();
123
+
124
+ if (isLoading) return <div>Loading...</div>;
125
+ if (error) return <div>Error: {error.message}</div>;
126
+
113
127
  return (
114
128
  <div>
115
- <SomeBlueCopaComponent />
129
+ <h1>Welcome, {userData?.user?.firstName}!</h1>
116
130
  </div>
117
131
  );
118
132
  }
119
133
  ```
120
134
 
135
+ ### Adding Routes
136
+
137
+ Add new routes in `src/App.tsx`:
138
+
139
+ ```typescript
140
+ import { Routes, Route } from 'react-router-dom';
141
+ import NewPage from '@/pages/NewPage';
142
+
143
+ export default function App() {
144
+ return (
145
+ <QueryProvider>
146
+ <Routes>
147
+ <Route path="/" element={<Home />} />
148
+ <Route path="/dashboard" element={<Dashboard />} />
149
+ <Route path="/new-page" element={<NewPage />} />
150
+ </Routes>
151
+ </QueryProvider>
152
+ );
153
+ }
154
+ ```
155
+
121
156
  ### Adding UI Components
122
157
 
123
158
  Use the included Radix UI components with Tailwind styling:
@@ -168,36 +203,72 @@ function ChartComponent() {
168
203
  }
169
204
  ```
170
205
 
171
- ### Styling and Theming
172
-
173
- - Modify `tailwind.config.js` for custom design tokens
174
- - Update CSS variables in `src/app/globals.css` for theme customization
175
- - All components support consistent styling through Tailwind utilities
176
- - Use the `cn()` utility function for conditional class names
206
+ ### Environment Configuration
177
207
 
178
- ## Environment Configuration
208
+ Create a `.env.local` file from the example:
179
209
 
180
- Copy the included `.env.example` to `.env` and configure as needed:
210
+ ```bash
211
+ cp .env.example .env.local
212
+ # Edit .env.local with your Bluecopa credentials from dashboard → Settings → API Tokens
213
+ ```
181
214
 
215
+ Required environment variables:
182
216
  ```bash
183
- cp .env.example .env
217
+ VITE_BLUECOPA_API_TOKEN=your-bluecopa-api-token
218
+ VITE_BLUECOPA_API_URL=https://develop.bluecopa.com/api/v1
219
+ VITE_BLUECOPA_WORKSPACE_ID=your-workspace-id
184
220
  ```
185
221
 
186
222
  ## Available Scripts
187
223
 
188
- - `npm run dev` - Start Next.js development server with hot reload
189
- - `npm run build` - Build for production (Next.js optimization)
190
- - `npm run start` - Start production server
224
+ - `npm run dev` - Start Vite development server with hot reload
225
+ - `npm run build` - Build for production (TypeScript + Vite optimization)
226
+ - `npm run preview` - Preview production build locally
191
227
  - `npm run lint` - Run ESLint for code quality
192
228
  - `npm run type-check` - Run TypeScript type checking without emitting files
193
229
 
194
230
  ## Technologies Used
195
231
 
196
232
  - **React 18** - Modern React with concurrent features
197
- - **Next.js 14** - Full-stack React framework with App Router
233
+ - **React Router v6** - Declarative routing for React SPAs
234
+ - **Vite** - Fast build tool and development server
198
235
  - **TypeScript** - Full type safety and developer experience
199
- - **@bluecopa/react** - BlueCopa-specific React components
236
+ - **@bluecopa/react** - BlueCopa-specific React components and hooks
237
+ - **TanStack Query** - Powerful data synchronization for React
200
238
  - **Radix UI** - Unstyled, accessible UI primitives
201
239
  - **Recharts** - Composable charting library for React
202
- - **Tailwind CSS** - Utility-first CSS framework
240
+ - **Tailwind CSS** - Utility-first CSS framework with BlueCopa design system
203
241
  - **Lucide React** - Beautiful, customizable icons
242
+
243
+ ## CLI Usage
244
+
245
+ The CLI will prompt you for project details and automatically:
246
+
247
+ - Create the project structure
248
+ - Copy template files
249
+ - Update package.json with your project name
250
+ - Install dependencies (unless `--skip-install` is used)
251
+ - Provide next steps for development
252
+
253
+ Example output:
254
+
255
+ ```bash
256
+ ✔ Creating project structure...
257
+ ✔ Dependencies installed
258
+ ✔ Success! Created my-dashboard at /path/to/my-dashboard
259
+
260
+ Inside that directory, you can run several commands:
261
+
262
+ npm run dev
263
+ Starts the development server.
264
+
265
+ npm run build
266
+ Bundles the app into static files for production.
267
+
268
+ We suggest that you begin by typing:
269
+
270
+ cd my-dashboard
271
+ npm run dev
272
+
273
+ Happy coding with Bluecopa! 🚀
274
+ ```
@@ -100,19 +100,19 @@ async function createApp(projectName, options) {
100
100
  console.log();
101
101
  console.log('Inside that directory, you can run several commands:');
102
102
  console.log();
103
- console.log(chalk.cyan(' npm start'));
103
+ console.log(chalk.cyan(' npm run dev'));
104
104
  console.log(' Starts the development server.');
105
105
  console.log();
106
106
  console.log(chalk.cyan(' npm run build'));
107
107
  console.log(' Bundles the app into static files for production.');
108
108
  console.log();
109
- console.log(chalk.cyan(' npm test'));
110
- console.log(' Starts the test runner.');
109
+ console.log(chalk.cyan(' npm run preview'));
110
+ console.log(' Preview the production build locally.');
111
111
  console.log();
112
112
  console.log('We suggest that you begin by typing:');
113
113
  console.log();
114
114
  console.log(chalk.cyan(' cd'), appName);
115
- console.log(chalk.cyan(' npm start'));
115
+ console.log(chalk.cyan(' npm run dev'));
116
116
  console.log();
117
117
  console.log('Happy coding with Bluecopa! 🚀');
118
118
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bluecopa-react-app",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "CLI tool to create bluecopa React applications",
5
5
  "main": "./bin/create-bluecopa-react-app.js",
6
6
  "bin": {
@@ -0,0 +1,259 @@
1
+ # Agent Development Guide - BlueCopa React Template
2
+
3
+ This document provides guidance for AI agents working with BlueCopa React applications built from this template.
4
+
5
+ ## 🤖 Agent Overview
6
+
7
+ This template is designed to work seamlessly with AI coding assistants for rapid development of BlueCopa dashboard applications. The project structure and patterns are optimized for AI-assisted development.
8
+
9
+ ## 📋 Project Context
10
+
11
+ ### Technology Stack
12
+ - **Frontend**: React 18 + TypeScript + React Router v6
13
+ - **Build Tool**: Vite (fast HMR and building)
14
+ - **Styling**: TailwindCSS with BlueCopa design system
15
+ - **UI Components**: Radix UI primitives
16
+ - **Data Fetching**: TanStack Query with @bluecopa/react hooks
17
+ - **Charts**: Recharts for data visualization
18
+ - **Icons**: Lucide React
19
+
20
+ ### Key Directories
21
+ ```
22
+ src/
23
+ ├── components/ui/ # Reusable UI components (Button, Card, etc.)
24
+ ├── components/ # Business logic components (Navbar, etc.)
25
+ ├── hooks/ # Custom React hooks and API integration
26
+ ├── pages/ # Route components (Home, Dashboard)
27
+ ├── providers/ # React context providers
28
+ ├── lib/ # Utility functions and helpers
29
+ └── types/ # TypeScript type definitions
30
+ ```
31
+
32
+ ## 🔧 Development Patterns
33
+
34
+ ### 1. Adding New Pages/Routes
35
+
36
+ When asked to create a new page:
37
+
38
+ 1. **Create the page component** in `src/pages/NewPage.tsx`:
39
+ ```tsx
40
+ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
41
+
42
+ export default function NewPage() {
43
+ return (
44
+ <div className="container mx-auto py-6">
45
+ <Card>
46
+ <CardHeader>
47
+ <CardTitle>New Page</CardTitle>
48
+ </CardHeader>
49
+ <CardContent>
50
+ {/* Page content */}
51
+ </CardContent>
52
+ </Card>
53
+ </div>
54
+ );
55
+ }
56
+ ```
57
+
58
+ 2. **Add the route** in `src/App.tsx`:
59
+ ```tsx
60
+ import NewPage from '@/pages/NewPage';
61
+
62
+ // Add to Routes
63
+ <Route path="/new-page" element={<NewPage />} />
64
+ ```
65
+
66
+ 3. **Update navigation** in `src/components/navbar.tsx`:
67
+ ```tsx
68
+ const navigation = [
69
+ // ... existing routes
70
+ { name: 'New Page', href: '/new-page', icon: Settings },
71
+ ];
72
+ ```
73
+
74
+ ### 2. Using BlueCopa API Hooks
75
+
76
+ Always use the pre-configured hooks from `@/hooks/use-api.ts`:
77
+
78
+ ```tsx
79
+ import { useUserData, useMetricDataDemo, useDatasetDataDemo } from '@/hooks/use-api';
80
+
81
+ function DataComponent() {
82
+ const { data: userData, isLoading, error } = useUserData();
83
+ const { data: metrics } = useMetricDataDemo();
84
+
85
+ if (isLoading) return <div>Loading...</div>;
86
+ if (error) return <div>Error: {error.message}</div>;
87
+
88
+ return <div>Data: {JSON.stringify(userData)}</div>;
89
+ }
90
+ ```
91
+
92
+ ### 3. UI Component Patterns
93
+
94
+ Use the existing UI components from `src/components/ui/`:
95
+
96
+ ```tsx
97
+ import { Button } from '@/components/ui/button';
98
+ import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
99
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';
100
+
101
+ // Example usage
102
+ <Card>
103
+ <CardHeader>
104
+ <CardTitle>Dashboard</CardTitle>
105
+ </CardHeader>
106
+ <CardContent>
107
+ <Tabs defaultValue="overview">
108
+ <TabsList>
109
+ <TabsTrigger value="overview">Overview</TabsTrigger>
110
+ <TabsTrigger value="analytics">Analytics</TabsTrigger>
111
+ </TabsList>
112
+ <TabsContent value="overview">
113
+ <Button>Action</Button>
114
+ </TabsContent>
115
+ </Tabs>
116
+ </CardContent>
117
+ </Card>
118
+ ```
119
+
120
+ ### 4. Chart Integration
121
+
122
+ Use Recharts for data visualization:
123
+
124
+ ```tsx
125
+ import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from 'recharts';
126
+
127
+ function ChartComponent({ data }: { data: any[] }) {
128
+ return (
129
+ <Card>
130
+ <CardHeader>
131
+ <CardTitle>Analytics</CardTitle>
132
+ </CardHeader>
133
+ <CardContent>
134
+ <ResponsiveContainer width="100%" height={300}>
135
+ <LineChart data={data}>
136
+ <CartesianGrid strokeDasharray="3 3" />
137
+ <XAxis dataKey="name" />
138
+ <YAxis />
139
+ <Tooltip />
140
+ <Line type="monotone" dataKey="value" stroke="#041e42" />
141
+ </LineChart>
142
+ </ResponsiveContainer>
143
+ </CardContent>
144
+ </Card>
145
+ );
146
+ }
147
+ ```
148
+
149
+ ## 🎨 Design System Guidelines
150
+
151
+ ### Colors
152
+ - **Primary**: Navy blue (`#041e42`) - BlueCopa brand color
153
+ - **Background**: Light gray (`bg-gray-50`)
154
+ - **Cards**: White with subtle shadow (`bg-white shadow-sm`)
155
+ - **Text**: Gray scale (`text-gray-900`, `text-gray-600`)
156
+
157
+ ### Layout Patterns
158
+ - **Container**: `container mx-auto py-6` for page layouts
159
+ - **Grid**: `grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6` for responsive grids
160
+ - **Spacing**: Use Tailwind spacing scale (`p-4`, `mb-6`, etc.)
161
+
162
+ ### Component Structure
163
+ ```tsx
164
+ // Standard page layout
165
+ <div className="container mx-auto py-6">
166
+ <div className="mb-6">
167
+ <h1 className="text-2xl font-bold text-gray-900">Page Title</h1>
168
+ <p className="text-gray-600">Page description</p>
169
+ </div>
170
+
171
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
172
+ {/* Cards or components */}
173
+ </div>
174
+ </div>
175
+ ```
176
+
177
+ ## 🛠️ Common Tasks for Agents
178
+
179
+ ### Adding a New Dashboard Card
180
+ 1. Create component in appropriate location
181
+ 2. Use Card component wrapper
182
+ 3. Include loading and error states
183
+ 4. Use BlueCopa hooks for data
184
+
185
+ ### Creating Forms
186
+ 1. Use Radix UI form components
187
+ 2. Add TypeScript types for form data
188
+ 3. Include validation and error handling
189
+ 4. Follow BlueCopa styling patterns
190
+
191
+ ### Adding Data Tables
192
+ 1. Consider using AG Grid (@bluecopa/aggrid) for complex tables
193
+ 2. For simple tables, use HTML table with Tailwind styling
194
+ 3. Include sorting, filtering, and pagination as needed
195
+
196
+ ### Implementing Search
197
+ 1. Add search state management
198
+ 2. Use debounced input for API calls
199
+ 3. Show loading states during search
200
+ 4. Handle empty states gracefully
201
+
202
+ ## 🚨 Important Notes for Agents
203
+
204
+ ### Environment Variables
205
+ Always reference environment variables correctly for Vite:
206
+ ```tsx
207
+ const apiToken = import.meta.env.VITE_BLUECOPA_API_TOKEN;
208
+ const apiUrl = import.meta.env.VITE_BLUECOPA_API_URL;
209
+ ```
210
+
211
+ ### Imports
212
+ Use path aliases consistently:
213
+ ```tsx
214
+ import { Button } from '@/components/ui/button';
215
+ import { useUserData } from '@/hooks/use-api';
216
+ import { cn } from '@/lib/utils';
217
+ ```
218
+
219
+ ### TypeScript
220
+ Always include proper TypeScript types:
221
+ ```tsx
222
+ interface ComponentProps {
223
+ data: UserData[];
224
+ onSelect: (id: string) => void;
225
+ }
226
+
227
+ function Component({ data, onSelect }: ComponentProps) {
228
+ // Component implementation
229
+ }
230
+ ```
231
+
232
+ ### Error Handling
233
+ Include proper error boundaries and loading states:
234
+ ```tsx
235
+ if (isLoading) return <div className="p-4">Loading...</div>;
236
+ if (error) return <div className="p-4 text-red-600">Error: {error.message}</div>;
237
+ if (!data) return <div className="p-4 text-gray-500">No data available</div>;
238
+ ```
239
+
240
+ ## 📚 Reference Links
241
+
242
+ - [React Router Documentation](https://reactrouter.com)
243
+ - [TailwindCSS Documentation](https://tailwindcss.com)
244
+ - [Radix UI Documentation](https://radix-ui.com)
245
+ - [Recharts Documentation](https://recharts.org)
246
+ - [TanStack Query Documentation](https://tanstack.com/query)
247
+ - [BlueCopa React Package](https://github.com/bluecopa/blui/packages/react)
248
+
249
+ ## 🔄 Development Workflow
250
+
251
+ When working on this project:
252
+
253
+ 1. **Start development server**: `npm run dev`
254
+ 2. **Type checking**: `npm run type-check`
255
+ 3. **Linting**: `npm run lint`
256
+ 4. **Building**: `npm run build`
257
+ 5. **Preview build**: `npm run preview`
258
+
259
+ The development server supports hot module replacement, so changes will be reflected immediately in the browser.
@@ -1,6 +1,6 @@
1
- # Bluecopa React Router Boilerplate Template
1
+ # BlueCopa React App Template
2
2
 
3
- A production-ready React template with React Router for building modern Bluecopa dashboard applications with integrated React hooks, beautiful UI components, and comprehensive data visualization capabilities.
3
+ A production-ready React template with React Router for building modern BlueCopa dashboard applications with integrated React hooks, beautiful UI components, and comprehensive data visualization capabilities.
4
4
 
5
5
  ## 🎨 Design System
6
6
 
@@ -14,6 +14,23 @@ This template now uses the latest Bluecopa design system with:
14
14
 
15
15
  ## 🚀 Quick Start
16
16
 
17
+ > **Note**: This template is typically generated using the `create-bluecopa-react-app` CLI tool. If you're using this template directly, follow the manual setup instructions below.
18
+
19
+ ### Using the CLI Tool (Recommended)
20
+
21
+ ```bash
22
+ # Install globally
23
+ npm install -g create-bluecopa-react-app
24
+
25
+ # Create new app
26
+ create-bluecopa-react-app my-dashboard
27
+
28
+ # Or use npx
29
+ npx create-bluecopa-react-app my-dashboard
30
+ ```
31
+
32
+ ### Manual Setup
33
+
17
34
  ### Prerequisites
18
35
  - Node.js 18+
19
36
  - npm or pnpm