fossyl 0.11.0 → 0.12.0

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 +90 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,5 +1,92 @@
1
- # fossyl
1
+ # Fossyl
2
2
 
3
- CLI for scaffolding fossyl projects.
3
+ [![npm version](https://img.shields.io/npm/v/@fossyl/core.svg)](https://www.npmjs.com/package/@fossyl/core)
4
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
5
+ [![License: GPL-3.0](https://img.shields.io/badge/License-GPL--3.0-yellow.svg)](https://opensource.org/licenses/GPL-3.0)
4
6
 
5
- For AI-assisted development, see [CLAUDE.md](./CLAUDE.md). Full documentation at [github.com/YoyoSaur/fossyl](https://github.com/YoyoSaur/fossyl).
7
+ **Type-safe REST API framework designed for AI-assisted development**
8
+
9
+ Fossyl provides full type inference for routes, parameters, and responses with REST semantics enforcement at compile-time.
10
+
11
+ ## Getting Started
12
+
13
+ Create a new project with the CLI:
14
+
15
+ ```bash
16
+ npx fossyl --create my-api
17
+ cd my-api
18
+ pnpm install
19
+ pnpm dev
20
+ ```
21
+
22
+ The CLI will guide you through selecting adapters:
23
+ - **Server**: Express (recommended) or Bring Your Own
24
+ - **Validator**: Zod (recommended) or Bring Your Own
25
+ - **Database**: Kysely (recommended) or Bring Your Own
26
+
27
+ ## Quick Example
28
+
29
+ ```typescript
30
+ import { createRouter, authWrapper } from '@fossyl/core';
31
+ import { expressAdapter } from '@fossyl/express';
32
+
33
+ const api = createRouter('/api');
34
+
35
+ // Authentication function
36
+ const auth = async (headers: Record<string, string>) =>
37
+ authWrapper({ userId: headers['x-user-id'] });
38
+
39
+ // Define routes
40
+ const getUser = api.createEndpoint('/users/:id').get({
41
+ handler: async ({ url }) => ({
42
+ typeName: 'User' as const,
43
+ id: url.id,
44
+ name: 'John Doe'
45
+ })
46
+ });
47
+
48
+ const createUser = api.createEndpoint('/users').post({
49
+ authenticator: auth,
50
+ validator: (data): { name: string } => data as { name: string },
51
+ handler: async ({ url }, auth, body) => ({
52
+ typeName: 'User' as const,
53
+ id: 'new-id',
54
+ name: body.name,
55
+ createdBy: auth.userId
56
+ })
57
+ });
58
+
59
+ // Start server
60
+ const adapter = expressAdapter({ cors: true });
61
+ adapter.register([getUser, createUser]);
62
+ adapter.listen(3000);
63
+ ```
64
+
65
+ ## Packages
66
+
67
+ | Package | Description |
68
+ |---------|-------------|
69
+ | [`@fossyl/core`](https://www.npmjs.com/package/@fossyl/core) | Router and type definitions |
70
+ | [`fossyl`](https://www.npmjs.com/package/fossyl) | CLI for scaffolding projects |
71
+ | [`@fossyl/express`](https://www.npmjs.com/package/@fossyl/express) | Express.js runtime adapter |
72
+ | [`@fossyl/zod`](https://www.npmjs.com/package/@fossyl/zod) | Zod validation adapter |
73
+ | [`@fossyl/kysely`](https://www.npmjs.com/package/@fossyl/kysely) | Kysely database adapter |
74
+
75
+ ## Route Types
76
+
77
+ Fossyl provides four route types based on validation requirements:
78
+
79
+ - **OpenRoute**: No authentication or body validation
80
+ - **AuthenticatedRoute**: Requires authentication, no body
81
+ - **ValidatedRoute**: Requires body validation, no authentication
82
+ - **FullRoute**: Requires both authentication and body validation
83
+
84
+ ## Documentation
85
+
86
+ Full documentation and source code at [github.com/YoyoSaur/fossyl](https://github.com/YoyoSaur/fossyl).
87
+
88
+ Each package includes a `CLAUDE.md` file with comprehensive documentation for AI-assisted development.
89
+
90
+ ## License
91
+
92
+ GPL-3.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fossyl",
3
- "version": "0.11.0",
3
+ "version": "0.12.0",
4
4
  "description": "CLI for scaffolding fossyl projects",
5
5
  "bin": {
6
6
  "fossyl": "./bin/fossyl.js"