fossyl 0.1.1 → 0.1.2

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.
Files changed (2) hide show
  1. package/README.md +97 -0
  2. package/package.json +9 -1
package/README.md ADDED
@@ -0,0 +1,97 @@
1
+ <div align="center">
2
+ <img src="https://raw.githubusercontent.com/YoyoSaur/fossyl/main/fossyl.svg" alt="Fossyl Logo" width="200" height="200">
3
+
4
+ # Fossyl
5
+
6
+ **Type-safe REST API framework designed for AI-assisted development**
7
+
8
+ [![npm version](https://badge.fury.io/js/fossyl.svg)](https://www.npmjs.com/package/fossyl)
9
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
10
+ </div>
11
+
12
+ ## Overview
13
+
14
+ Fossyl is a type-safe REST API framework built with TypeScript, specifically designed to work seamlessly with AI-assisted development tools like Claude. It provides inference-heavy APIs with crystal clear error messages, making it easy to build robust REST APIs with full type safety.
15
+
16
+ ## Features
17
+
18
+ - **Type-Safe Routes**: Full TypeScript type inference for routes, parameters, and responses
19
+ - **REST Semantics Enforcement**: Compile-time validation of REST patterns (e.g., GET can't have body, POST requires body)
20
+ - **Pure Functional Design**: Validator-library agnostic with simple function types
21
+ - **Query Parameter Validation**: Optional type-safe query parameter validation
22
+ - **Authentication Support**: Type-safe authentication with custom authentication functions
23
+ - **AI-First Development**: Designed for seamless integration with AI coding assistants
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ npm install fossyl
29
+ # or
30
+ pnpm add fossyl
31
+ # or
32
+ yarn add fossyl
33
+ ```
34
+
35
+ ## Quick Start
36
+
37
+ ```typescript
38
+ import { createRouter } from 'fossyl';
39
+
40
+ // Create a router
41
+ const router = createRouter();
42
+
43
+ // Define routes with full type safety
44
+ const userRoute = router.endpoint('/users/:id').get({
45
+ handler: async ({ url }) => {
46
+ const userId = url.id; // Fully typed!
47
+ return { id: userId, name: 'John Doe' };
48
+ }
49
+ });
50
+
51
+ // Routes with authentication
52
+ const authenticatedRoute = router.endpoint('/protected').get({
53
+ authenticator: async (headers) => {
54
+ // Your auth logic here
55
+ return { userId: headers['user-id'] };
56
+ },
57
+ handler: async ({ url }, auth) => {
58
+ // auth is fully typed based on your authenticator!
59
+ return { message: `Hello, user ${auth.userId}` };
60
+ }
61
+ });
62
+
63
+ // Routes with request body validation
64
+ const createUserRoute = router.endpoint('/users').post({
65
+ bodyValidator: (data) => {
66
+ // Your validation logic here
67
+ return data as { name: string; email: string };
68
+ },
69
+ handler: async ({ url, body }) => {
70
+ // body is fully typed based on your validator!
71
+ return { id: '123', ...body };
72
+ }
73
+ });
74
+
75
+ // Routes with query parameters
76
+ const searchRoute = router.endpoint('/search').get({
77
+ queryValidator: (data) => {
78
+ return data as { q: string; limit?: number };
79
+ },
80
+ handler: async ({ url, query }) => {
81
+ // query is fully typed!
82
+ return { results: [], query: query.q };
83
+ }
84
+ });
85
+ ```
86
+
87
+ ## Documentation
88
+
89
+ For more detailed documentation, visit the [GitHub repository](https://github.com/YoyoSaur/fossyl).
90
+
91
+ ## Contributing
92
+
93
+ Contributions are welcome! Please feel free to submit a Pull Request.
94
+
95
+ ## License
96
+
97
+ MIT License - see the [LICENSE](LICENSE) file for details.
package/package.json CHANGED
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "name": "fossyl",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/YoyoSaur/fossyl.git"
7
+ },
8
+ "homepage": "https://github.com/YoyoSaur/fossyl#readme",
9
+ "bugs": {
10
+ "url": "https://github.com/YoyoSaur/fossyl/issues"
11
+ },
4
12
  "description": "Type-safe REST API framework core - designed for AI-assisted development",
5
13
  "main": "./dist/index.js",
6
14
  "module": "./dist/index.mjs",