A modern, production-ready web application scaffold powered by cutting-edge technologies, designed to accelerate your development with Z.ai's AI-powered coding assistance.
This scaffold provides a robust foundation built with:
- β‘ Next.js 15 - The React framework for production with App Router
- π TypeScript 5 - Type-safe JavaScript for better developer experience
- π¨ Tailwind CSS 4 - Utility-first CSS framework for rapid UI development
- π§© shadcn/ui - High-quality, accessible components built on Radix UI
- π― Lucide React - Beautiful & consistent icon library
- π Framer Motion - Production-ready motion library for React
- π¨ Next Themes - Perfect dark mode in 2 lines of code
- π£ React Hook Form - Performant forms with easy validation
- β Zod - TypeScript-first schema validation
- π» Zustand - Simple, scalable state management
- π TanStack Query - Powerful data synchronization for React
- π Axios - Promise-based HTTP client
- ποΈ Prisma - Next-generation Node.js and TypeScript ORM
- π NextAuth.js - Complete open-source authentication solution
- π TanStack Table - Headless UI for building tables and datagrids
- π±οΈ DND Kit - Modern drag and drop toolkit for React
- π Recharts - Redefined chart library built with React and D3
- πΌοΈ Sharp - High performance image processing
- π Next Intl - Internationalization library for Next.js
- π Date-fns - Modern JavaScript date utility library
- πͺ ReactUse - Collection of essential React hooks for modern development
- ποΈ Fast Development - Pre-configured tooling and best practices
- π¨ Beautiful UI - Complete shadcn/ui component library with advanced interactions
- π Type Safety - Full TypeScript configuration with Zod validation
- π± Responsive - Mobile-first design principles with smooth animations
- ποΈ Database Ready - Prisma ORM configured for rapid backend development
- π Auth Included - NextAuth.js for secure authentication flows
- π Data Visualization - Charts, tables, and drag-and-drop functionality
- π i18n Ready - Multi-language support with Next Intl
- π Production Ready - Optimized build and deployment settings
- π€ AI-Friendly - Structured codebase perfect for AI assistance
# Install dependencies
npm install
# Start development server
npm run dev
# Build for production
npm run build
# Start production server
npm startOpen http://localhost:3000 to see your application running.
This scaffold is optimized for use with Z.ai - your AI assistant for:
- π» Code Generation - Generate components, pages, and features instantly
- π¨ UI Development - Create beautiful interfaces with AI assistance
- π§ Bug Fixing - Identify and resolve issues with intelligent suggestions
- π Documentation - Auto-generate comprehensive documentation
- π Optimization - Performance improvements and best practices
Ready to build something amazing? Start chatting with Z.ai at chat.z.ai and experience the future of AI-powered development!
src/
βββ app/ # Next.js App Router pages
βββ components/ # Reusable React components
β βββ ui/ # shadcn/ui components
βββ hooks/ # Custom React hooks
βββ lib/ # Utility functions and configurations
This scaffold includes a comprehensive set of modern web development tools:
- Layout: Card, Separator, Aspect Ratio, Resizable Panels
- Forms: Input, Textarea, Select, Checkbox, Radio Group, Switch
- Feedback: Alert, Toast (Sonner), Progress, Skeleton
- Navigation: Breadcrumb, Menubar, Navigation Menu, Pagination
- Overlay: Dialog, Sheet, Popover, Tooltip, Hover Card
- Data Display: Badge, Avatar, Calendar
- Tables: Powerful data tables with sorting, filtering, pagination (TanStack Table)
- Charts: Beautiful visualizations with Recharts
- Forms: Type-safe forms with React Hook Form + Zod validation
- Animations: Smooth micro-interactions with Framer Motion
- Drag & Drop: Modern drag-and-drop functionality with DND Kit
- Theme Switching: Built-in dark/light mode support
- Authentication: Ready-to-use auth flows with NextAuth.js
- Database: Type-safe database operations with Prisma
- API Client: HTTP requests with Axios + TanStack Query
- State Management: Simple and scalable with Zustand
- Internationalization: Multi-language support with Next Intl
- Image Optimization: Automatic image processing with Sharp
- Type Safety: End-to-end TypeScript with Zod validation
- Essential Hooks: 100+ useful React hooks with ReactUse for common patterns
This project includes a comprehensive analytics dashboard that connects to Google Sheets to display token usage and cost analysis. The dashboard features:
- Real-time Metrics: Total tokens, costs, executions, and active models
- Interactive Charts:
- Pie chart showing token distribution by LLM model
- Bar chart comparing tokens vs costs
- Line chart displaying trends over time
- Data Table: Detailed execution records with sorting and filtering
- Auto-refresh: Automatically syncs with Google Sheets every 15 minutes
- Responsive Design: Works seamlessly on desktop and mobile devices
The dashboard reads from a Google Sheet with the following columns:
execution_idtimestampworkflow_idworkflow_namellm_modelinput_tokenscompletion_tokensinput_priceoutput_priceinput_costoutput_costtotal_costuser_id
π No API Key Required!
The dashboard now uses Google Sheets' built-in CSV export feature, which means:
-
Make your Google Sheet public:
- Open your Google Sheet
- Click "Share" in the top right corner
- Under "General access", select "Anyone with the link"
- Set the role to "Viewer"
- Click "Done"
-
Update Sheet ID (if needed):
- The default sheet ID is configured for:
1Mzb4S2hI4nWQn8I7ysU4E-C6V8Uz2zF1R2j2bWe0F0k - To use a different sheet, update the ID in
src/app/api/google-sheets/route.ts
- The default sheet ID is configured for:
-
That's it! The dashboard will automatically:
- Fetch data from your public Google Sheet
- Parse the CSV data
- Display real-time analytics
- Auto-refresh every 15 minutes
π§ Alternative: Using API Key (Optional)
If you prefer to use the Google Sheets API instead of CSV export:
-
Get Google API Key:
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the "Google Sheets API"
- Create an API key in the credentials section
- Copy the API key
-
Configure Environment Variables:
- Open
.env.localfile in the project root - Add your Google API key:
GOOGLE_API_KEY=your_actual_api_key_here
- Open
-
Update the API route to use the Google Sheets API method (see comments in the code)
# Start development server
npm run dev
# Open http://localhost:3000 to view the dashboard- The CSV export method is secure and doesn't require API keys
- Make sure your Google Sheet only contains public data
- For sensitive data, consider using the API key method with proper authentication
- Never commit sensitive API keys to version control
- Consider implementing rate limiting and caching for better performance
- Modify the chart colors in
src/app/page.tsxby updating theCOLORSarray - Add new metrics by extending the data processing logic
- Customize the UI by modifying the shadcn/ui components
- Add additional tabs or charts as needed
- Clone this scaffold to jumpstart your project
- Visit chat.z.ai to access your AI coding assistant
- Start building with intelligent code generation and assistance
- Deploy with confidence using the production-ready setup
Built with β€οΈ for the developer community. Supercharged by Z.ai π