public commit

This commit is contained in:
dswbx
2024-11-16 12:01:47 +01:00
commit 90f80c4280
582 changed files with 49291 additions and 0 deletions

20
docs/modules/auth.mdx Normal file
View File

@@ -0,0 +1,20 @@
---
title: 'Auth'
description: 'Easily implement reliable authentication strategies.'
---
Authentication is essential for securing applications, and **bknd** provides a straightforward approach to implementing robust strategies.
### **Core Features**
- Automatically creates a `user` entity, with support for customizable fields.
- Authenticates users based on configurable strategies.
- Generates JWTs according to specified configurations.
- Provides session management for maintaining user authentication state.
### **Supported Authentication Strategies**
- **Email/Password**: Supports plain and SHA-256 password hashing (bcrypt planned for future
releases).
- **OAuth/OIDC**: Works with providers like Google and GitHub.
- Compatible with any specification-compliant provider.
With a focus on flexibility and ease of integration, bknd's authentication system offers the essentials for managing secure user access in your applications.

37
docs/modules/data.mdx Normal file
View File

@@ -0,0 +1,37 @@
---
title: 'Data'
description: 'Define, query, and control your data with ease.'
---
Data is the lifeblood of any application, and **bknd** provides the tools to handle it effortlessly. From defining entities to executing complex queries, bknd offers a developer-friendly, intuitive, and powerful data management experience.
### **Define Your Data**
Model entities with **fields** and **relationships**, automatically synced to your database.
- Supported field types: `primary`, `text`, `number`, `date`, `boolean`, `enum`, `json`, and `jsonschema`.
- Relationship types: `many-to-one`, `one-to-one`, `many-to-many`, and `polymorphic`.
- Add **indices** to enhance database performance: single, compound, and unique indices.
### **Entity Management**
Use the **EntityManager** to simplify handling your entities. Access data efficiently with the **Repository**:
- Select specific properties to return.
- Define sort directions, limits, and offsets.
- Include or join relational data seamlessly within a single query using `with` and joins.
- Apply robust filtering with an extensive `where` object: `$eq`, `$ne`, `$isnull`, `$notnull`, `$in`, `$notin`, `$gt`, `$gte`, `$lt`, `$lte`, `$between`.
### **Seamless Data Manipulation with Mutators**
Create, update, and delete entity data with confidence.
- Validates data against the entity schema.
- (coming soon) Supports relational data with flexible syntax: `$create`, `$set`, `$attach`,
`$detach`.
### **Powerful Event System**
Hook into critical lifecycle events for fine-grained control:
- Repository events: `find-one-before`, `find-one-after`, `find-many-before`, `find-many-after`.
- Mutator events: `insert-before`, `insert-after`, `update-before`, `update-after`, `delete-before`, `delete-after`.
### **Enhanced Database Communication**
The **Connection** class communicates with the database. It's based on kysely, so that it
generally supports multiple database dialects (but currently only SQLite/LibSQL is supported).
Whether you're modeling simple data structures or managing complex relationships, bknd's data tools empower you to build applications with confidence and scalability.

36
docs/modules/flows.mdx Normal file
View File

@@ -0,0 +1,36 @@
---
title: 'Flows'
description: 'Design and run workflows with seamless automation.'
---
<Note>
Flows is the youngest module and its UI is still in development. For the sake of tech preview,
we decided to exclude it from the Admin UI for now. It will be available very soon.
</Note>
**bknd** enables you to automate tasks and processes through flexible and powerful workflows.
### **Core Features**
- **Trigger-Based Executions**:
- **Manual**: Trigger workflows manually.
- **System Events**: Automate workflows based on system events, such as:
- **Data Events**: Entity create, update, or delete.
- **Auth Events**: User sign-in, sign-up, sign-out, or deletion.
- **Media Events**: File uploads or downloads.
- **Server Events**: Before and after request/response handling.
- **HTTP Trigger**: Map workflows to any URL path for external triggers.
- **Custom Event Hooks**: Define and trigger custom events within workflows for tailored automation.
- **Task Management**:
- Define tasks to run in sequence, parallel, or loops.
- Enable conditional task execution based on output results.
- **Execution Modes**:
- **Asynchronous**: Run workflows in the background.
- **Synchronous**: Block further execution until the workflow completes, similar to traditional code execution.
- **Reusable Components**: Create reusable task sequences (sub-workflows) for better organization and efficiency.
- **OpenAPI Specification (OAS) Tasks**: Upload an OpenAPI spec to execute API requests as part of a workflow.

18
docs/modules/media.mdx Normal file
View File

@@ -0,0 +1,18 @@
---
title: 'Media'
description: 'Effortlessly manage and serve all your media files.'
---
**bknd** provides a flexible and efficient way to handle media files, making it easy to upload, manage, and deliver content across various platforms.
### **Core Features**
- **File Uploads**: Supports direct (chunked coming soon) uploads of files up to 5GB (depending
on your environment).
- **Adapter-Based Design**:
- Pre-built support for S3, S3-compatible services (e.g., R2, Tigris), and Cloudinary.
- Extend functionality by implementing custom adapters.
- **Entity Integration**: Attach media files directly to entities for seamless data association.
- **Content Delivery**: Serve media over an API endpoint or directly from your provider.
The media tools are designed to integrate effortlessly into your workflows, offering scalability
and control without added complexity.

49
docs/modules/overview.mdx Normal file
View File

@@ -0,0 +1,49 @@
---
title: 'Overview'
description: 'General overview of the system'
---
This backend system focuses on 4 essential building blocks which can be tightly connected:
Data, Auth, Media and Flows.
The main idea is to supply all baseline functionality required in order to accomplish complex
logic and behaviors instead of hard coding it into the system code. This way, almost any part
of the application is customizable and additionally won't limit you to what it can do.
<CardGroup cols={2}>
<Card
title="Data"
icon={<div className="text-primary-light">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-database"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M12 6m-8 0a8 3 0 1 0 16 0a8 3 0 1 0 -16 0" /><path d="M4 6v6a8 3 0 0 0 16 0v-6" /><path d="M4 12v6a8 3 0 0 0 16 0v-6" /></svg></div>}
href="/modules/data"
>
Define, query, and control your data with ease.
</Card>
<Card
title="Auth"
icon={<div className="text-primary-light">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-fingerprint"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M18.9 7a8 8 0 0 1 1.1 5v1a6 6 0 0 0 .8 3" /><path d="M8 11a4 4 0 0 1 8 0v1a10 10 0 0 0 2 6" /><path d="M12 11v2a14 14 0 0 0 2.5 8" /><path d="M8 15a18 18 0 0 0 1.8 6" /><path d="M4.9 19a22 22 0 0 1 -.9 -7v-1a8 8 0 0 1 12 -6.95" /></svg>
</div>}
href="/modules/auth"
>
Easily implement reliable authentication strategies.
</Card>
<Card
title="Media"
icon={<div className="text-primary-light">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-photo"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M15 8h.01" /><path d="M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12z" /><path d="M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5" /><path d="M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3" /></svg>
</div>}
href="/modules/media"
>
Effortlessly manage and serve all your media files.
</Card>
<Card
title="Flows"
icon={<div className="text-primary-light">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-hierarchy-2"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M10 3h4v4h-4z" /><path d="M3 17h4v4h-4z" /><path d="M17 17h4v4h-4z" /><path d="M7 17l5 -4l5 4" /><path d="M12 7l0 6" /></svg>
</div>}
href="/modules/flows"
>
Design and run workflows with seamless automation.
</Card>
</CardGroup>