Development
Learn how to set up your development environment and contribute to the 0G AI SDK.Prerequisites
Before you begin, ensure you have the following installed:- Node.js (v18 or higher)
- npm, yarn, or pnpm
- TypeScript (v5.0 or higher)
Project Setup
- Clone the repository:
- Install dependencies:
- Build the project:
- Run in development mode:
Project Structure
Building
The project uses TypeScript for compilation:Testing
Run the example files to test functionality:Code Style
The project follows these conventions:- TypeScript: Strict mode enabled
- Naming: PascalCase for classes, camelCase for functions/variables
- Exports: Use named exports for better tree-shaking
- Documentation: JSDoc comments for all public APIs
Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes
- Add tests if applicable
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
API Design Principles
When contributing to the SDK, follow these principles:Consistency
- Use consistent naming patterns across all modules
- Maintain similar parameter structures for related functions
- Follow the established error handling patterns
Simplicity
- Provide sensible defaults for optional parameters
- Keep the public API surface minimal and focused
- Use builder patterns for complex configurations
TypeScript First
- Provide comprehensive type definitions
- Use generics where appropriate for type safety
- Export all necessary types for consumers
Release Process
- Update version in
package.json
- Update
CHANGELOG.md
with new features and fixes - Run
npm run build
to ensure everything compiles - Create a git tag:
git tag v1.x.x
- Push tags:
git push --tags
- Publish to npm:
npm publish
Getting Help
- Check existing GitHub Issues
- Join our Discord Community
- Read the API Documentation