Contributing
Contributing to URPC - guidelines for contributing to the framework and its packages
Getting Started
Thank you for your interest in contributing to URPC! This guide will help you get started with contributing to the project.
Development Setup
-
Fork and clone the repository:
git clone https://github.com/unifi-lab/unify.git cd unify
-
Install dependencies:
bun install
-
Build all packages:
bun run build
Project Structure
URPC is organized as a monorepo with the following packages:
packages/urpc-core
- Core types and interfacespackages/urpc-hono
- Server-side with Honopackages/urpc-next
- Server-side with Next.jspackages/urpc
- Client-side components and URPC Clientpackages/ukit
- UI componentsexamples/
- Example implementationsdocs/
- Documentation website
Contributing Guidelines
Code Style
- Use TypeScript for all code
- Follow the existing code style and conventions
- Include proper type annotations
- Write clear, descriptive variable and function names
Adding New Features
-
Create a new branch:
git checkout -b feature/your-feature-name
-
Make your changes:
- Add new functionality to the appropriate package
- Include comprehensive tests
- Update documentation as needed
-
Test your changes:
bun run test bun run build
-
Submit a pull request:
- Provide a clear description of your changes
- Include examples of how to use the new feature
- Reference any related issues
Adding New Adapters
To add support for a new blockchain or data source:
-
Create a new adapter class:
import { BaseAdapter, FindManyArgs, FindOneArgs } from "@unilab/urpc-core"; class YourAdapter extends BaseAdapter<YourEntity> { async findMany(args: FindManyArgs<YourEntity>): Promise<YourEntity[]> { // Implementation } async findOne(args: FindOneArgs<YourEntity>): Promise<YourEntity | null> { // Implementation } // ... other methods }
-
Add proper TypeScript types:
interface YourEntity { // Define your entity structure }
-
Include comprehensive tests
-
Update documentation with usage examples
Documentation
When contributing:
- Update relevant documentation in the
docs/
directory - Include code examples for new features
- Ensure all public APIs are documented
- Update the changelog for significant changes
Testing
- Write unit tests for new functionality
- Ensure all existing tests pass
- Test with real-world examples when possible
- Include integration tests for new adapters
Pull Request Process
-
Ensure your PR:
- Has a clear title and description
- Includes tests for new functionality
- Updates documentation as needed
- Follows the existing code style
-
PR Review:
- Maintainers will review your PR
- Address any feedback or requested changes
- Ensure CI checks pass
-
Merging:
- PRs will be merged after approval
- Your contribution will be included in the next release
Reporting Issues
When reporting bugs or requesting features:
- Check existing issues first to avoid duplicates
- Provide clear reproduction steps for bugs
- Include relevant code examples
- Specify your environment (Node.js version, OS, etc.)
Community
- Join our discussions on GitHub
- Ask questions in issues or discussions
- Help others by reviewing PRs and answering questions
License
By contributing to Unify, you agree that your contributions will be licensed under the same license as the project.
Relations
Relations in URPC allow you to define connections between different entities using flexible callback functions. This approach enables you to query related data in a single request with complete control over the relation logic.
API Reference
Complete API reference for URPC packages including @unilab/urpc-core, @unilab/urpc-hono, @unilab/urpc, @unilab/urpc-next, @unilab/urpc, and @unilab/uniweb3.