collectlie
Version:
TypeScript SDK for Collectlie - flexible data collection platform with custom types, schema validation, and Supabase backend integration
149 lines (107 loc) โข 4.53 kB
Markdown
# Collectlie Documentation
Ultra-minimal TypeScript SDK for flexible user submission platform with Supabase backend integration.
## ๐ Documentation Overview
| Document | Description |
|----------|-------------|
| **[Getting Started](./getting-started.md)** | Installation, setup, and first submission |
| **[API Reference](./api-reference.md)** | Complete API documentation and interfaces |
| **[Testing Guide](./testing.md)** | Testing strategies and setup instructions |
| **[Development Guide](./development.md)** | Architecture and contribution guidelines |
## ๐ Quick Navigation
### Core Features
- ๐ฏ **Ultra-minimal**: Only one method - `submit()`
- ๐ **Universal**: Works in React, vanilla JS, Node.js, any JavaScript environment
- ๐ **Secure**: Built-in API key authentication with environment variable support
- ๐๏ธ **Headless**: You control the UI, we handle the data submission
- โก **TypeScript First**: Full type safety and excellent developer experience
### Examples by Framework
| Framework | Guide | Live Example |
|-----------|-------|--------------|
| **[Vanilla JavaScript](./examples/vanilla-js.md)** | HTML forms, CDN usage | [โ Code](./examples/vanilla-js.md#complete-example) |
| **[React](./examples/react.md)** | Hooks, components, state management | [โ Code](./examples/react.md#feedback-form-component) |
| **[Node.js](./examples/nodejs.md)** | Server-side submissions, API integration | [โ Code](./examples/nodejs.md#basic-server-submission) |
| **[TypeScript](./examples/typescript.md)** | Type safety, custom interfaces | [โ Code](./examples/typescript.md#custom-submission-types) |
### Advanced Topics
| Topic | Description |
|-------|-------------|
| **[Error Handling](./advanced/error-handling.md)** | Comprehensive error handling strategies |
| **[Configuration](./advanced/configuration.md)** | Advanced SDK configuration options |
| **[Best Practices](./advanced/best-practices.md)** | Production patterns and recommendations |
## ๐ฏ Quick Start
```bash
npm install collectlie
```
```javascript
import { Collectlie } from 'collectlie';
const sdk = new Collectlie();
await sdk.submit({
type: 'issue',
title: 'Bug Report',
content: 'Found a bug in the checkout process'
});
```
**[โ Full Getting Started Guide](./getting-started.md)**
## ๐ง Environment Setup
```bash
# .env file
COLLECTLIE_PROJECT_ID=your_project_id_here
COLLECTLIE_API_KEY=proj_your_api_key_here
```
The SDK automatically detects environment variables across different platforms:
- **Node.js**: `COLLECTLIE_*`
- **Vite**: `VITE_COLLECTLIE_*`
- **React**: `REACT_APP_COLLECTLIE_*`
- **Next.js**: `NEXT_PUBLIC_COLLECTLIE_*`
## ๐ API Overview
### Collectlie Class
The ultra-minimal SDK has only one method:
```typescript
class Collectlie {
constructor(config?: CollectlieConfig)
// The only method - submit user data
async submit(data: SubmissionData): Promise<SubmissionApiResponse>
}
```
**[โ Complete API Reference](./api-reference.md)**
## ๐๏ธ Architecture
```
src/
โโโ core/
โ โโโ Collectlie.ts # Main SDK class (only submit method)
โ โโโ http-client.ts # HTTP wrapper with retry logic
โ โโโ utils.ts # Validation and utilities
โโโ types/
โ โโโ feedback.ts # Core submission data types
โ โโโ api.ts # API response types
โ โโโ config.ts # SDK configuration types
โโโ index.ts # Package exports
```
**[โ Development Guide](./development.md)**
## ๐งช Testing
```bash
# Run the simple test runner
node test-runner.js
# Run Jest test suite
npm test
# Test with real API
npm run test:real
```
**[โ Testing Guide](./testing.md)**
## ๐ Platform Support
- **Browsers**: Chrome 60+, Firefox 55+, Safari 12+, Edge 79+
- **Node.js**: 16+ (ES2020+ support)
- **Frameworks**: React, Vue, Angular, Svelte, vanilla JS
- **Bundlers**: Webpack, Vite, Rollup, Parcel
- **Environments**: Web, Node.js, Electron, React Native
## ๐ฆ Bundle Sizes
- **Ultra-minimal SDK**: ~3KB gzipped
- **Zero dependencies** in production builds
## ๐ Support
- [GitHub Issues](https://github.com/collectlie/collectlie/issues)
- Check your `.env` file setup
- Verify API key starts with `proj_`
- Ensure project ID is correct
## ๐ License
MIT
---
**Need help?** Start with the **[Getting Started Guide](./getting-started.md)** or jump to the **[API Reference](./api-reference.md)** for detailed documentation.