8000 GitHub - Treon-Studio/radas
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Treon-Studio/radas

Repository files navigation

Radas Banner

Radas

A powerful, all-in-one developer toolset revolutionizing workflows for Frontend, Backend, DevOps, and Design teams.
Build production-ready applications in minutes, not hours with automated configuration and best practices.
Generate modern API clients with React Query, Axios, and Zod for type-safe, efficient applications.

简体中文 · Official Site · Changelog · Documents · Blog · Feedback

Table of contents

TOC


👋🏻 Getting Started

Radas CLI is a powerful developer tool that automates API client generation and improves your development workflow. Get started with these simple steps:

# Install Radas CLI
$ go install github.com/Treon-Studio/radas/apps/radas-cli@latest

# Generate API client from OpenAPI spec
$ radas-cli generate --input your-openapi-spec.yaml --output ./src/api

This will generate a complete API client with React Query hooks, Zod validation, and TypeScript types based on your OpenAPI specification.

Example Usage

After generating your API client, you can use it in your React application like this:

// Using the generated React Query hooks
import { useGetUsers, useCreateUser } from './api/hooks';

function UserList() {
  // Fetch users with automatic caching and refetching
  const { data: users, isLoading } = useGetUsers();
  
  // Mutation with optimistic updates
  const { mutate: createUser } = useCreateUser();
  
  // Type-safe data handling with Zod validation
  return (
    <div>
      {isLoading ? 'Loading...' : users.map(user => <UserItem key={user.id} user={user} />)}
      <button onClick={() => createUser({ name: 'New User' })}>Add User</button>
    </div>
  );
}

##  Features

### `1` Modern API Client Generation

Radas CLI generates modern, type-safe API clients from your OpenAPI specifications, eliminating hours of manual coding and configuration. The generated clients feature:

- **Axios Integration**: Reliable HTTP request handling with proper error management
- **Zod Validation**: Runtime type checking and validation for API responses
- **TypeScript Support**: Full type safety throughout your API client
- **Clean Architecture**: Well-organized code structure following best practices
- **Consistent Naming**: Preserves exact operation ID casing from your OpenAPI specification

