Data Layer
Overview
Core data management and provider packages for the zopio
framework
Data Layer
The @repo/data
package provides a comprehensive solution for data operations with a standardized interface across different data sources. It serves as the foundation for all data-related functionality in the zopio
framework.
Features
- Unified Interface: Consistent API across all data sources
- Multiple Providers: Support for Supabase, Firebase, REST, GraphQL, and more
- Type Safety: Full TypeScript support with comprehensive type definitions
- React Integration: Hooks and components for seamless React integration
- Schema Validation: Built-in schema definition and validation
- Extensibility: Plugin architecture for custom functionality
- Optimized Performance: Efficient data fetching and caching strategies
Installation
This package is part of the zopio
monorepo and is available to all applications in the workspace.
Package Structure
The data package is organized into three main subpackages:
- Base: Core types, utilities, and base interfaces
- Providers: Data providers that implement the CrudProvider interface
- UI: React components and hooks for working with data
Basic Usage
Creating a Data Provider
Performing CRUD Operations
Using React Hooks
Using UI Components
Detailed Documentation
For more detailed information on using the data package, see the following pages:
- Base Package - Core types, interfaces, and utilities
- Provider System - Available data providers and how to use them
- UI Components - React components and hooks
- Schema System - Schema definition and validation
- Advanced Usage - Advanced techniques and patterns
Environment Variables
Depending on the provider you’re using, you may need to set specific environment variables:
Provider | Variables | Description |
---|---|---|
Supabase | SUPABASE_URL , SUPABASE_KEY | Supabase project URL and API key |
Firebase | FIREBASE_API_KEY , FIREBASE_PROJECT_ID | Firebase API key and project ID |
GraphQL | GRAPHQL_ENDPOINT | GraphQL API endpoint |
API Reference
For a complete API reference, please refer to the TypeScript definitions in the package or explore the detailed documentation pages.