Skip to content

Commit 82cdae6

Browse files
committed
client sdk documentation added
1 parent e6c8cfc commit 82cdae6

25 files changed

Lines changed: 1937 additions & 373 deletions

apps/docs/app.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ export default defineAppConfig({
5252
icon: 'lucide:globe',
5353
description: 'Explore ForgeBase API and it functionality',
5454
},
55+
{
56+
title: 'Client Packages',
57+
to: '/client-packages',
58+
target: '_self',
59+
icon: 'lucide:package-open',
60+
description:
61+
'Explore ForgeBase client packages for web and mobile applications',
62+
},
5563
],
5664
},
5765
],

apps/docs/content/2.api/2.getting-started.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ description: Learn how to set up and use the ForgeBase API package
44
icon: 'lucide:play'
55
---
66

7-
# Getting Started with ForgeBase API
8-
97
This guide will help you get started with the ForgeBase API package, showing you how to set it up and integrate it with your application.
108

119
## Installation
@@ -26,7 +24,7 @@ If you plan to use storage features, install the storage package as well:
2624

2725
The first step in using ForgeBase API is to set up a database connection:
2826

29-
```typescript
27+
```typescript [ts]
3028
import knex from 'knex';
3129

3230
// Create a Knex instance for your database
@@ -47,7 +45,7 @@ Below are examples of integrating ForgeBase API with various frameworks. For mor
4745

4846
Here's how to integrate ForgeBase API with an Express application:
4947

