Skip to content

OfficialMoAdel/workspace

Repository files navigation

πŸš€ Welcome to Z.ai Code Scaffold

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.

✨ Technology Stack

This scaffold provides a robust foundation built with:

🎯 Core Framework

  • ⚑ 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

🧩 UI Components & Styling

  • 🧩 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

πŸ“‹ Forms & Validation

  • 🎣 React Hook Form - Performant forms with easy validation
  • βœ… Zod - TypeScript-first schema validation

πŸ”„ State Management & Data Fetching

  • 🐻 Zustand - Simple, scalable state management
  • πŸ”„ TanStack Query - Powerful data synchronization for React
  • 🌐 Axios - Promise-based HTTP client

πŸ—„οΈ Database & Backend

  • πŸ—„οΈ Prisma - Next-generation Node.js and TypeScript ORM
  • πŸ” NextAuth.js - Complete open-source authentication solution

🎨 Advanced UI Features

  • πŸ“Š 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

🌍 Internationalization & Utilities

  • 🌍 Next Intl - Internationalization library for Next.js
  • πŸ“… Date-fns - Modern JavaScript date utility library
  • πŸͺ ReactUse - Collection of essential React hooks for modern development

🎯 Why This Scaffold?

  • 🏎️ 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

πŸš€ Quick Start

# Install dependencies
npm install

# Start development server
npm run dev

# Build for production
npm run build

# Start production server
npm start

Open http://localhost:3000 to see your application running.

πŸ€– Powered by Z.ai

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!

πŸ“ Project Structure

src/
β”œβ”€β”€ app/                 # Next.js App Router pages
β”œβ”€β”€ components/          # Reusable React components
β”‚   └── ui/             # shadcn/ui components
β”œβ”€β”€ hooks/              # Custom React hooks
└── lib/                # Utility functions and configurations

🎨 Available Features & Components

This scaffold includes a comprehensive set of modern web development tools:

🧩 UI Components (shadcn/ui)

  • 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

πŸ“Š Advanced Data Features

  • 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

🎨 Interactive Features

  • 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

πŸ” Backend Integration

  • 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

🌍 Production Features

  • 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

πŸ“Š Google Sheets Analytics Dashboard

This project includes a comprehensive analytics dashboard that connects to Google Sheets to display token usage and cost analysis. The dashboard features:

🎯 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

πŸ“‹ Data Source

The dashboard reads from a Google Sheet with the following columns:

  • execution_id
  • timestamp
  • workflow_id
  • workflow_name
  • llm_model
  • input_tokens
  • completion_tokens
  • input_price
  • output_price
  • input_cost
  • output_cost
  • total_cost
  • user_id

πŸ”§ Setup Instructions

πŸŽ‰ No API Key Required!

The dashboard now uses Google Sheets' built-in CSV export feature, which means:

  1. 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"
  2. 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
  3. 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:

  1. 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
  2. Configure Environment Variables:

    • Open .env.local file in the project root
    • Add your Google API key:
      GOOGLE_API_KEY=your_actual_api_key_here
      
  3. Update the API route to use the Google Sheets API method (see comments in the code)

πŸš€ Running the Dashboard

# Start development server
npm run dev

# Open http://localhost:3000 to view the dashboard

πŸ”’ Security Notes

  • 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

🎨 Customization

  • Modify the chart colors in src/app/page.tsx by updating the COLORS array
  • 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

🀝 Get Started with Z.ai

  1. Clone this scaffold to jumpstart your project
  2. Visit chat.z.ai to access your AI coding assistant
  3. Start building with intelligent code generation and assistance
  4. Deploy with confidence using the production-ready setup

Built with ❀️ for the developer community. Supercharged by Z.ai πŸš€

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors