Skip to content

Commit fa2f65e

Browse files
committed
chore: initial commit
0 parents  commit fa2f65e

28 files changed

Lines changed: 3067 additions & 0 deletions

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

.husky/pre-commit

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
echo "Running pre-commit checks..."
4+
5+
echo "→ Format check..."
6+
bun run format:check || exit 1
7+
8+
echo "→ Lint check..."
9+
bun run lint:check || exit 1
10+
11+
echo "→ Type check..."
12+
bun run typecheck || exit 1
13+
14+
echo "→ Running tests..."
15+
bun test || exit 1
16+
17+
echo "✓ All checks passed!"

.prettierrc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"printWidth": 120,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"bracketSpacing": true,
9+
"arrowParens": "avoid",
10+
"requirePragma": false,
11+
"insertPragma": false,
12+
"proseWrap": "always"
13+
}

.vscode/launch.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "bun",
9+
"internalConsoleOptions": "neverOpen",
10+
"request": "launch",
11+
"name": "Debug File",
12+
"program": "${file}",
13+
"cwd": "${workspaceFolder}",
14+
"stopOnEntry": false,
15+
"watchMode": false
16+
},
17+
{
18+
"type": "bun",
19+
"internalConsoleOptions": "neverOpen",
20+
"request": "launch",
21+
"name": "Run File",
22+
"program": "${file}",
23+
"cwd": "${workspaceFolder}",
24+
"noDebug": true,
25+
"watchMode": false
26+
},
27+
{
28+
"type": "bun",
29+
"internalConsoleOptions": "neverOpen",
30+
"request": "attach",
31+
"name": "Attach Bun",
32+
"url": "ws://localhost:6499/",
33+
"stopOnEntry": false
34+
}
35+
]
36+
}

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Changelog
2+
3+
## 1.0.0 (2026-03-27)
4+
5+
### Features
6+
7+
- **Core Framework** - `Doofpi` class with full request lifecycle: `createContext`, `onRequest`, `onResponse`, `onError`
8+
hooks
9+
- **Endpoint Builder** - Fluent API for defining endpoints with `model()`, `meta()`, `middleware()`, `read()`, and
10+
`write()` methods
11+
- **Read & Write Operations** - `GET`-based reads (input via query parameter) and `POST`-based writes (input via JSON
12+
body)
13+
- **Zod Validation** - Input and output schema validation using Zod, with automatic error extraction
14+
- **Middleware** - Per-endpoint middleware chains with access to request context, meta, and `throwError`
15+
- **Default Meta** - `defaultMeta()` on the endpoint builder for shared metadata across endpoints
16+
- **Routing** - Dot-notation path routing powered by `extreme-router`, with configurable root (default: `/doofpi`)
17+
- **Type-Safe Client** - `createClient<Routes>()` proxy-based client that mirrors the server route structure with full
18+
type inference
19+
- **Error System** - `DoofpiError`, `NotFoundError`, `MethodNotAllowedError`, `ValidationError`, `InternalServerError`
20+
on the server; `DoofpiClientError` on the client
21+
- **Environment & Context** - `defineEnv()`, `defineExtra()`, `defineMeta()` for typed environment, extra bindings, and
22+
metadata
23+
- **`InferContext` Utility** - Type helper to extract the context type from a `Doofpi` instance
24+
- **Web Standards** - Built on the `Request`/`Response` API - runs on Bun, Cloudflare Workers, Vercel, Netlify Edge
25+
Functions, Deno and more

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<div align="center">
2+
<br/>
3+
<img src="./assets/logo.svg" alt="doofpi" width="80" />
4+
<h1>doofpi</h1>
5+
<p><strong>Edge-First TypeScript API Framework</strong></p>
6+
7+
<p>
8+
<a href="https://www.npmjs.com/package/doofpi"><img src="https://img.shields.io/npm/v/doofpi.svg" alt="npm version" /></a>
9+
&nbsp;
10+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/license-MIT-orange.svg" alt="MIT License" /></a>
11+
</p>
12+
13+
<p>
14+
<a href="https://liorcodev.github.io/doofpi-docs/docs/quick-start"><strong>Quick Start</strong></a> ·
15+
<a href="https://liorcodev.github.io/doofpi-docs/docs/core-concepts/read-and-write"><strong>Core Concepts</strong></a> ·
16+
<a href="https://liorcodev.github.io/doofpi-docs/docs/api-reference/doofpi-class"><strong>API Reference</strong></a> ·
17+
<a href="https://liorcodev.github.io/doofpi-docs"><strong>Documentation →</strong></a>
18+
</p>
19+
<br/>
20+
</div>
21+
22+
---
23+
24+
**doofpi** is a lightweight TypeScript framework based on web standards for building end-to-end type-safe APIs - no code
25+
generation, no build steps, no separate schema files to maintain
26+
27+
```bash
28+
# Core install
29+
bun install doofpi
30+
31+
npm install doofpi
32+
33+
pnpm install doofpi
34+
```
35+
36+
> **Optional:** Add `zod` for schema validation and type inference from schemas.
37+
>
38+
> ```bash
39+
> bun install doofpi zod
40+
> ```
41+
42+
## Highlights
43+
44+
| | |
45+
| -------------------------- | ----------------------------------------------------------- |
46+
| **Zero Boilerplate** | No adapters, links, or transformers minimal setup |
47+
| **End-to-End Type Safety** | Change your server, your client breaks at compile time |
48+
| **Runtime Agnostic** | Bun · Cloudflare Workers · Vercel · Netlify · Deno and more |
49+
| **Zod Validation** | Optional input _and_ output validation at runtime |
50+
| **Web Standards** | Built on the native `Request` / `Response` API |
51+
| **Thoroughly Tested** | 100% code coverage across all core features |
52+
53+
## Documentation
54+
55+
Full documentation, guides, and API reference are available at
56+
**[liorcodev.github.io/doofpi-docs](https://liorcodev.github.io/doofpi-docs)**.
57+
58+
| | |
59+
| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------ |
60+
| [Quick Start](https://liorcodev.github.io/doofpi-docs/docs/quick-start) | Get up and running in minutes |
61+
| [Core Concepts](https://liorcodev.github.io/doofpi-docs/docs/core-concepts/read-and-write) | Read & Write semantics, routing, Zod validation |
62+
| [Guides](https://liorcodev.github.io/doofpi-docs/docs/guides/context-and-middleware) | Context, middleware, error handling, and more |
63+
| [API Reference](https://liorcodev.github.io/doofpi-docs/docs/api-reference/doofpi-class) | Full API for `Doofpi`, `EndpointBuilder`, and `createClient` |
64+
| [Comparison](https://liorcodev.github.io/doofpi-docs/docs/comparison) | How doofpi compares to tRPC |
65+
66+
## Acknowledgments
67+
68+
Inspired by [tRPC](https://trpc.io).
69+
70+
---
71+
72+
<div align="center">
73+
<sub>MIT License · Built with ❤️ for the TypeScript community</sub>
74+
</div>

assets/logo.svg

Lines changed: 52 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)