[![][back-to-top]](#readme-top)

### `2` React Query Integration

Radas CLI seamlessly integrates with React Query to provide a powerful data-fetching experience:

- **Optimized Hooks**: Auto-generated custom hooks for each API endpoint
- **Automatic Caching**: Smart data caching to reduce unnecessary network requests
- **Query Invalidation**: Proper cache invalidation patterns for data consistency
- **No Duplicates**: Intelligent tracking of operations to prevent duplicate function generation
- **Modern Patterns**: Uses React Query v4+ patterns for optimal performance

[![][back-to-top]](#readme-top)

### `3` Type-Safe Validation with Zod

Radas CLI leverages Zod for robust runtime validation and type safety:

- **Schema Validation**: Automatically generated Zod schemas from OpenAPI specifications
- **Runtime Type Checking**: Ensures data integrity between client and server
- **Custom ValidationError Class**: Improved error handling with detailed validation feedback
- **Type Inference**: TypeScript types derived directly from Zod schemas
- **Consistent DTO Types**: Ensures correct data transfer object types throughout the codebase

[![][back-to-top]](#readme-top)

### `4` Zustand Store Generation

Radas CLI automatically generates Zustand stores for efficient state management:

- **Case Preservation**: Maintains exact casing of API function names from the OpenAPI spec
- **Naming Conventions**: Follows consistent patterns like prefixing GET methods with "fetch"
- **Optimized Structure**: Generates compact, efficient store code without unnecessary newlines
- **Parameter Handling**: Properly quotes parameter names with special characters like hyphens
- **API Integration**: Seamless
8000
ly connects generated stores with the API client

[![][back-to-top]](#readme-top)

### `5` OpenAPI Specification Support

Radas CLI works seamlessly with OpenAPI specifications to generate client code:

- **AI-Friendly Format**: Works with OpenAPI specs optimized for code generation
- **Schema Parsing**: Accurately parses and interprets complex OpenAPI schemas
- **Version Support**: Compatible with OpenAPI 3.0+ specifications
- **Custom Extensions**: Supports OpenAPI extensions for enhanced functionality
- **Automatic Type Mapping**: Converts OpenAPI types to appropriate TypeScript types

<div align="right">

[![][back-to-top]](#readme-top)

</div>

### `6` Project Scaffolding

Radas CLI helps you quickly bootstrap new projects with best practices built in:

- **Template Selection**: Choose from various project templates for different use cases
- **Configuration Automation**: Auto-generates configuration files for your tech stack
- **Dependency Management**: Sets up proper package dependencies with appropriate versions
- **File Structure**: Creates an organized project structure following best practices
- **Ready to Run**: Generated projects work out of the box with minimal setup

### `7` Efficient Error Handling

Radas CLI implements robust error handling throughout the generated code:

- **Custom ValidationError Class**: Provides detailed validation feedback for API responses
- **Type-Safe Error Handling**: Strong typing for error objects and responses
- **Contextual Error Messages**: Clear error messages that indicate the source of the problem
- **Graceful Degradation**: Proper fallback mechanisms when API calls fail
- **Debugging Support**: Helpful error information for debugging API integration issues

<div align="right">

[![][back-to-top]](#readme-top)

</div>

### `8` Optimistic Updates

Radas CLI generates code with optimistic update patterns for a responsive user experience:

- **Immediate UI Updates**: Interface updates instantly before server confirmation
- **Context Typing**: Proper TypeScript typing for optimistic update contexts
- **Rollback Handling**: Automatic rollback mechanisms if server requests fail
- **Cache Management**: Smart cache updates that maintain consistency
- **Query Invalidation**: Proper invalidation of related queries after mutations
<div align="right">

[![][back-to-top]](#readme-top)

</div>

## ⌨️ Local Development

You can clone the repository for local development:

```bash
$ git clone https://github.com/Treon-Studio/radas.git
$ cd radas
$ cd apps/radas-cli
$ go build

🤝 Contributing

Contributions to the Radas CLI tool are welcome! Whether it's bug reports, feature requests, or code contributions, your help is appreciated.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

For more details, please refer to the CONTRIBUTING.md file.

📄 License

The Radas CLI tool is licensed under the Apache License 2.0. See the LICENSE file for more details.


Made with ❤️ by Treon Studio


📚 Documentation

For more detailed documentation on how to use the Radas CLI, please visit our documentation site.

🧩 Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

Distributed under the Apache License 2.0. See LICENSE for more information.


Made with ❤️ by Treon Studio

🤝 Contributing

Contributions of all types are more than welcome; if you are interested in contributing code, feel free to check out our GitRadasHub Issues and Projects to get stuck in to show us what you're made of.

📄 License

Tip

We are creating a technology-driven forum, fostering knowledge interaction and the exchange of ideas that may culminate in mutual inspiration and collaborative innovation.

Help us make RadasChat better. Welcome to provide product design feedback, user experience discussions directly to us.

Principal Maintainers: @arvinxx @canisminor1990




🔗 More Products

  • 🅰️ Munaqadh: Modern theme for Stable Diffusion WebUI, exquisite interface design, highly customizable UI, and efficiency-boosting features.
  • ⛵️ Klola: WebUI for Midjourney, leverages AI to quickly generate a wide array of rich and diverse images from text prompts, sparking creativity and enhancing conversations.
  • 🌏 Dokukita : Radas i18n is an automation tool for the i18n (internationalization) translation process, powered by ChatGPT. It supports features such as automatic splitting of large files, incremental updates, and customization options for the OpenAI model, API proxy, and temperature.
  • 💌 Palsu: Radas Commit is a CLI tool that leverages Langchain/ChatGPT to generate Gitmoji-based commit messages.


📝 License

Copyright © 2025 RadasRadasHub.
This project is Apache 2.0 licensed.

0