create-bluecopa-react-app 1.0.5 → 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/README.md +47 -10
- package/bin/create-bluecopa-react-app.js +257 -51
- package/package.json +6 -5
- package/templates/latest/Agent.md +254 -0
- package/templates/latest/Dockerfile +22 -0
- package/templates/latest/README.md +157 -221
- package/templates/latest/app/app.css +134 -0
- package/templates/latest/app/app.tsx +46 -0
- package/templates/latest/app/components/app-sidebar.tsx +174 -0
- package/templates/latest/app/components/chart-area-interactive.tsx +290 -0
- package/templates/latest/app/components/data-table.tsx +807 -0
- package/templates/latest/app/components/nav-documents.tsx +92 -0
- package/templates/latest/app/components/nav-main.tsx +56 -0
- package/templates/latest/app/components/nav-secondary.tsx +42 -0
- package/templates/latest/app/components/nav-user.tsx +112 -0
- package/templates/latest/app/components/section-cards.tsx +102 -0
- package/templates/latest/app/components/site-header.tsx +19 -0
- package/templates/latest/app/components/ui/avatar.tsx +53 -0
- package/templates/latest/app/components/ui/badge.tsx +46 -0
- package/templates/latest/app/components/ui/breadcrumb.tsx +109 -0
- package/templates/latest/app/components/ui/button.tsx +58 -0
- package/templates/latest/app/components/ui/card.tsx +92 -0
- package/templates/latest/app/components/ui/chart.tsx +352 -0
- package/templates/latest/app/components/ui/checkbox.tsx +30 -0
- package/templates/latest/app/components/ui/drawer.tsx +139 -0
- package/templates/latest/app/components/ui/dropdown-menu.tsx +258 -0
- package/templates/latest/app/components/ui/input.tsx +21 -0
- package/templates/latest/app/components/ui/label.tsx +24 -0
- package/templates/latest/app/components/ui/select.tsx +183 -0
- package/templates/latest/app/components/ui/separator.tsx +26 -0
- package/templates/latest/app/components/ui/sheet.tsx +139 -0
- package/templates/latest/app/components/ui/sidebar.tsx +731 -0
- package/templates/latest/app/components/ui/skeleton.tsx +13 -0
- package/templates/latest/app/components/ui/sonner.tsx +23 -0
- package/templates/latest/app/components/ui/table.tsx +117 -0
- package/templates/latest/app/components/ui/tabs.tsx +66 -0
- package/templates/latest/app/components/ui/toggle-group.tsx +73 -0
- package/templates/latest/app/components/ui/toggle.tsx +47 -0
- package/templates/latest/app/components/ui/tooltip.tsx +59 -0
- package/templates/latest/app/dashboard/data.json +614 -0
- package/templates/latest/app/hooks/use-bluecopa-user.ts +37 -0
- package/templates/latest/app/hooks/use-mobile.ts +19 -0
- package/templates/latest/{src → app}/lib/utils.ts +1 -1
- package/templates/latest/app/main.tsx +12 -0
- package/templates/latest/app/routes/home.tsx +40 -0
- package/templates/latest/app/routes.tsx +15 -0
- package/templates/latest/{src → app}/single-spa.tsx +5 -5
- package/templates/latest/components.json +22 -0
- package/templates/latest/dist/assets/__federation_expose_App-DsPovvoo.js +147 -0
- package/templates/latest/dist/assets/__federation_fn_import-CzfA7kmP.js +438 -0
- package/templates/latest/dist/assets/__federation_shared_react-Bp6HVBS4.js +16 -0
- package/templates/latest/dist/assets/__federation_shared_react-dom-BCcRGiYp.js +17 -0
- package/templates/latest/dist/assets/client-BZh_TW_6.js +12662 -0
- package/templates/latest/dist/assets/home-CAuoIW4B.js +54951 -0
- package/templates/latest/dist/assets/index-BzNimew1.js +69 -0
- package/templates/latest/dist/assets/index-Clg7n7gy.js +60 -0
- package/templates/latest/dist/assets/index-DMFtQdNS.js +412 -0
- package/templates/latest/dist/assets/remoteEntry.css +3688 -0
- package/templates/latest/dist/assets/remoteEntry.js +88 -0
- package/templates/latest/dist/avatars/shadcn.svg +6 -0
- package/templates/latest/dist/favicon.ico +0 -0
- package/templates/latest/dist/index.html +19 -0
- package/templates/latest/index.html +1 -1
- package/templates/latest/package-lock.json +1227 -3353
- package/templates/latest/package.json +47 -43
- package/templates/latest/pnpm-lock.yaml +4767 -0
- package/templates/latest/preview/index.html +32 -2
- package/templates/latest/public/avatars/shadcn.svg +6 -0
- package/templates/latest/public/favicon.ico +0 -0
- package/templates/latest/tsconfig.json +19 -12
- package/templates/latest/vite.config.ts +47 -40
- package/templates/latest/.env.example +0 -14
- package/templates/latest/.eslintrc.cjs +0 -42
- package/templates/latest/AGENT.md +0 -282
- package/templates/latest/clean.sh +0 -40
- package/templates/latest/postcss.config.cjs +0 -6
- package/templates/latest/public/bluecopa-logo.svg +0 -30
- package/templates/latest/public/favicon-32x32.png +0 -0
- package/templates/latest/public/favicon-96x96.png +0 -0
- package/templates/latest/setup.sh +0 -56
- package/templates/latest/src/App.tsx +0 -19
- package/templates/latest/src/components/charts/AreaChart.tsx +0 -80
- package/templates/latest/src/components/charts/DonutChart.tsx +0 -73
- package/templates/latest/src/components/charts/SparkAreaChart.tsx +0 -52
- package/templates/latest/src/components/layout/dashboard-header.tsx +0 -139
- package/templates/latest/src/components/layout/dashboard-layout.tsx +0 -37
- package/templates/latest/src/components/layout/navbar.tsx +0 -106
- package/templates/latest/src/components/layout/sidebar.tsx +0 -55
- package/templates/latest/src/components/page/dashboard/DashboardMetrics.tsx +0 -97
- package/templates/latest/src/components/page/dashboard/PaymentMethodsAnalysis.tsx +0 -182
- package/templates/latest/src/components/page/dashboard/RevenueAnalytics.tsx +0 -505
- package/templates/latest/src/components/page/dashboard/SalesAnalytics.tsx +0 -313
- package/templates/latest/src/components/page/dashboard/TransactionsTable.tsx +0 -256
- package/templates/latest/src/components/page/dashboard/dashboard-utils.ts +0 -147
- package/templates/latest/src/components/page/dashboard/dashboard.tsx +0 -185
- package/templates/latest/src/components/tables/data-grid.tsx +0 -439
- package/templates/latest/src/components/ui/alert.tsx +0 -59
- package/templates/latest/src/components/ui/avatar.tsx +0 -50
- package/templates/latest/src/components/ui/badge.tsx +0 -36
- package/templates/latest/src/components/ui/bluecopa-logo.tsx +0 -57
- package/templates/latest/src/components/ui/button.tsx +0 -58
- package/templates/latest/src/components/ui/card.tsx +0 -79
- package/templates/latest/src/components/ui/dropdown-menu.tsx +0 -200
- package/templates/latest/src/components/ui/input.tsx +0 -24
- package/templates/latest/src/components/ui/label.tsx +0 -21
- package/templates/latest/src/components/ui/select.tsx +0 -27
- package/templates/latest/src/hooks/use-api.ts +0 -55
- package/templates/latest/src/index.css +0 -59
- package/templates/latest/src/main.tsx +0 -13
- package/templates/latest/src/pages/Dashboard.tsx +0 -13
- package/templates/latest/src/pages/Home.tsx +0 -622
- package/templates/latest/src/providers/query-provider.tsx +0 -48
- package/templates/latest/src/types/api.ts +0 -78
- package/templates/latest/src/vite-env.d.ts +0 -11
- package/templates/latest/tailwind.config.js +0 -87
- package/templates/latest/tsconfig.app.json +0 -32
- package/templates/latest/tsconfig.node.json +0 -14
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
# AI Agent Guide for BlueCopa React shadcn/ui Template
|
|
2
|
+
|
|
3
|
+
This guide helps AI assistants and developers understand the project structure, patterns, and best practices for working with this BlueCopa React application template.
|
|
4
|
+
|
|
5
|
+
## 🏗️ Project Architecture Overview
|
|
6
|
+
|
|
7
|
+
### Core Stack
|
|
8
|
+
- **React 18** with TypeScript
|
|
9
|
+
- **React Router v7** with SSR support
|
|
10
|
+
- **shadcn/ui** components built on Radix UI
|
|
11
|
+
- **Tailwind CSS v4** with CSS variables
|
|
12
|
+
- **Vite 6** for build tooling
|
|
13
|
+
- **TanStack Query** (via @bluecopa/react)
|
|
14
|
+
|
|
15
|
+
### Key Directories
|
|
16
|
+
```
|
|
17
|
+
app/
|
|
18
|
+
├── components/ # Reusable UI components
|
|
19
|
+
│ ├── ui/ # shadcn/ui components
|
|
20
|
+
│ ├── app-sidebar.tsx # Main navigation
|
|
21
|
+
│ ├── data-table.tsx # TanStack Table wrapper
|
|
22
|
+
│ └── chart-*.tsx # Recharts components
|
|
23
|
+
├── hooks/ # Custom React hooks
|
|
24
|
+
├── lib/ # Utilities and configurations
|
|
25
|
+
├── routes/ # React Router pages
|
|
26
|
+
└── dashboard/ # Sample data and components
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## 🎨 Component Patterns
|
|
30
|
+
|
|
31
|
+
### shadcn/ui Components
|
|
32
|
+
All UI components follow shadcn/ui patterns:
|
|
33
|
+
- Located in `app/components/ui/`
|
|
34
|
+
- Built on Radix UI primitives
|
|
35
|
+
- Styled with Tailwind CSS
|
|
36
|
+
- Use `cn()` utility for class merging
|
|
37
|
+
- Support dark mode via CSS variables
|
|
38
|
+
|
|
39
|
+
### Custom Components
|
|
40
|
+
- Use TypeScript interfaces for props
|
|
41
|
+
- Follow React best practices (hooks, memo, etc.)
|
|
42
|
+
- Implement proper accessibility
|
|
43
|
+
- Use semantic HTML elements
|
|
44
|
+
|
|
45
|
+
### Example Component Structure
|
|
46
|
+
```tsx
|
|
47
|
+
import { cn } from "~/lib/utils"
|
|
48
|
+
|
|
49
|
+
interface ComponentProps {
|
|
50
|
+
className?: string
|
|
51
|
+
children: React.ReactNode
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function Component({ className, children }: ComponentProps) {
|
|
55
|
+
return (
|
|
56
|
+
<div className={cn("base-styles", className)}>
|
|
57
|
+
{children}
|
|
58
|
+
</div>
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## 🔧 Development Patterns
|
|
64
|
+
|
|
65
|
+
### State Management
|
|
66
|
+
- Use React hooks (useState, useReducer, useContext)
|
|
67
|
+
- TanStack Query for server state
|
|
68
|
+
- Local state for UI interactions
|
|
69
|
+
- Avoid prop drilling with context
|
|
70
|
+
|
|
71
|
+
### Data Fetching
|
|
72
|
+
- Use `@bluecopa/react` hooks for API calls
|
|
73
|
+
- Implement loading and error states
|
|
74
|
+
- Use TanStack Query for caching
|
|
75
|
+
- Handle optimistic updates
|
|
76
|
+
|
|
77
|
+
### Styling Guidelines
|
|
78
|
+
- Use Tailwind CSS classes
|
|
79
|
+
- Leverage CSS variables for theming
|
|
80
|
+
- Follow mobile-first responsive design
|
|
81
|
+
- Use `cn()` utility for conditional classes
|
|
82
|
+
|
|
83
|
+
## 📊 Data Visualization
|
|
84
|
+
|
|
85
|
+
### Charts (Recharts)
|
|
86
|
+
- Interactive charts with hover states
|
|
87
|
+
- Responsive design
|
|
88
|
+
- Customizable colors via CSS variables
|
|
89
|
+
- Accessible with proper ARIA labels
|
|
90
|
+
|
|
91
|
+
### Tables (TanStack Table)
|
|
92
|
+
- Sortable columns
|
|
93
|
+
- Filtering capabilities
|
|
94
|
+
- Pagination support
|
|
95
|
+
- Row selection
|
|
96
|
+
- Custom cell renderers
|
|
97
|
+
|
|
98
|
+
## 🎯 Common Tasks & Solutions
|
|
99
|
+
|
|
100
|
+
### Adding New Pages
|
|
101
|
+
1. Create route file in `app/routes/`
|
|
102
|
+
2. Export default component
|
|
103
|
+
3. Add navigation link in sidebar
|
|
104
|
+
4. Implement proper TypeScript types
|
|
105
|
+
|
|
106
|
+
### Adding New Components
|
|
107
|
+
1. Create component file in appropriate directory
|
|
108
|
+
2. Define TypeScript interface for props
|
|
109
|
+
3. Use shadcn/ui components as base
|
|
110
|
+
4. Implement responsive design
|
|
111
|
+
5. Add proper accessibility attributes
|
|
112
|
+
|
|
113
|
+
### Working with Forms
|
|
114
|
+
1. Use shadcn/ui form components
|
|
115
|
+
2. Implement validation with Zod
|
|
116
|
+
3. Handle form state with React hooks
|
|
117
|
+
4. Show loading and error states
|
|
118
|
+
5. Use proper form semantics
|
|
119
|
+
|
|
120
|
+
### API Integration
|
|
121
|
+
1. Use `@bluecopa/react` hooks
|
|
122
|
+
2. Handle loading states
|
|
123
|
+
3. Implement error boundaries
|
|
124
|
+
4. Use TanStack Query for caching
|
|
125
|
+
5. Add optimistic updates where appropriate
|
|
126
|
+
|
|
127
|
+
## 🚀 Performance Optimization
|
|
128
|
+
|
|
129
|
+
### Code Splitting
|
|
130
|
+
- Use React.lazy() for route-based splitting
|
|
131
|
+
- Implement proper loading states
|
|
132
|
+
- Avoid unnecessary re-renders
|
|
133
|
+
|
|
134
|
+
### Bundle Optimization
|
|
135
|
+
- Use Vite's built-in optimizations
|
|
136
|
+
- Implement proper tree shaking
|
|
137
|
+
- Optimize images and assets
|
|
138
|
+
|
|
139
|
+
### Runtime Performance
|
|
140
|
+
- Use React.memo() for expensive components
|
|
141
|
+
- Implement proper key props
|
|
142
|
+
- Avoid inline object/function creation
|
|
143
|
+
|
|
144
|
+
## 🧪 Testing Strategies
|
|
145
|
+
|
|
146
|
+
### Component Testing
|
|
147
|
+
- Test component behavior, not implementation
|
|
148
|
+
- Use React Testing Library
|
|
149
|
+
- Mock external dependencies
|
|
150
|
+
- Test accessibility features
|
|
151
|
+
|
|
152
|
+
### Integration Testing
|
|
153
|
+
- Test user workflows
|
|
154
|
+
- Mock API responses
|
|
155
|
+
- Test error scenarios
|
|
156
|
+
- Verify responsive behavior
|
|
157
|
+
|
|
158
|
+
## 🔒 Security Considerations
|
|
159
|
+
|
|
160
|
+
### Data Handling
|
|
161
|
+
- Sanitize user inputs
|
|
162
|
+
- Validate data on client and server
|
|
163
|
+
- Use proper TypeScript types
|
|
164
|
+
- Implement proper error handling
|
|
165
|
+
|
|
166
|
+
## 📱 Responsive Design
|
|
167
|
+
|
|
168
|
+
### Breakpoints
|
|
169
|
+
- Mobile-first approach
|
|
170
|
+
- Use Tailwind's responsive prefixes
|
|
171
|
+
- Test on multiple devices
|
|
172
|
+
- Implement touch-friendly interactions
|
|
173
|
+
|
|
174
|
+
### Layout Patterns
|
|
175
|
+
- Use CSS Grid and Flexbox
|
|
176
|
+
- Implement proper spacing
|
|
177
|
+
- Handle overflow scenarios
|
|
178
|
+
- Ensure proper scrolling
|
|
179
|
+
|
|
180
|
+
## 🌙 Dark Mode Implementation
|
|
181
|
+
|
|
182
|
+
### Theme System
|
|
183
|
+
- Use next-themes for theme switching
|
|
184
|
+
- Implement CSS variables for colors
|
|
185
|
+
- Test both light and dark modes
|
|
186
|
+
- Ensure proper contrast ratios
|
|
187
|
+
|
|
188
|
+
### Component Theming
|
|
189
|
+
- Use semantic color tokens
|
|
190
|
+
- Implement proper hover states
|
|
191
|
+
- Test theme transitions
|
|
192
|
+
- Ensure accessibility compliance
|
|
193
|
+
|
|
194
|
+
## 🐛 Debugging Tips
|
|
195
|
+
|
|
196
|
+
### Common Issues
|
|
197
|
+
- Check TypeScript errors first
|
|
198
|
+
- Verify component imports
|
|
199
|
+
- Check Tailwind class names
|
|
200
|
+
- Validate API responses
|
|
201
|
+
|
|
202
|
+
### Development Tools
|
|
203
|
+
- Use React DevTools
|
|
204
|
+
- Leverage Vite's HMR
|
|
205
|
+
- Check browser console
|
|
206
|
+
- Use TypeScript strict mode
|
|
207
|
+
|
|
208
|
+
## 📚 Useful Resources
|
|
209
|
+
|
|
210
|
+
### Documentation
|
|
211
|
+
- [React Router v7 Docs](https://reactrouter.com/)
|
|
212
|
+
- [shadcn/ui Components](https://ui.shadcn.com/)
|
|
213
|
+
- [Tailwind CSS v4](https://tailwindcss.com/)
|
|
214
|
+
- [TanStack Table](https://tanstack.com/table)
|
|
215
|
+
- [Recharts](https://recharts.org/)
|
|
216
|
+
|
|
217
|
+
### BlueCopa Specific
|
|
218
|
+
- [@bluecopa/react Package](packages/react:1)
|
|
219
|
+
- BlueCopa Design System
|
|
220
|
+
- API Integration Patterns
|
|
221
|
+
|
|
222
|
+
## 🎯 Best Practices Summary
|
|
223
|
+
|
|
224
|
+
1. **Always use TypeScript** - Define proper interfaces and types
|
|
225
|
+
2. **Follow shadcn/ui patterns** - Use established component structure
|
|
226
|
+
3. **Implement accessibility** - Use semantic HTML and ARIA attributes
|
|
227
|
+
4. **Optimize for performance** - Use proper React patterns and code splitting
|
|
228
|
+
5. **Test thoroughly** - Write tests for components and user workflows
|
|
229
|
+
6. **Handle errors gracefully** - Implement proper error boundaries and fallbacks
|
|
230
|
+
7. **Follow responsive design** - Mobile-first approach with proper breakpoints
|
|
231
|
+
8. **Use proper state management** - Choose appropriate patterns for different data types
|
|
232
|
+
9. **Implement proper loading states** - Show feedback during async operations
|
|
233
|
+
10. **Follow security best practices** - Validate inputs and secure API calls
|
|
234
|
+
|
|
235
|
+
## 🔄 Common Workflows
|
|
236
|
+
|
|
237
|
+
### Adding a New Feature
|
|
238
|
+
1. Create feature branch
|
|
239
|
+
2. Implement components with TypeScript
|
|
240
|
+
3. Add proper styling with Tailwind
|
|
241
|
+
4. Implement responsive design
|
|
242
|
+
5. Add tests
|
|
243
|
+
6. Update documentation
|
|
244
|
+
7. Test in both light and dark modes
|
|
245
|
+
|
|
246
|
+
### Debugging Issues
|
|
247
|
+
1. Check browser console for errors
|
|
248
|
+
2. Verify TypeScript compilation
|
|
249
|
+
3. Test component isolation
|
|
250
|
+
4. Check API responses
|
|
251
|
+
5. Verify responsive behavior
|
|
252
|
+
6. Test accessibility features
|
|
253
|
+
|
|
254
|
+
This guide should help AI assistants and developers work effectively with this BlueCopa React template, ensuring consistent patterns and best practices are followed throughout development.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
FROM node:20-alpine AS development-dependencies-env
|
|
2
|
+
COPY . /app
|
|
3
|
+
WORKDIR /app
|
|
4
|
+
RUN npm ci
|
|
5
|
+
|
|
6
|
+
FROM node:20-alpine AS production-dependencies-env
|
|
7
|
+
COPY ./package.json package-lock.json /app/
|
|
8
|
+
WORKDIR /app
|
|
9
|
+
RUN npm ci --omit=dev
|
|
10
|
+
|
|
11
|
+
FROM node:20-alpine AS build-env
|
|
12
|
+
COPY . /app/
|
|
13
|
+
COPY --from=development-dependencies-env /app/node_modules /app/node_modules
|
|
14
|
+
WORKDIR /app
|
|
15
|
+
RUN npm run build
|
|
16
|
+
|
|
17
|
+
FROM node:20-alpine
|
|
18
|
+
COPY ./package.json package-lock.json /app/
|
|
19
|
+
COPY --from=production-dependencies-env /app/node_modules /app/node_modules
|
|
20
|
+
COPY --from=build-env /app/build /app/build
|
|
21
|
+
WORKDIR /app
|
|
22
|
+
CMD ["npm", "run", "start"]
|
|
@@ -1,263 +1,199 @@
|
|
|
1
|
-
# BlueCopa React App
|
|
1
|
+
# BlueCopa React App with shadcn/ui
|
|
2
2
|
|
|
3
|
-
A production-ready
|
|
3
|
+
A modern, production-ready template for building full-stack React applications using React Router v7 and shadcn/ui components.
|
|
4
4
|
|
|
5
|
-
## 🎨 Design System
|
|
6
5
|
|
|
7
|
-
|
|
8
|
-
- **Navy Blue Header**: Uses the official Bluecopa navy color (`#041e42`) for headers and navigation
|
|
9
|
-
- **Modern Card Layout**: Clean, borderless cards with subtle shadows and consistent padding
|
|
10
|
-
- **Consistent Spacing**: Improved spacing and layout following the latest app design system
|
|
11
|
-
- **User Profile Integration**: Modern user dropdown with avatar, profile information, and logout
|
|
12
|
-
- **Search & Notifications**: Built-in search bar and notification system with Radix UI
|
|
13
|
-
- **Responsive Design**: Mobile-first approach with proper responsive breakpoints and device testing
|
|
6
|
+
## Features
|
|
14
7
|
|
|
15
|
-
|
|
8
|
+
- 🚀 **React Router v7** - Latest React Router with server-side rendering
|
|
9
|
+
- ⚡️ **Hot Module Replacement (HMR)** - Lightning-fast development experience
|
|
10
|
+
- 📦 **Asset bundling and optimization** - Vite-powered build system
|
|
11
|
+
- 🔄 **Data loading and mutations** - Built-in data fetching patterns
|
|
12
|
+
- 🔒 **TypeScript by default** - Full type safety and developer experience
|
|
13
|
+
- 🎨 **shadcn/ui Components** - Beautiful, accessible UI components built on Radix UI
|
|
14
|
+
- 🎉 **TailwindCSS v4** - Latest Tailwind with CSS variables and modern features
|
|
15
|
+
- 📊 **Data Visualization** - Recharts integration for charts and analytics
|
|
16
|
+
- 🗂️ **Data Tables** - TanStack Table with sorting, filtering, and pagination
|
|
17
|
+
- 🎯 **Drag & Drop** - DND Kit integration for interactive interfaces
|
|
18
|
+
- 📱 **Responsive Design** - Mobile-first approach with sidebar navigation
|
|
19
|
+
- 🌙 **Dark Mode** - Built-in theme switching with next-themes
|
|
20
|
+
- 🔗 **BlueCopa API integration** - Pre-configured with `@bluecopa/react` hooks
|
|
21
|
+
- 📖 [React Router docs](https://reactrouter.com/)
|
|
22
|
+
- 🎨 [shadcn/ui docs](https://ui.shadcn.com/)
|
|
16
23
|
|
|
17
|
-
|
|
24
|
+
## Getting Started
|
|
18
25
|
|
|
19
|
-
###
|
|
26
|
+
### Installation
|
|
27
|
+
|
|
28
|
+
Install the dependencies:
|
|
20
29
|
|
|
21
30
|
```bash
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
npm install
|
|
32
|
+
# or
|
|
33
|
+
pnpm install
|
|
34
|
+
```
|
|
24
35
|
|
|
25
|
-
|
|
26
|
-
create-bluecopa-react-app my-dashboard
|
|
36
|
+
**Note:** The application includes TanStack Query integration through the `@bluecopa/react` package for data fetching and caching, along with shadcn/ui components for a modern UI experience.
|
|
27
37
|
|
|
28
|
-
|
|
29
|
-
npx create-bluecopa-react-app my-dashboard
|
|
30
|
-
```
|
|
38
|
+
## Quick Start
|
|
31
39
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
### Prerequisites
|
|
35
|
-
- Node.js 18+
|
|
36
|
-
- npm or pnpm
|
|
37
|
-
- Access to Bluecopa workspace
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
2. **Install dependencies**:
|
|
41
|
-
```bash
|
|
42
|
-
# Recommended: Use pnpm (consistent with monorepo)
|
|
43
|
-
pnpm install
|
|
44
|
-
|
|
45
|
-
# Alternative: Use npm
|
|
46
|
-
npm install
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
3. **Set up environment variables**:
|
|
50
|
-
```bash
|
|
51
|
-
# Automated setup (recommended)
|
|
52
|
-
./setup.sh
|
|
53
|
-
|
|
54
|
-
# Manual setup
|
|
55
|
-
cp .env.example .env.local
|
|
56
|
-
# Edit .env.local with your Bluecopa credentials from dashboard -> Settings -> API Tokens
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
4. **Start development server**:
|
|
60
|
-
```bash
|
|
61
|
-
npm run dev
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
5. **Open your browser**: Navigate to [http://localhost:3000](http://localhost:3000)
|
|
65
|
-
|
|
66
|
-
## ✨ Features
|
|
67
|
-
|
|
68
|
-
### 🎯 Core Capabilities
|
|
69
|
-
- **React 18** with TypeScript
|
|
70
|
-
- **React Router v6** for client-side routing
|
|
71
|
-
- **Vite** for fast development and building
|
|
72
|
-
- **@bluecopa/react** - Complete hook library for Bluecopa APIs
|
|
73
|
-
- **TailwindCSS** - Utility-first CSS framework
|
|
74
|
-
- **Radix UI** - Accessible component primitives
|
|
75
|
-
- **Lucide React** - Beautiful icon library
|
|
76
|
-
- **Recharts** - Composable charting library
|
|
40
|
+
This template is designed to work both as a standalone application and as a microfrontend within the BlueCopa ecosystem. It includes:
|
|
77
41
|
|
|
78
|
-
|
|
79
|
-
- **
|
|
80
|
-
- **
|
|
81
|
-
- **
|
|
82
|
-
- **Responsive design** that works on all devices
|
|
83
|
-
- **Modern React patterns** with functional components and hooks
|
|
84
|
-
|
|
85
|
-
### 📊 Bluecopa Integration
|
|
86
|
-
- **Pre-configured hooks** for user data, metrics, and datasets
|
|
87
|
-
- **Real-time data** fetching with TanStack Query
|
|
88
|
-
- **Error handling** and loading states
|
|
89
|
-
- **Authentication** integration
|
|
90
|
-
- **Type-safe** API responses
|
|
91
|
-
|
|
92
|
-
### 🎨 UI Components
|
|
93
|
-
- **Card layouts** for dashboard sections
|
|
94
|
-
- **Data tables** for displaying datasets
|
|
95
|
-
- **Charts and graphs** for data visualization
|
|
96
|
-
- **Form components** with validation
|
|
97
|
-
- **Navigation** components with routing
|
|
98
|
-
- **Responsive grid** layouts
|
|
99
|
-
|
|
100
|
-
## 📁 Project Structure
|
|
42
|
+
- **Single-spa integration** for microfrontend architecture
|
|
43
|
+
- **Module federation** support for dynamic imports
|
|
44
|
+
- **BlueCopa API integration** with pre-configured hooks
|
|
45
|
+
- **Production-ready** Docker configuration
|
|
101
46
|
|
|
47
|
+
### Development
|
|
48
|
+
|
|
49
|
+
Start the development server with HMR:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm run dev
|
|
102
53
|
```
|
|
103
|
-
src/
|
|
104
|
-
├── components/ # Reusable components
|
|
105
|
-
│ ├── layout/ # Layout components (dashboard-header.tsx, dashboard-layout.tsx, sidebar.tsx)
|
|
106
|
-
│ ├── page/ # Page-specific components (dashboard.tsx)
|
|
107
|
-
│ ├── tables/ # Table components (data-grid.tsx)
|
|
108
|
-
│ └── ui/ # Base UI components (alert.tsx, avatar.tsx, badge.tsx, bluecopa-logo.tsx, button.tsx, card.tsx, dropdown-menu.tsx, input.tsx, label.tsx, select.tsx)
|
|
109
|
-
├── hooks/ # Custom React hooks
|
|
110
|
-
│ └── use-api.ts # Bluecopa API hooks
|
|
111
|
-
├── lib/ # Utility functions
|
|
112
|
-
│ └── utils.ts # Helper functions
|
|
113
|
-
├── pages/ # Route components
|
|
114
|
-
│ ├── Home.tsx # Home page
|
|
115
|
-
│ └── Dashboard.tsx # Dashboard page
|
|
116
|
-
├── providers/ # React context providers
|
|
117
|
-
│ └── query-provider.tsx # TanStack Query provider
|
|
118
|
-
├── types/ # TypeScript type definitions
|
|
119
|
-
│ └── api.ts # API type definitions
|
|
120
|
-
├── App.tsx # Main app component with routing
|
|
121
|
-
├── index.css # Global styles
|
|
122
|
-
├── main.tsx # Application entry point
|
|
123
|
-
├── single-spa.tsx # Single-spa configuration
|
|
124
|
-
└── vite-env.d.ts # Vite environment types
|
|
125
|
-
```
|
|
126
54
|
|
|
127
|
-
|
|
55
|
+
Your application will be available at `http://localhost:8080`.
|
|
56
|
+
|
|
57
|
+
## UI Components
|
|
58
|
+
|
|
59
|
+
This template includes a comprehensive set of shadcn/ui components:
|
|
60
|
+
|
|
61
|
+
### Layout Components
|
|
62
|
+
- **Sidebar** - Collapsible navigation sidebar with mobile support
|
|
63
|
+
- **Sheet** - Slide-out panels for mobile navigation
|
|
64
|
+
- **Drawer** - Bottom drawer for mobile interactions
|
|
65
|
+
|
|
66
|
+
### Form Components
|
|
67
|
+
- **Button** - Multiple variants and sizes
|
|
68
|
+
- **Input** - Text input with validation states
|
|
69
|
+
- **Select** - Dropdown selection with search
|
|
70
|
+
- **Checkbox** - Checkbox with indeterminate state
|
|
71
|
+
- **Label** - Accessible form labels
|
|
72
|
+
|
|
73
|
+
### Data Display
|
|
74
|
+
- **Table** - Sortable, filterable data tables with TanStack Table
|
|
75
|
+
- **Card** - Content containers with header, content, and footer
|
|
76
|
+
- **Badge** - Status indicators and labels
|
|
77
|
+
- **Avatar** - User profile images with fallbacks
|
|
78
|
+
- **Skeleton** - Loading placeholders
|
|
79
|
+
|
|
80
|
+
### Navigation
|
|
81
|
+
- **Tabs** - Tabbed content organization
|
|
82
|
+
- **Breadcrumb** - Navigation breadcrumbs
|
|
83
|
+
- **Dropdown Menu** - Context menus and actions
|
|
84
|
+
- **Tooltip** - Hover information
|
|
85
|
+
|
|
86
|
+
### Feedback
|
|
87
|
+
- **Sonner** - Toast notifications
|
|
88
|
+
- **Separator** - Visual content dividers
|
|
89
|
+
|
|
90
|
+
### Charts
|
|
91
|
+
- **Interactive Charts** - Recharts integration with hover states
|
|
92
|
+
- **Area Charts** - Time series data visualization
|
|
93
|
+
|
|
94
|
+
### Bluecopa API Configuration
|
|
95
|
+
|
|
96
|
+
This application integrates with the Bluecopa API using the `@bluecopa/react` package. To use the `useUser` hook for displaying logged-in user information, set up the following environment variables:
|
|
128
97
|
|
|
129
|
-
|
|
130
|
-
Create a `.env.local` file in the root directory:
|
|
98
|
+
Create a `.env` file in the root directory:
|
|
131
99
|
|
|
132
100
|
```bash
|
|
133
101
|
# Bluecopa API Configuration
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
102
|
+
VITE_BLUECOPA_API_URL=https://develop.bluecopa.com
|
|
103
|
+
VITE_BLUECOPA_WORKSPACE_ID=your_workspace_id_here
|
|
104
|
+
VITE_BLUECOPA_API_TOKEN=your_base64_encoded_token_here
|
|
137
105
|
```
|
|
138
106
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
3. Generate or copy your API token
|
|
143
|
-
4. Note your workspace ID from the URL or settings
|
|
144
|
-
|
|
145
|
-
## 🛠️ Development
|
|
146
|
-
|
|
147
|
-
### Available Scripts
|
|
148
|
-
- `npm run dev` - Start development server
|
|
149
|
-
- `npm run build` - Build for production
|
|
150
|
-
- `npm run preview` - Preview production build
|
|
151
|
-
- `npm run lint` - Run ESLint
|
|
152
|
-
- `npm run type-check` - Run TypeScript compiler
|
|
153
|
-
|
|
154
|
-
### Adding New Routes
|
|
155
|
-
Add new routes in `src/App.tsx`:
|
|
156
|
-
|
|
157
|
-
```tsx
|
|
158
|
-
import { Routes, Route } from 'react-router-dom'
|
|
159
|
-
import NewPage from '@/pages/NewPage'
|
|
160
|
-
|
|
161
|
-
export default function App() {
|
|
162
|
-
return (
|
|
163
|
-
<QueryProvider>
|
|
164
|
-
<Routes>
|
|
165
|
-
<Route path="/" element={<Home />} />
|
|
166
|
-
<Route path="/dashboard" element={<Dashboard />} />
|
|
167
|
-
<Route path="/new-page" element={<NewPage />} />
|
|
168
|
-
</Routes>
|
|
169
|
-
</QueryProvider>
|
|
170
|
-
)
|
|
171
|
-
}
|
|
107
|
+
**Note:** `VITE_BLUECOPA_API_TOKEN` should be a base64-encoded JSON string containing an `accessToken` field, for example:
|
|
108
|
+
```json
|
|
109
|
+
{"accessToken": "your_access_token_here"}
|
|
172
110
|
```
|
|
111
|
+
encoded as base64.
|
|
173
112
|
|
|
174
|
-
|
|
175
|
-
Update the navigation in `src/components/layout/navbar.tsx`:
|
|
113
|
+
If the API errors out or is not configured, the application will show "Set Environment" as the user name with email "setenv@email.com" as a fallback.
|
|
176
114
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
115
|
+
## Building for Production
|
|
116
|
+
|
|
117
|
+
Create a production build:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npm run build
|
|
183
121
|
```
|
|
184
122
|
|
|
185
|
-
##
|
|
123
|
+
## Deployment
|
|
186
124
|
|
|
187
|
-
|
|
125
|
+
### Docker Deployment
|
|
188
126
|
|
|
189
|
-
|
|
190
|
-
import { useUserData, useMetricDataDemo, useDatasetDataDemo } from '@/hooks/use-api'
|
|
127
|
+
To build and run using Docker:
|
|
191
128
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
if (isLoading) return <div>Loading...</div>
|
|
198
|
-
if (error) return <div>Error: {error.message}</div>
|
|
199
|
-
|
|
200
|
-
return <div>Welcome, {userData?.user?.firstName}!</div>
|
|
201
|
-
}
|
|
129
|
+
```bash
|
|
130
|
+
docker build -t my-app .
|
|
131
|
+
|
|
132
|
+
# Run the container
|
|
133
|
+
docker run -p 3000:3000 my-app
|
|
202
134
|
```
|
|
203
135
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
-
|
|
209
|
-
-
|
|
210
|
-
-
|
|
211
|
-
-
|
|
212
|
-
|
|
213
|
-
###
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
},
|
|
228
|
-
},
|
|
229
|
-
}
|
|
136
|
+
The containerized application can be deployed to any platform that supports Docker, including:
|
|
137
|
+
|
|
138
|
+
- AWS ECS
|
|
139
|
+
- Google Cloud Run
|
|
140
|
+
- Azure Container Apps
|
|
141
|
+
- Digital Ocean App Platform
|
|
142
|
+
- Fly.io
|
|
143
|
+
- Railway
|
|
144
|
+
|
|
145
|
+
### DIY Deployment
|
|
146
|
+
|
|
147
|
+
If you're familiar with deploying Node applications, the built-in app server is production-ready.
|
|
148
|
+
|
|
149
|
+
Make sure to deploy the output of `npm run build`
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
├── package.json
|
|
153
|
+
├── package-lock.json (or pnpm-lock.yaml, or bun.lockb)
|
|
154
|
+
├── build/
|
|
155
|
+
│ ├── client/ # Static assets
|
|
156
|
+
│ └── server/ # Server-side code
|
|
230
157
|
```
|
|
231
158
|
|
|
232
|
-
##
|
|
159
|
+
## Adding More Components
|
|
160
|
+
|
|
161
|
+
This template uses shadcn/ui CLI for adding new components. To add additional components:
|
|
233
162
|
|
|
234
|
-
### Build for Production
|
|
235
163
|
```bash
|
|
236
|
-
|
|
164
|
+
# Install shadcn/ui CLI globally
|
|
165
|
+
npm install -g shadcn-ui@latest
|
|
166
|
+
|
|
167
|
+
# Add components
|
|
168
|
+
npx shadcn-ui@latest add [component-name]
|
|
169
|
+
|
|
170
|
+
# Examples
|
|
171
|
+
npx shadcn-ui@latest add dialog
|
|
172
|
+
npx shadcn-ui@latest add alert
|
|
173
|
+
npx shadcn-ui@latest add toast
|
|
237
174
|
```
|
|
238
175
|
|
|
239
|
-
|
|
176
|
+
## Styling
|
|
240
177
|
|
|
241
|
-
|
|
242
|
-
-
|
|
243
|
-
-
|
|
244
|
-
-
|
|
245
|
-
-
|
|
178
|
+
This template comes with [Tailwind CSS v4](https://tailwindcss.com/) configured with:
|
|
179
|
+
- CSS variables for theming
|
|
180
|
+
- Dark mode support with next-themes
|
|
181
|
+
- shadcn/ui design system
|
|
182
|
+
- Custom BlueCopa color palette
|
|
183
|
+
- Responsive design utilities
|
|
246
184
|
|
|
247
|
-
|
|
248
|
-
1. Push your code to GitHub
|
|
249
|
-
2. Connect your repository to Vercel
|
|
250
|
-
3. Set environment variables in Vercel dashboard
|
|
251
|
-
4. Deploy
|
|
185
|
+
## Key Technologies
|
|
252
186
|
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
187
|
+
- **React 18** - Latest React with concurrent features
|
|
188
|
+
- **React Router v7** - Modern routing with SSR support
|
|
189
|
+
- **shadcn/ui** - Accessible component library built on Radix UI
|
|
190
|
+
- **Tailwind CSS v4** - Utility-first CSS framework
|
|
191
|
+
- **TanStack Table** - Headless table library for React
|
|
192
|
+
- **Recharts** - Composable charting library
|
|
193
|
+
- **DND Kit** - Drag and drop toolkit
|
|
194
|
+
- **Lucide React** - Beautiful icon library
|
|
195
|
+
- **TypeScript** - Type safety and developer experience
|
|
257
196
|
|
|
258
|
-
|
|
197
|
+
---
|
|
259
198
|
|
|
260
|
-
|
|
261
|
-
- Use environment variables for all sensitive data
|
|
262
|
-
- Rotate API tokens regularly
|
|
263
|
-
- Use different tokens for development and production
|
|
199
|
+
Built with ❤️ using React Router v7 and shadcn/ui.
|