50-
```typescript
48+
```typescript [ts]
5149
import express from 'express';
5250
import cors from 'cors';
5351
import { createExpressHandler } from '@the-forgebase/api/core/express';
@@ -109,7 +107,7 @@ app.listen(PORT, () => {
109107

110108
Here's how to integrate ForgeBase API with a Hono application:
111109

112-
```typescript
110+
```typescript [ts]
113111
import { Hono } from 'hono';
114112
import { cors } from 'hono/cors';
115113
import { createIttyHandler } from '@the-forgebase/api/core/web';
@@ -178,7 +176,7 @@ export default {
178176

179177
ForgeBase API provides dedicated modules for NestJS integration:
180178

181-
```typescript
179+
```typescript [ts]
182180
import { Module } from '@nestjs/common';
183181
import { ForgeApiModule } from '@the-forgebase/api/core/nest';
184182

@@ -204,7 +202,7 @@ export class AppModule {}
204202

205203
For more advanced scenarios, you can use the `ForgeApiWithChildModule`:
206204

207-
```typescript
205+
```typescript [ts]
208206
import { Module } from '@nestjs/common';
209207
import { ForgeApiWithChildModule } from '@the-forgebase/api/core/nest';
210208

@@ -252,7 +250,7 @@ export class FeatureModule {}
252250

253251
ForgeBase API can be easily integrated with Next.js API routes:
254252

255-
```typescript
253+
```typescript [ts]
256254
// app/api/[[...route]]/route.ts
257255
import { NextRequest, NextResponse } from 'next/server';
258256
import { createIttyHandler } from '@the-forgebase/api/core/web';
@@ -323,7 +321,7 @@ Once you've set up the ForgeBase API, you can start using it to interact with yo
323321

324322
### Accessing the Database Service
325323

326-
```typescript
324+
```typescript [ts]
327325
// Get the database service from your handler
328326
const db = expressHandler.getDatabaseService(); // or webHandler.getDatabaseService();
329327

apps/docs/content/2.api/3.rest-api-reference.md

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ description: Comprehensive reference for the ForgeBase API REST endpoints
44
icon: 'lucide:book-open'
55
---
66

7-
# REST API Reference
8-
97
ForgeBase API automatically creates RESTful endpoints for your database. This page provides a comprehensive reference for all available endpoints.
108

119
## Base URL
@@ -18,31 +16,31 @@ These endpoints allow you to manage your database schema.
1816

1917
### Get Database Schema
2018

21-
```http
19+
```http [http]
2220
GET /api/db/schema
2321
```
2422

2523
Returns the complete database schema, including all tables, columns, and relationships.
2624

2725
### Get Tables
2826

29-
```http
27+
```http [http]
3028
GET /api/db/schema/tables
3129
```
3230

3331
Returns a list of all tables in the database.
3432

3533
### Get Table Schema
3634

37-
```http
35+
```http [http]
3836
GET /api/db/schema/tables/:tableName
3937
```
4038

4139
Returns the schema for a specific table, including all columns and relationships.
4240

4341
### Create Table
4442

45-
```http
43+
```http [http]
4644
POST /api/db/schema
4745
Content-Type: application/json
4846
@@ -60,7 +58,7 @@ Creates a new table with the specified columns.
6058

6159
### Add Column
6260

63-
```http
61+
```http [http]
6462
POST /api/db/schema/column
6563
Content-Type: application/json
6664
@@ -76,7 +74,7 @@ Adds one or more columns to an existing table.
7674

7775
### Drop Column
7876

79-
```http
77+
```http [http]
8078
DELETE /api/db/schema/column
8179
Content-Type: application/json
8280
@@ -90,7 +88,7 @@ Removes a column from an existing table.
9088

9189
### Add Foreign Key
9290

93-
```http
91+
```http [http]
9492
POST /api/db/schema/foreign_key
9593
Content-Type: application/json
9694
@@ -110,7 +108,7 @@ Adds a foreign key constraint to a table.
110108

111109
### Drop Foreign Key
112110

113-
```http
111+
```http [http]
114112
DELETE /api/db/schema/foreign_key
115113
Content-Type: application/json
116114
@@ -124,7 +122,7 @@ Removes a foreign key constraint from a table.
124122

125123
### Delete Table
126124

127-
```http
125+
```http [http]
128126
DELETE /api/db/schema/tables/:tableName
129127
```
130128

@@ -136,7 +134,7 @@ These endpoints allow you to perform CRUD operations on your data.
136134

137135
### Create Record
138136

139-
```http
137+
```http [http]
140138
POST /api/db/create/:tableName
141139
Content-Type: application/json
142140
@@ -152,7 +150,7 @@ Creates a new record in the specified table.
152150

153151
### Query Records
154152

155-
```http
153+
```http [http]
156154
POST /api/db/query/:tableName
157155
Content-Type: application/json
158156
@@ -171,15 +169,15 @@ Queries records from the specified table with filtering, pagination, and sorting
171169

172170
### Get Record by ID
173171

174-
```http
172+
```http [http]
175173
GET /api/db/get/:tableName/:id
176174
```
177175

178176
Retrieves a specific record by its ID.
179177

180178
### Update Record
181179

182-
```http
180+
```http [http]
183181
PUT /api/db/update/:tableName/:id
184182
Content-Type: application/json
185183
@@ -195,7 +193,7 @@ Updates a specific record by its ID.
195193

196194
### Advanced Update
197195

198-
```http
196+
```http [http]
199197
POST /api/db/update/:tableName
200198
Content-Type: application/json
201199
@@ -213,15 +211,15 @@ Updates multiple records that match the filter criteria.
213211

214212
### Delete Record
215213

216-
```http
214+
```http [http]
217215
DELETE /api/db/del/:tableName/:id
218216
```
219217

220218
Deletes a specific record by its ID.
221219

222220
### Advanced Delete
223221

224-
```http
222+
```http [http]
225223
POST /api/db/del/:tableName
226224
Content-Type: application/json
227225
@@ -240,15 +238,15 @@ These endpoints allow you to manage row-level security permissions.
240238

241239
### Get Table Permissions
242240

243-
```http
241+
```http [http]
244242
GET /api/db/permissions/:tableName
245243
```
246244

247245
Returns the permissions for a specific table.
248246

249247
### Set Table Permissions
250248

251-
```http
249+
```http [http]
252250
POST /api/db/permissions/:tableName
253251
Content-Type: application/json
254252
@@ -261,7 +259,7 @@ Content-Type: application/json
261259
{ "allow": "auth" }
262260
],
263261
"UPDATE": [
264-
{ "allow": "auth",
262+
{ "allow": "auth",
265263
"fieldCheck": {
266264
"field": "user_id",
267265
"operator": "===",
@@ -281,7 +279,7 @@ Sets the permissions for a specific table.
281279

282280
### Delete Table Permissions
283281

284-
```http
282+
```http [http]
285283
DELETE /api/db/permissions/:tableName
286284
```
287285

@@ -295,31 +293,31 @@ Many endpoints support query parameters for filtering, pagination, and sorting:
295293

296294
You can filter records using the `filter` parameter:
297295

298-
```http
296+
```http [http]
299297
GET /api/db/query/users?filter={"name":"John"}
300298
```
301299

302300
### Pagination
303301

304302
You can paginate results using the `limit` and `offset` parameters:
305303

306-
```http
304+
```http [http]
307305
GET /api/db/query/users?limit=10&offset=0
308306
```
309307

310308
### Sorting
311309

312310
You can sort results using the `orderBy` parameter:
313311

314-
```http
312+
```http [http]
315313
GET /api/db/query/users?orderBy=[{"column":"name","order":"asc"}]
316314
```
317315

318316
### Column Selection
319317

320318
You can select specific columns using the `select` parameter:
321319

322-
```http
320+
```http [http]
323321
GET /api/db/query/users?select=["id","name","email"]
324322
```
325323

@@ -347,7 +345,7 @@ All endpoints return standard HTTP status codes:
347345

348346
Error responses include a JSON body with an error message:
349347

350-
```json
348+
```json [json]
351349
{
352350
"error": "Bad Request",
353351
"message": "Invalid data format"

apps/docs/content/2.api/4.framework-integration/2.express.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Express is one of the most popular Node.js web frameworks, and ForgeBase API pro
88

99
## Basic Integration
1010

11-
```typescript
11+
```typescript [ts]
1212
import express from 'express';
1313
import cors from 'cors';
1414
import { createExpressHandler } from '@the-forgebase/api/core/express';
@@ -75,7 +75,7 @@ app.listen(PORT, () => {
7575

7676
To integrate authentication with Express, you can use the ForgeBase Auth package:
7777

78-
```typescript
78+
```typescript [ts]
7979
import express from 'express';
8080
import { createExpressHandler } from '@the-forgebase/api/core/express';
8181
import { createExpressAuthClient, initializeExpressAuth } from '@the-forgebase/auth/adapters/express';
@@ -136,7 +136,7 @@ app.listen(3000);
136136

137137
You can access the database service directly for custom operations:
138138

139-
```typescript
139+
```typescript [ts]
140140
// Get the database service
141141
const db = expressHandler.getDatabaseService();
142142

apps/docs/content/2.api/4.framework-integration/3.nest.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ NestJS is a progressive Node.js framework, and ForgeBase API provides dedicated
88

99
## Basic Integration
1010

11-
```typescript
11+
```typescript [ts]
1212
import { Module } from '@nestjs/common';
1313
import { ForgeApiModule } from '@the-forgebase/api/core/nest';
1414

@@ -36,7 +36,7 @@ export class AppModule {}
3636

3737
For more advanced scenarios, you can use the `ForgeApiWithChildModule`:
3838

39-
```typescript
39+
```typescript [ts]
4040
import { Module } from '@nestjs/common';
4141
import { ForgeApiWithChildModule } from '@the-forgebase/api/core/nest';
4242

@@ -84,7 +84,7 @@ export class FeatureModule {}
8484

8585
To integrate authentication with NestJS, you can use the ForgeBase Auth package:
8686

87-
```typescript
87+
```typescript [ts]
8888
import { Module } from '@nestjs/common';
8989
import { ForgeApiModule } from '@the-forgebase/api/core/nest';
9090
import { NestAuthModule } from '@the-forgebase/auth/adapters/nest';
@@ -124,7 +124,7 @@ export class AppModule {}
124124

125125
You can inject and use the ForgeBase services in your NestJS controllers and services:
126126

127-
```typescript
127+
```typescript [ts]
128128
import { Controller, Get, Inject } from '@nestjs/common';
129129
import { DatabaseService } from '@the-forgebase/api/core/nest';
130130

0 commit comments

Comments
 (0)