Nano Supabase
Skill for working with the nano-supabase codebase: a lightweight TypeScript library that emulates Supabase entirely in-browser/edge using PGlite (Postgres via WASM). Covers architecture, fetch adap...
Skill for working with the nano-supabase codebase: a lightweight TypeScript library that emulates Supabase entirely in-browser/edge using PGlite (Postgres via WASM). Covers architecture, fetch adapter routing, auth/storage/data flows, PostgREST WASM parser, connection pooling, cross-runtime compatibility, build system, and testing conventions. Use when implementing features, fixing bugs, writing tests, or reviewing code in this project.
Install
Quick install
npx skills add https://github.com/filipecabaco/nano-supabasenpx skills add filipecabaco/nano-supabase --agent claude-codenpx skills add filipecabaco/nano-supabase --agent cursornpx skills add filipecabaco/nano-supabase --agent codexnpx skills add filipecabaco/nano-supabase --agent opencodenpx skills add filipecabaco/nano-supabase --agent github-copilotnpx skills add filipecabaco/nano-supabase --agent windsurfMore install options
Shorthand — useful for multi-skill repos:
npx skills add filipecabaco/nano-supabaseManual — clone the repo and drop the folder into your agent's skills directory:
git clone https://github.com/filipecabaco/nano-supabase.gitcp -r nano-supabase ~/.claude/skills/nano-supabase
Skill for working with the nano-supabase codebase: a lightweight TypeScript library that emulates Supabase entirely in-browser/edge using PGlite (Postgres via WASM). Covers architecture, fetch adapter routing, auth/storage/data flows, PostgREST WASM parser, connection pooling, cross-runtime compatibility, build system, and testing conventions. Use when implementing features, fixing bugs, writing tests, or reviewing code in this project.
---
name: nano-supabase
description: >
Skill for working with the nano-supabase codebase: a lightweight TypeScript library that emulates
Supabase entirely in-browser/edge using PGlite (Postgres via WASM). Covers architecture, fetch
adapter routing, auth/storage/data flows, PostgREST WASM parser, connection pooling, cross-runtime
compatibility, build system, and testing conventions. Use when implementing features, fixing bugs,
writing tests, or reviewing code in this project.
---
nano-supabase
Lightweight Supabase emulation running entirely in-browser/edge. Zero network calls. Full auth (JWT + RLS), storage (pluggable backends), PostgREST query parsing (WASM), priority-queue connection pooling over PGlite.
Architecture
@supabase/supabase-js
-> Fetch Adapter (routes by URL path)
/auth/v1/* -> AuthHandler (signup, signin, signout, refresh)
/rest/v1/* -> PostgREST Parser (WASM) -> SQL
/storage/v1/* -> StorageHandler (buckets, objects, signed URLs)
-> Priority Queue (CRITICAL / HIGH / MEDIUM / LOW)
-> Connection Pooler (N-to-1 multiplexing)
-> PGlite (PostgreSQL in WebAssembly)
Project Layout
src/
index.ts # Public exports
client.ts # createLocalSupabaseClient, createFetchAdapter
supabase-client.ts # Supabase-compatible client wrapper
postgrest-parser.ts # PostgREST -> SQL (WASM binding)
pooler.ts # N-to-1 connection pooler
queue.ts # Priority queue (4 levels)
types.ts # QueryPriority, QueryResult, PoolerConfig
auth/ # JWT via Web Crypto, sessions, refresh tokens
handler.ts # signUp, signIn, signOut, refreshToken
crypto.ts # Web Crypto API helpers
jwt.ts # signJWT, verifyJWT, decodeJWT
schema.ts # Auth SQL schema (CREATE IF NOT EXISTS)
types.ts # User, Session, AuthResponse
storage/ # Storage API emulation
handler.ts # Bucket/object CRUD
backend.ts # StorageBackend interface + MemoryStorageBackend
schema.ts # Storage SQL schema
fetch-adapter/ # Intercepts supabase-js fetch calls
index.ts # createLocalFetch: URL routing
auth-routes.ts # /auth/v1/* dispatch
data-routes.ts # /rest/v1/* dispatch
storage-routes.ts # /storage/v1/* dispatch
auth-context.ts # JWT claims extraction for RLS
error-handler.ts # Error -> Response conversion
tests/
compat.ts # Deno/Bun test shim (runtime-agnostic)
*.test.ts # Split by concern: auth, data, storage, fetch-adapter, applications, full-user-flow
Key Technical Details
- TypeScript strict mode, ESNext modules, ES2022 target
- Cross-runtime: Node.js, Deno, Bun, Browser, Cloudflare Workers. Use Web Crypto API only (no Node crypto)
- PGlite is a peer dependency - users provide their own instance
- postgrest-parser bundled as WASM in dist/
- esbuild bundles to dist/index.js (~21KB) + WASM (~377KB)
- SQL schemas use
CREATE IF NOT EXISTSfor idempotent initialization - RLS functions:
auth.uid(),auth.role(),auth.email()backed by PostgreSQL roles (anon,authenticated,service_role)
Common Patterns
Create a client:
const client = createLocalSupabaseClient(db);
// or manually:
const client = createClient(url, key, { global: { fetch: createLocalFetch(db, key) } });
Auth flow:
await supabase.auth.signUp({ email, password });
const { data: { session } } = await supabase.auth.signInWithPassword({ email, password });
// JWT now in session, RLS active
Data with RLS:
// Create table + RLS policy, then query as authenticated user
const { data } = await supabase.from('todos').select('*');
// Only returns rows matching RLS policy
Storage:
await supabase.storage.from('avatars').upload('path/file.png', blob);
const { data } = await supabase.storage.from('avatars').download('path/file.png');
const { data: { signedUrl } } = await supabase.storage.from('avatars').createSignedUrl('path/file.png', 3600);
Testing
- Behavior over implementation: Test real user workflows, not internals
- No helper files: Inline all setup for full context at each test
- No excessive mocking: Use real PGlite instances
- Each test creates its own PGlite instance + client (isolated)
- Full workflows: signup -> insert -> query -> verify RLS -> cleanup
- Runtime-agnostic via
compat.tsshim
Run tests:
deno test --allow-read --allow-env tests/
bun test tests/
Build
npm run build # esbuild -> dist/
npm run build:dev # tsc only
npm run build:types # declarations
CI: GitHub Actions matrix (Bun + Deno), tests split by concern.
Rules
- No comments in code
- No helper/utility files
- No Node.js-specific APIs
- Test behavior, not implementation
- Do not test what the compiler verifies
---
Source: https://github.com/filipecabaco/nano-supabase
Author: filipecabaco
Discovered via: skillsdirectory.com
Genre: databases
SKILL.md source
---
name: nano-supabase
description: Skill for working with the nano-supabase codebase: a lightweight TypeScript library that emulates Supabase entirely in-browser/edge using PGlite (Postgres via WASM). Covers architecture, fetch adap...
---
# nano-supabase
Skill for working with the nano-supabase codebase: a lightweight TypeScript library that emulates Supabase entirely in-browser/edge using PGlite (Postgres via WASM). Covers architecture, fetch adapter routing, auth/storage/data flows, PostgREST WASM parser, connection pooling, cross-runtime compatibility, build system, and testing conventions. Use when implementing features, fixing bugs, writing tests, or reviewing code in this project.
---
name: nano-supabase
description: >
Skill for working with the nano-supabase codebase: a lightweight TypeScript library that emulates
Supabase entirely in-browser/edge using PGlite (Postgres via WASM). Covers architecture, fetch
adapter routing, auth/storage/data flows, PostgREST WASM parser, connection pooling, cross-runtime
compatibility, build system, and testing conventions. Use when implementing features, fixing bugs,
writing tests, or reviewing code in this project.
---
# nano-supabase
Lightweight Supabase emulation running entirely in-browser/edge. Zero network calls. Full auth (JWT + RLS), storage (pluggable backends), PostgREST query parsing (WASM), priority-queue connection pooling over PGlite.
## Architecture
```
@supabase/supabase-js
-> Fetch Adapter (routes by URL path)
/auth/v1/* -> AuthHandler (signup, signin, signout, refresh)
/rest/v1/* -> PostgREST Parser (WASM) -> SQL
/storage/v1/* -> StorageHandler (buckets, objects, signed URLs)
-> Priority Queue (CRITICAL / HIGH / MEDIUM / LOW)
-> Connection Pooler (N-to-1 multiplexing)
-> PGlite (PostgreSQL in WebAssembly)
```
## Project Layout
```
src/
index.ts # Public exports
client.ts # createLocalSupabaseClient, createFetchAdapter
supabase-client.ts # Supabase-compatible client wrapper
postgrest-parser.ts # PostgREST -> SQL (WASM binding)
pooler.ts # N-to-1 connection pooler
queue.ts # Priority queue (4 levels)
types.ts # QueryPriority, QueryResult, PoolerConfig
auth/ # JWT via Web Crypto, sessions, refresh tokens
handler.ts # signUp, signIn, signOut, refreshToken
crypto.ts # Web Crypto API helpers
jwt.ts # signJWT, verifyJWT, decodeJWT
schema.ts # Auth SQL schema (CREATE IF NOT EXISTS)
types.ts # User, Session, AuthResponse
storage/ # Storage API emulation
handler.ts # Bucket/object CRUD
backend.ts # StorageBackend interface + MemoryStorageBackend
schema.ts # Storage SQL schema
fetch-adapter/ # Intercepts supabase-js fetch calls
index.ts # createLocalFetch: URL routing
auth-routes.ts # /auth/v1/* dispatch
data-routes.ts # /rest/v1/* dispatch
storage-routes.ts # /storage/v1/* dispatch
auth-context.ts # JWT claims extraction for RLS
error-handler.ts # Error -> Response conversion
tests/
compat.ts # Deno/Bun test shim (runtime-agnostic)
*.test.ts # Split by concern: auth, data, storage, fetch-adapter, applications, full-user-flow
```
## Key Technical Details
- **TypeScript strict mode**, ESNext modules, ES2022 target
- **Cross-runtime**: Node.js, Deno, Bun, Browser, Cloudflare Workers. Use Web Crypto API only (no Node crypto)
- **PGlite is a peer dependency** - users provide their own instance
- **postgrest-parser** bundled as WASM in dist/
- **esbuild** bundles to dist/index.js (~21KB) + WASM (~377KB)
- **SQL schemas** use `CREATE IF NOT EXISTS` for idempotent initialization
- **RLS functions**: `auth.uid()`, `auth.role()`, `auth.email()` backed by PostgreSQL roles (`anon`, `authenticated`, `service_role`)
## Common Patterns
Create a client:
```typescript
const client = createLocalSupabaseClient(db);
// or manually:
const client = createClient(url, key, { global: { fetch: createLocalFetch(db, key) } });
```
Auth flow:
```typescript
await supabase.auth.signUp({ email, password });
const { data: { session } } = await supabase.auth.signInWithPassword({ email, password });
// JWT now in session, RLS active
```
Data with RLS:
```typescript
// Create table + RLS policy, then query as authenticated user
const { data } = await supabase.from('todos').select('*');
// Only returns rows matching RLS policy
```
Storage:
```typescript
await supabase.storage.from('avatars').upload('path/file.png', blob);
const { data } = await supabase.storage.from('avatars').download('path/file.png');
const { data: { signedUrl } } = await supabase.storage.from('avatars').createSignedUrl('path/file.png', 3600);
```
## Testing
- **Behavior over implementation**: Test real user workflows, not internals
- **No helper files**: Inline all setup for full context at each test
- **No excessive mocking**: Use real PGlite instances
- **Each test** creates its own PGlite instance + client (isolated)
- **Full workflows**: signup -> insert -> query -> verify RLS -> cleanup
- Runtime-agnostic via `compat.ts` shim
Run tests:
```bash
deno test --allow-read --allow-env tests/
bun test tests/
```
## Build
```bash
npm run build # esbuild -> dist/
npm run build:dev # tsc only
npm run build:types # declarations
```
CI: GitHub Actions matrix (Bun + Deno), tests split by concern.
## Rules
- No comments in code
- No helper/utility files
- No Node.js-specific APIs
- Test behavior, not implementation
- Do not test what the compiler verifies
---
**Source**: https://github.com/filipecabaco/nano-supabase
**Author**: filipecabaco
**Discovered via**: skillsdirectory.com
**Genre**: databases
Related skills 6
caveman
Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.
secure-linux-web-hosting
Use when setting up, hardening, or reviewing a cloud server for self-hosting, including DNS, SSH, firewalls, Nginx, static-site hosting, reverse-proxying an app, HTTPS with Let's Encrypt or ACME clients, safe HTTP-to-HTTPS redirects, or optional post-launch network tuning such as BBR.
readme-i18n
Use when the user wants to translate a repository README, make a repo multilingual, localize docs, add a language switcher, internationalize the README, or update localized README variants in a GitHub-style repository.
lark-shared
Use when first setting up lark-cli, running auth login, switching user/bot identity (--as), handling permission denied or scope errors, needing to update lark-cli, or seeing _notice in JSON output.
improve-codebase-architecture
Find deepening opportunities in a codebase, informed by the domain language in CONTEXT.md and the decisions in docs/adr/. Use when the user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable.
paper-context-resolver
Optional RigorPilot helper for README-first deep learning repo reproduction. Use only when the README and repository files leave a narrow reproduction-critical gap and the task is to resolve a specific paper detail such as dataset split, preprocessing, evaluation protocol, checkpoint mapping, or runtime assumption from primary paper sources while recording conflicts. Do not use for general paper summary, repo scanning, environment setup, command execution, title-only paper lookup, or replacin...