Skip to content

Commit 28f6cf7

Browse files
committed
feat: Enhance documentation across all packages with detailed features, installation instructions, and usage examples
1 parent eec6547 commit 28f6cf7

File tree

10 files changed

+695
-33
lines changed

10 files changed

+695
-33
lines changed

README.md

Lines changed: 66 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,80 @@
11
# Mixcore JavaScript SDK
22

3-
This monorepo contains modular, framework-agnostic packages for Mixcore projects.
3+
![Mixcore Logo](https://mixcore.net/images/logo.svg)
4+
5+
Modular, framework-agnostic SDK for Mixcore projects. Built with TypeScript and distributed as ESM/CJS modules.
6+
7+
## Features
8+
9+
- **Modular architecture**: Import only what you need
10+
- **TypeScript-first**: Full type safety and autocompletion
11+
- **Framework-agnostic**: Works with any JavaScript framework
12+
- **Production-ready**: Well-tested and documented
413

514
## Packages
615

7-
- **@mixcore/shared**: Utilities, helpers, constants
8-
- **@mixcore/base**: Base classes, abstract models, interfaces
9-
- **@mixcore/apis**: API clients, endpoint wrappers, schema types
16+
| Package | Description |
17+
|--------|-------------|
18+
| [@mixcore/shared](packages/shared) | Shared utilities, helpers and constants |
19+
| [@mixcore/base](packages/base) | Base classes, abstract models and interfaces |
20+
| [@mixcore/api](packages/api) | API clients and endpoint wrappers |
21+
| [@mixcore/config](packages/config) | Configuration management |
22+
| [@mixcore/database](packages/database) | Database domain services |
23+
| [@mixcore/file](packages/file) | File handling utilities |
24+
| [@mixcore/user](packages/user) | User/auth services |
25+
| [@mixcore/template](packages/template) | Template rendering services |
1026

1127
## Getting Started
1228

13-
Each package contains its own README with usage examples. See `/packages/*/README.md` for details.
29+
### Installation
30+
31+
```bash
32+
npm install @mixcore/api @mixcore/database # or whichever packages you need
33+
```
34+
35+
### Usage Example
36+
37+
```typescript
38+
import { ApiService } from '@mixcore/api';
39+
import { ModuleDataService } from '@mixcore/database';
40+
41+
const api = new ApiService({ apiBaseUrl: 'https://api.mixcore.net' });
42+
const dataService = new ModuleDataService({ api });
43+
44+
// Use services...
45+
```
1446

1547
## Development
1648

17-
- All code is TypeScript-first.
18-
- Build outputs: ESM, CJS, and type declarations.
19-
- Tests: Run `npm test` or `yarn test` from the root.
49+
### Prerequisites
50+
51+
- Node.js 18+
52+
- pnpm
53+
54+
### Setup
55+
56+
```bash
57+
git clone https://github.com/mixcore/javascript-sdk.git
58+
cd javascript-sdk
59+
pnpm install
60+
```
61+
62+
### Building
63+
64+
```bash
65+
pnpm build
66+
```
67+
68+
### Testing
69+
70+
```bash
71+
pnpm test
72+
```
73+
74+
## Contributing
75+
76+
Contributions welcome! Please see our [Contribution Guidelines](CONTRIBUTING.md).
2077

2178
## License
2279

23-
Mixcore Community License (MCL) or compatible OSS license. See LICENSE file for details.
80+
Mixcore Community License (MCL). See [LICENSE](LICENSE) for details.

packages/api/README.md

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,83 @@
11
# @mixcore/api
22

3-
API clients and endpoint wrappers for Mixcore SDK.
3+
API clients and endpoint wrappers for Mixcore SDK. Provides typed HTTP clients for interacting with Mixcore APIs.
4+
5+
## Features
6+
7+
- Typed API client with configurable base URL
8+
- Automatic request/response serialization
9+
- Built-in error handling
10+
- Support for authentication headers
11+
- Promise-based async operations
12+
13+
## Installation
14+
15+
```bash
16+
npm install @mixcore/api
17+
# or
18+
pnpm add @mixcore/api
19+
```
20+
21+
## Usage
22+
23+
### Basic Example
24+
25+
```typescript
26+
import { ApiService } from '@mixcore/api';
27+
28+
const api = new ApiService({
29+
apiBaseUrl: 'https://api.mixcore.net',
30+
apiKey: 'your-api-key' // optional
31+
});
32+
33+
// Make API requests
34+
const response = await api.get('/some-endpoint');
35+
```
36+
37+
### Configuration Options
38+
39+
| Option | Type | Description |
40+
|--------|------|-------------|
41+
| apiBaseUrl | string | Base URL for API requests |
42+
| apiKey? | string | API key for authentication |
43+
| timeout? | number | Request timeout in ms |
44+
45+
### Authentication
46+
47+
```typescript
48+
// With API key
49+
const api = new ApiService({
50+
apiBaseUrl: 'https://api.mixcore.net',
51+
apiKey: 'your-api-key-here'
52+
});
53+
54+
// Requests will include Authorization: Bearer header
55+
```
56+
57+
## Error Handling
58+
59+
The API client throws structured errors for:
60+
61+
- Network failures
62+
- Invalid responses (non-2xx status codes)
63+
- Timeouts
64+
65+
```typescript
66+
try {
67+
await api.get('/some-endpoint');
68+
} catch (error) {
69+
console.error('API request failed:', error.message);
70+
if (error.response) {
71+
console.error('Status:', error.response.status);
72+
}
73+
}
74+
```
75+
76+
## Related Packages
77+
78+
- [@mixcore/database](https://github.com/mixcore/javascript-sdk/tree/main/packages/database): Database services using this API client
79+
- [@mixcore/base](https://github.com/mixcore/javascript-sdk/tree/main/packages/base): Base service classes
80+
81+
## License
82+
83+
Mixcore Community License (MCL). See [LICENSE](../../LICENSE) for details.

packages/base/README.md

Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,81 @@
1-
21
# @mixcore/base
32

4-
Mixcore SDK base abstractions. Provides core TypeScript classes and interfaces for all SDK packages, including `BaseService` and `BaseRestService`.
3+
Mixcore SDK base abstractions. Provides core TypeScript classes and interfaces for all SDK packages.
4+
5+
## Features
6+
7+
- **BaseService**: Abstract service class with common functionality
8+
- **BaseRestService**: REST API client base class
9+
- **Injectable configuration**: Flexible service configuration
10+
- **Framework-agnostic**: No UI/SPA dependencies
11+
12+
## Installation
13+
14+
```bash
15+
npm install @mixcore/base
16+
# or
17+
pnpm add @mixcore/base
18+
```
519

620
## Usage
721

8-
```ts
22+
### Extending BaseService
23+
24+
```typescript
25+
import { BaseService } from '@mixcore/base';
26+
27+
class MyService extends BaseService {
28+
constructor(config: MyConfig) {
29+
super(config);
30+
}
31+
32+
async getData() {
33+
return this.execute(() => {
34+
// Your implementation
35+
});
36+
}
37+
}
38+
```
39+
40+
### Using BaseRestService
41+
42+
```typescript
943
import { BaseRestService } from '@mixcore/base';
44+
45+
class MyRestService extends BaseRestService {
46+
constructor(baseUrl: string) {
47+
super({ apiBaseUrl: baseUrl });
48+
}
49+
50+
async fetchItems() {
51+
return this.get('/items');
52+
}
53+
}
1054
```
1155

12-
## Features
13-
- Abstract base classes for REST and service logic
14-
- Injectable configuration
15-
- No SPA/UI dependencies
56+
## API Reference
57+
58+
### BaseService
59+
60+
| Method | Description |
61+
|--------|-------------|
62+
| `execute(fn)` | Wraps operations with error handling |
63+
| `getConfig()` | Returns current configuration |
64+
65+
### BaseRestService
66+
67+
| Method | Description |
68+
|--------|-------------|
69+
| `get(path)` | Makes GET request |
70+
| `post(path, data)` | Makes POST request |
71+
| `put(path, data)` | Makes PUT request |
72+
| `delete(path)` | Makes DELETE request |
73+
74+
## Related Packages
75+
76+
- [@mixcore/api](https://github.com/mixcore/javascript-sdk/tree/main/packages/api): API client implementation
77+
- [@mixcore/database](https://github.com/mixcore/javascript-sdk/tree/main/packages/database): Database services extending these base classes
1678

1779
## License
18-
SEE LICENSE IN LICENSE
80+
81+
Mixcore Community License (MCL). See [LICENSE](../../LICENSE) for details.

packages/config/README.md

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,79 @@
11
# @mixcore/config
22

3-
Configuration domain services and types for Mixcore SDK.
3+
Configuration management services for Mixcore SDK. Provides loading, validation and access to application configuration.
4+
5+
## Features
6+
7+
- Load configuration from multiple sources (files, env vars, etc.)
8+
- Type-safe configuration access
9+
- Schema validation
10+
- Environment variable support
11+
- Hot-reloading for development
12+
13+
## Installation
14+
15+
```bash
16+
npm install @mixcore/config
17+
# or
18+
pnpm add @mixcore/config
19+
```
20+
21+
## Usage
22+
23+
### Basic Example
24+
25+
```typescript
26+
import { ConfigurationServices } from '@mixcore/config';
27+
28+
const configService = new ConfigurationServices();
29+
30+
// Load config from default location
31+
const config = await configService.loadConfiguration();
32+
33+
// Access config values
34+
console.log(config.apiBaseUrl);
35+
```
36+
37+
### Custom Configuration Path
38+
39+
```typescript
40+
const config = await configService.loadConfiguration('/path/to/config.json');
41+
```
42+
43+
### Environment Variables
44+
45+
Configuration values can be overridden by environment variables prefixed with `MIXCORE_`:
46+
47+
```bash
48+
MIXCORE_API_BASE_URL=https://api.mixcore.net npm start
49+
```
50+
51+
## Configuration Schema
52+
53+
The expected configuration format:
54+
55+
```typescript
56+
interface AppConfig {
57+
apiBaseUrl: string;
58+
apiKey?: string;
59+
debug?: boolean;
60+
// ...other app-specific settings
61+
}
62+
```
63+
64+
## API Reference
65+
66+
| Method | Description |
67+
|--------|-------------|
68+
| `loadConfiguration(path?)` | Loads and validates config |
69+
| `getConfig()` | Returns current config |
70+
| `watchForChanges()` | Enables hot-reloading |
71+
72+
## Related Packages
73+
74+
- [@mixcore/api](https://github.com/mixcore/javascript-sdk/tree/main/packages/api): API client using this config
75+
- [@mixcore/base](https://github.com/mixcore/javascript-sdk/tree/main/packages/base): Base service classes
76+
77+
## License
78+
79+
Mixcore Community License (MCL). See [LICENSE](../../LICENSE) for details.

packages/database/README.md

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,52 @@
11
# @mixcore/database
22

3-
Database domain services and types for Mixcore SDK.
3+
Database domain services and types for Mixcore SDK. Provides data access, querying, and persistence services.
4+
5+
## Features
6+
7+
- REST API clients for Mixcore database operations
8+
- TypeScript interfaces for database models
9+
- Data validation and transformation
10+
- Modular service architecture
11+
12+
## Installation
13+
14+
```bash
15+
npm install @mixcore/database
16+
# or
17+
pnpm add @mixcore/database
18+
```
19+
20+
## Usage
21+
22+
### Basic Example
23+
24+
```typescript
25+
import { ModuleDataService } from '@mixcore/database';
26+
import { ApiService } from '@mixcore/api';
27+
28+
const api = new ApiService({ apiBaseUrl: 'https://api.mixcore.net' });
29+
const dataService = new ModuleDataService({ api });
30+
31+
// Fetch data items
32+
const result = await dataService.fetchDataItems('module-id');
33+
```
34+
35+
### Services
36+
37+
- `ModuleDataService`: Core data operations
38+
- `MixDatabaseDataRestPortalService`: Portal-specific data services
39+
- `RelatedAttributeDataRestPortalService`: Related attribute services
40+
41+
## API Reference
42+
43+
See [API Documentation](API.md) for detailed method signatures and types.
44+
45+
## Related Packages
46+
47+
- [@mixcore/api](https://github.com/mixcore/javascript-sdk/tree/main/packages/api): API client foundation
48+
- [@mixcore/base](https://github.com/mixcore/javascript-sdk/tree/main/packages/base): Base service classes
49+
50+
## License
51+
52+
Mixcore Community License (MCL). See [LICENSE](../../LICENSE) for details.

0 commit comments

Comments
 (0)