Skip to content

Instantly share code, notes, and snippets.

View schickling's full-sized avatar
Making the web better

Johannes Schickling schickling

Making the web better
View GitHub Profile
@schickling
schickling / effect-httpclient-usage-guide.md
Created December 5, 2025 08:32
Effect HttpClient usage patterns with verified examples (Bun + FetchHttpClient)

Effect HttpClient Usage Guide

Minimal verified recipe (Bun + FetchHttpClient)

  • Tested against httpbin; includes retries, base URL, schema decoding.
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse } from "@effect/platform"
import { Effect, Schema, Schedule } from "effect"

const Args = Schema.Record({ key: Schema.String, value: Schema.String })
@schickling
schickling / netlify-feedback.md
Created October 23, 2025 09:38
Netlify + Astro: Limitations and Suggestions

Netlify + Astro: Limitations and Suggestions

  • Edge bundling (Astro + Netlify adapter)

    • Limitation: astro build does not emit the final .netlify/edge-functions-dist bundle; only the Netlify build phase produces it. This makes “prebuild + deploy --no-build” unreliable for attaching Edge Functions.
    • Suggestion: Provide a documented, supported way to generate the edge bundle alongside astro build (or an explicit netlify edge:bundle/edge:deploy that attaches prebuilt bundles without a full build).
  • Deploy CLI outputs (permalink vs deploy URL)

    • Limitation: netlify deploy --json consistently returns the per‑deploy URL (e.g. https://<id>--<site>.netlify.app) but not a stable permalink/primary domain URL. The url field is inconsistent and not documented as canonical.
    • Suggestion: Always include canonical site/permalink URLs in the JSON result, and document the fields clearly (e.g. primary_url, alias_url).
@schickling
schickling / redwood-ssr-wasm-report.md
Created October 22, 2025 18:09
Redwood Dev SSR + WASM (workerd) — Problem Report

Redwood Dev SSR + WASM (workerd) — Problem Report

This document summarizes the issues we’re seeing when running Redwood SDK (rwsdk) with Vite dev + workerd SSR in a project using LiveStore. It groups the problems by area, provides concrete evidence (errors, file references), root‑cause analysis, and upstream solution ideas for the Redwood team.

Scope: Vite 7.x, @cloudflare/vite-plugin, rwsdk@1.0.0-beta.12, dev SSR runner targeting a worker-like (workerd) environment.

1) Dep Optimizer Pulls lightningcss into SSR Runtime

Symptoms

@schickling
schickling / vite-optimize-deps-module-graph.mmd
Created October 21, 2025 09:56
Vite optimizeDeps module graph diagram
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@schickling
schickling / ws-chunking.ts
Created September 22, 2025 19:42
Cloudflare WS chunking helper
import { Chunk } from '@livestore/utils/effect'
const textEncoder = new TextEncoder()
/**
* Configuration describing how to break a chunk into smaller payload-safe chunks.
*/
export interface ChunkingOptions<A> {
/** Maximum number of items that may appear in any emitted chunk. */
readonly maxItems: number
@schickling
schickling / worker.js
Created September 12, 2025 14:35
CORS Cloudflare Worker Proxy
// @ts-check
const corsHeaders = {
'Access-Control-Allow-Methods': 'GET,HEAD,POST,OPTIONS,DELETE',
'Access-Control-Max-Age': '86400',
}
const handleEvent = async (event) => {
const request = event.request
@schickling
schickling / gist-content.md
Created August 28, 2025 10:42
Git Repository Lines of Code History Analyzer - Monthly LOC tracking with cloc and terminal visualization

Git Repository Lines of Code History Analyzer

A TypeScript script that analyzes the lines of code (LOC) growth of a Git repository month by month using cloc's git-aware functionality.

Features

  • 📈 Monthly LOC tracking over any time period
  • 🎯 Git-aware analysis - no need to checkout commits
  • 🚀 Language breakdown - see which languages grow over time
  • 📊 Terminal visualization with ASCII bar charts
@schickling
schickling / durable-object-rpc.test.ts
Last active July 30, 2025 18:02
Cloudflare Durable Object RPC Protocol Implementation with Effect - Complete implementation of protocol-durable-object.ts with comprehensive tests showing how to use Effect RPC between Durable Objects using Cloudflare's native RPC mechanism.
import { describe, expect, it } from 'vitest'
/**
* Test Architecture - Effect RPC between 2 Durable Objects
*
* ┌─────────────┐ HTTP ┌─────────────────┐
* │ Test Client │ ──────────▶ │ Worker (router) │
* │ (vitest) │ └─────────────────┘
* └─────────────┘ │
* │ routes to DOs
@schickling
schickling / ai-agent.ts
Created July 25, 2025 10:09
AI Agent Client-DO Example for LiveStore on Cloudflare
/**
* AI Agent Client-DO Example
*
* This example demonstrates how a client-do can be used to create a lightweight AI agent
* that maintains conversation state, handles user interactions, and manages AI responses.
* The DO acts as a stateful agent instance that persists conversation history and context.
*
* Architecture Overview:
* ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
* │ Web Client │ │ Mobile App │ │ API Client │
@schickling
schickling / update-deps.ts
Created July 25, 2025 09:29
TypeScript script for intelligent dependency management in monorepos with Expo constraints
#!/usr/bin/env bun
import { Effect, Logger, LogLevel } from '@livestore/utils/effect'
import { Cli, PlatformNode } from '@livestore/utils/node'
import { cmd, cmdText } from '@livestore/utils-dev/node'
import { Schema } from '@livestore/utils/effect'
// Types for our dependency update workflow
const PackageUpdate = Schema.Struct({
name: Schema.String,