History

init effect solutions

Rhys Sullivan committed 7 months ago

Commit c78d00fNo parent (first commit)13 files · +279 −0Browse files

Unified · Split

13 files
  1. .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc +1 −0
  2. .gitignore +34 −0
  3. .reference/effect +1 −0
  4. .reference/effect-atom +1 −0
  5. .reference/executor +1 −0
  6. .vscode/settings.json +4 −0
  7. AGENTS.md +1 −0
  8. CLAUDE.md +125 −0
  9. README.md +15 −0
  10. bun.lock +40 −0
  11. index.ts +1 −0
  12. package.json +20 −0
  13. tsconfig.json +35 −0
.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc+1−0
@@ -0,0 +1 @@
1+../../CLAUDE.md
.gitignore+34−0
@@ -0,0 +1,34 @@
1+# dependencies (bun install)
2+node_modules
3+
4+# output
5+out
6+dist
7+*.tgz
8+
9+# code coverage
10+coverage
11+*.lcov
12+
13+# logs
14+logs
15+_.log
16+report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
17+
18+# dotenv environment variable files
19+.env
20+.env.development.local
21+.env.test.local
22+.env.production.local
23+.env.local
24+
25+# caches
26+.eslintcache
27+.cache
28+*.tsbuildinfo
29+
30+# IntelliJ based IDEs
31+.idea
32+
33+# Finder (MacOS) folder config
34+.DS_Store
.reference/effect+1−0
@@ -0,0 +1 @@
1+Subproject commit ec5c50507b1a2f5ad712c148a7da0fadb8cb9f52
.reference/effect-atom+1−0
@@ -0,0 +1 @@
1+Subproject commit 957095fdfc930eae666f78d65f7af8584959bffd
.reference/executor+1−0
@@ -0,0 +1 @@
1+Subproject commit 2d532f8322368eedc835fa09dc9223a9ddef9e1d
.vscode/settings.json+4−0
@@ -0,0 +1,4 @@
1+{
2+ "typescript.tsdk": "./node_modules/typescript/lib",
3+ "typescript.enablePromptUseWorkspaceTsdk": true
4+}
AGENTS.md+1−0
@@ -0,0 +1 @@
1+CLAUDE.md
CLAUDE.md+125−0
@@ -0,0 +1,125 @@
1+---
2+description: Use Bun instead of Node.js, npm, pnpm, or vite.
3+globs: "*.ts, *.tsx, *.html, *.css, *.js, *.jsx, package.json"
4+alwaysApply: false
5+---
6+
7+Default to using Bun instead of Node.js.
8+
9+- Use `bun <file>` instead of `node <file>` or `ts-node <file>`
10+- Use `bun test` instead of `jest` or `vitest`
11+- Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
12+- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
13+- Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
14+- Use `bunx <package> <command>` instead of `npx <package> <command>`
15+- Bun automatically loads .env, so don't use dotenv.
16+
17+## APIs
18+
19+- `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
20+- `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
21+- `Bun.redis` for Redis. Don't use `ioredis`.
22+- `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
23+- `WebSocket` is built-in. Don't use `ws`.
24+- Prefer `Bun.file` over `node:fs`'s readFile/writeFile
25+- Bun.$`ls` instead of execa.
26+
27+## Testing
28+
29+Use `bun test` to run tests.
30+
31+```ts#index.test.ts
32+import { test, expect } from "bun:test";
33+
34+test("hello world", () => {
35+ expect(1).toBe(1);
36+});
37+```
38+
39+## Frontend
40+
41+Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.
42+
43+Server:
44+
45+```ts#index.ts
46+import index from "./index.html"
47+
48+Bun.serve({
49+ routes: {
50+ "/": index,
51+ "/api/users/:id": {
52+ GET: (req) => {
53+ return new Response(JSON.stringify({ id: req.params.id }));
54+ },
55+ },
56+ },
57+ // optional websocket support
58+ websocket: {
59+ open: (ws) => {
60+ ws.send("Hello, world!");
61+ },
62+ message: (ws, message) => {
63+ ws.send(message);
64+ },
65+ close: (ws) => {
66+ // handle close
67+ }
68+ },
69+ development: {
70+ hmr: true,
71+ console: true,
72+ }
73+})
74+```
75+
76+HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle.
77+
78+```html#index.html
79+<html>
80+ <body>
81+ <h1>Hello, world!</h1>
82+ <script type="module" src="./frontend.tsx"></script>
83+ </body>
84+</html>
85+```
86+
87+With the following `frontend.tsx`:
88+
89+```tsx#frontend.tsx
90+import React from "react";
91+import { createRoot } from "react-dom/client";
92+
93+// import .css files directly and it works
94+import './index.css';
95+
96+const root = createRoot(document.body);
97+
98+export default function Frontend() {
99+ return <h1>Hello, world!</h1>;
100+}
101+
102+root.render(<Frontend />);
103+```
104+
105+Then, run index.ts
106+
107+```sh
108+bun --hot ./index.ts
109+```
110+
111+For more information, read the Bun API docs in `node_modules/bun-types/docs/**.mdx`.
112+
113+<!-- effect-solutions:start -->
114+## Effect Best Practices
115+
116+**IMPORTANT:** Always consult effect-solutions before writing Effect code.
117+
118+1. Run `effect-solutions list` to see available guides
119+2. Run `effect-solutions show <topic>...` for relevant patterns (supports multiple topics)
120+3. Search `~/.local/share/effect-solutions/effect` for real implementations
121+
122+Topics: quick-start, project-setup, tsconfig, basics, services-and-layers, data-modeling, error-handling, config, testing, cli.
123+
124+Never guess at Effect patterns - check the guide first.
125+<!-- effect-solutions:end -->
README.md+15−0
@@ -0,0 +1,15 @@
1+# v4-executor
2+
3+To install dependencies:
4+
5+```bash
6+bun install
7+```
8+
9+To run:
10+
11+```bash
12+bun run index.ts
13+```
14+
15+This project was created using `bun init` in bun v1.3.9. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
bun.lock+40−0
@@ -0,0 +1,40 @@
1+{
2+ "lockfileVersion": 1,
3+ "configVersion": 1,
4+ "workspaces": {
5+ "": {
6+ "name": "v4-executor",
7+ "dependencies": {
8+ "effect": "^3.21.0",
9+ },
10+ "devDependencies": {
11+ "@effect/language-service": "^0.84.2",
12+ "@types/bun": "latest",
13+ },
14+ "peerDependencies": {
15+ "typescript": "^5",
16+ },
17+ },
18+ },
19+ "packages": {
20+ "@effect/language-service": ["@effect/language-service@0.84.2", "", { "bin": { "effect-language-service": "cli.js" } }, "sha512-l04qNxpiA8rY5yXWckRPJ7Mk5MNerXuNymSFf+IdflfI5i8jgL1bpBNLuP6ijg7wgjdHc/KmTnCj2kT0SCntuA=="],
21+
22+ "@standard-schema/spec": ["@standard-schema/spec@1.1.0", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="],
23+
24+ "@types/bun": ["@types/bun@1.3.11", "", { "dependencies": { "bun-types": "1.3.11" } }, "sha512-5vPne5QvtpjGpsGYXiFyycfpDF2ECyPcTSsFBMa0fraoxiQyMJ3SmuQIGhzPg2WJuWxVBoxWJ2kClYTcw/4fAg=="],
25+
26+ "@types/node": ["@types/node@25.5.0", "", { "dependencies": { "undici-types": "~7.18.0" } }, "sha512-jp2P3tQMSxWugkCUKLRPVUpGaL5MVFwF8RDuSRztfwgN1wmqJeMSbKlnEtQqU8UrhTmzEmZdu2I6v2dpp7XIxw=="],
27+
28+ "bun-types": ["bun-types@1.3.11", "", { "dependencies": { "@types/node": "*" } }, "sha512-1KGPpoxQWl9f6wcZh57LvrPIInQMn2TQ7jsgxqpRzg+l0QPOFvJVH7HmvHo/AiPgwXy+/Thf6Ov3EdVn1vOabg=="],
29+
30+ "effect": ["effect@3.21.0", "", { "dependencies": { "@standard-schema/spec": "^1.0.0", "fast-check": "^3.23.1" } }, "sha512-PPN80qRokCd1f015IANNhrwOnLO7GrrMQfk4/lnZRE/8j7UPWrNNjPV0uBrZutI/nHzernbW+J0hdqQysHiSnQ=="],
31+
32+ "fast-check": ["fast-check@3.23.2", "", { "dependencies": { "pure-rand": "^6.1.0" } }, "sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A=="],
33+
34+ "pure-rand": ["pure-rand@6.1.0", "", {}, "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA=="],
35+
36+ "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
37+
38+ "undici-types": ["undici-types@7.18.2", "", {}, "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w=="],
39+ }
40+}
index.ts+1−0
@@ -0,0 +1 @@
1+console.log("Hello via Bun!");
package.json+20−0
@@ -0,0 +1,20 @@
1+{
2+ "name": "v4-executor",
3+ "module": "index.ts",
4+ "type": "module",
5+ "private": true,
6+ "scripts": {
7+ "prepare": "effect-language-service patch",
8+ "typecheck": "tsc --noEmit"
9+ },
10+ "devDependencies": {
11+ "@effect/language-service": "^0.84.2",
12+ "@types/bun": "latest"
13+ },
14+ "peerDependencies": {
15+ "typescript": "^5"
16+ },
17+ "dependencies": {
18+ "effect": "^3.21.0"
19+ }
20+}
tsconfig.json+35−0
@@ -0,0 +1,35 @@
1+{
2+ "compilerOptions": {
3+ // Environment setup & latest features
4+ "lib": ["ESNext"],
5+ "target": "ESNext",
6+ "module": "Preserve",
7+ "moduleDetection": "force",
8+ "jsx": "react-jsx",
9+ "allowJs": true,
10+
11+ // Bundler mode
12+ "moduleResolution": "bundler",
13+ "allowImportingTsExtensions": true,
14+ "verbatimModuleSyntax": true,
15+ "noEmit": true,
16+
17+ // Best practices
18+ "strict": true,
19+ "skipLibCheck": true,
20+ "noFallthroughCasesInSwitch": true,
21+ "noUncheckedIndexedAccess": true,
22+ "noImplicitOverride": true,
23+ "exactOptionalPropertyTypes": true,
24+ "noUnusedLocals": true,
25+ "sourceMap": true,
26+ "declarationMap": true,
27+
28+ // Effect Language Service
29+ "plugins": [
30+ {
31+ "name": "@effect/language-service"
32+ }
33+ ]
34+ }
35+}