@brickkit/effect 0.0.0-stage → 0.16.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,47 @@
1
- # Temporary Holding Version
1
+ # @brickkit/effect
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Brick built on [Effect](https://effect.website) alone: services, actions, CRUD, events, schedules, webhooks, sockets and tools, with `effect/Schema` for validation and Drizzle's Effect drivers for the database. There is no Elysia, TypeBox or `@brickkit/core` at run time.
4
+
5
+ It keeps the names, routes and error JSON of `@brickkit/core`, so `@brickkit/core/client` and existing frontends work against it. It is a beta (0.16): see the guide for what is not at parity yet.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ bun add @brickkit/effect effect drizzle-orm@1.0.0-rc.6
11
+ bun add @effect/sql-sqlite-bun # SQLite on Bun
12
+ bun add @effect/sql-pg # PostgreSQL
13
+ ```
14
+
15
+ ## Example
16
+
17
+ ```ts
18
+ import { brick, defineService } from "@brickkit/effect";
19
+ import { Effect, Schema } from "effect";
20
+
21
+ const pages = defineService("pages");
22
+
23
+ pages.action({
24
+ name: "get",
25
+ method: "GET",
26
+ input: Schema.Struct({ id: Schema.String }),
27
+ output: Schema.Struct({ id: Schema.String, title: Schema.String }),
28
+ execute: ({ input, error }) =>
29
+ input.id === "home"
30
+ ? Effect.succeed({ id: input.id, title: "Home" })
31
+ : error.NOT_FOUND("No such page"),
32
+ });
33
+
34
+ const app = brick({ services: [pages] });
35
+ app.listen(3000);
36
+ ```
37
+
38
+ ```bash
39
+ curl "localhost:3000/api/pages/get?id=home"
40
+ # {"id":"home","title":"Home"}
41
+ ```
42
+
43
+ Every callback returns an Effect, and `brick({ layer })` gives them the services your app needs.
44
+
45
+ ## Migrating from `@brickkit/core`
46
+
47
+ Read [Migrate to @brickkit/effect](https://brickkit.dev/docs/migrate-to-effect). It has before and after code for each area, and the list of what is not at parity yet.