Skip to content

Commit f9b4abc

Browse files
committed
chore: remove unused environment files, update dependencies, and enhance project configuration
1 parent 6f27e43 commit f9b4abc

File tree

12 files changed

+661
-239
lines changed

12 files changed

+661
-239
lines changed

.e2e-micro.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
DB_LOGGING=0
22
ORM_TYPE=microorm
3+
PORT=3000

.e2e.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
DB_LOGGING=0
22
ORM_TYPE=typeorm
3+
PORT=3000

.env

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,4 @@
11
DB_HOST=localhost
22
DB_LOGGING=1
3-
DB_NAME="json-api-db"
43

5-
DB_USERNAME="postgres"
6-
DB_PASSWORD="postgres"
7-
DB_PORT=5432
8-
DB_TYPE=postgres
9-
10-
#DB_USERNAME="root"
11-
#DB_PASSWORD="mysql"
12-
#DB_PORT=3306
13-
#DB_TYPE=mysql
14-
15-
16-
#ORM_TYPE=microorm
17-
ORM_TYPE=typeorm
4+
USE_ATTACH_BUFFER=true

.test.env

Lines changed: 0 additions & 2 deletions
This file was deleted.

.vscode/launch.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@
1818
"${workspaceFolder}/apps/json-api-server/dist/**/*.(m|c|)js",
1919
"!**/node_modules/**"
2020
]
21+
},
22+
{
23+
"type": "node",
24+
"request": "launch",
25+
"name": "Debug test with Nx",
26+
"runtimeExecutable": "npx",
27+
"runtimeArgs": ["nx", "serve", "test"],
28+
"env": {
29+
"NODE_OPTIONS": "--inspect=9230"
30+
},
31+
"console": "integratedTerminal",
32+
"internalConsoleOptions": "neverOpen",
33+
"skipFiles": ["<node_internals>/**"],
34+
"sourceMaps": true,
35+
"outFiles": [
36+
"${workspaceFolder}/apps/test/dist/**/*.(m|c|)js",
37+
"!**/node_modules/**"
38+
]
2139
}
2240
]
2341
}

README.md

Lines changed: 240 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,258 @@
1+
<h1 align="center">Smart Tools for NestJS</h1>
2+
13
<p align="center">
2-
<a href="http://nestjs.com/" target="blank">NestJS</a> JSON API & JSON RPC Suite
4+
A comprehensive monorepo of <strong>NestJS</strong> libraries for building standardized APIs with <strong>JSON:API</strong> and <strong>JSON-RPC 2.0</strong> specifications, with fine-grained access control and resource permissions.
35
</p>
46

5-
<p>
6-
This monorepo contains a set of several libraries designed to simplify the development of server and client applications using NestJS. These tools help you work with two popular protocols:
7-
</p>
7+
---
8+
9+
## 📚 Table of Contents
10+
11+
- [Overview](#-overview)
12+
- [Prerequisites](#-prerequisites)
13+
- [Packages](#-packages)
14+
- [JSON:API](#1-jsonapi)
15+
- [JSON-RPC](#2-json-rpc)
16+
- [Access Control (ACL)](#3-access-control-acl)
17+
- [Quick Start](#-quick-start)
18+
- [Installation](#installation)
19+
- [Running Demo Applications](#running-demo-applications)
20+
- [License](#-license)
21+
22+
---
23+
24+
## 🎯 Overview
25+
26+
This monorepo provides a complete set of tools to simplify the development of server and client applications using **NestJS**. It supports two popular protocols:
27+
28+
- **[JSON:API](https://jsonapi.org/)** – Build RESTful APIs with standardized request/response formats
29+
- **[JSON-RPC 2.0](https://www.jsonrpc.org/)** – Implement remote procedure calls using JSON
30+
- **[CASL](https://casl.js.org/)** – Fine-grained access control with full integration for JSON:API resources
31+
32+
All packages are designed to work seamlessly with modern ORMs like **TypeORM** and **MikroORM**, and include built-in support for [PGlite](https://github.com/electric-sql/pglite) for local development.
33+
34+
---
35+
36+
## 📋 Prerequisites
37+
38+
- **Node.js** >= 20.0.0
39+
- **npm** or **yarn**
40+
41+
---
42+
43+
## 📦 Packages
44+
45+
### 1. JSON:API
46+
47+
Build production-ready **JSON:API** compliant REST APIs with automatic CRUD generation, filtering, sorting, pagination, and relationship handling.
48+
49+
<table>
50+
<tr>
51+
<th>Package</th>
52+
<th>Description</th>
53+
</tr>
54+
55+
<tr>
56+
<td>
57+
<strong><a href="https://github.com/klerick/nestjs-json-api/tree/master/libs/json-api/json-api-nestjs">json-api-nestjs</a></strong>
58+
</td>
59+
<td>
60+
Core library for creating JSON:API compliant servers. Automatically generates endpoints for CRUD operations, relationships, filtering, sorting, pagination, and atomic operations. Supports TypeORM and MikroORM adapters.
61+
</td>
62+
</tr>
63+
64+
<tr>
65+
<td>
66+
<strong><a href="https://github.com/klerick/nestjs-json-api/tree/master/libs/json-api/json-api-nestjs-typeorm">json-api-nestjs-typeorm</a></strong>
67+
</td>
68+
<td>
69+
TypeORM adapter for json-api-nestjs. Enables JSON:API functionality with TypeORM entities, migrations, and repositories.
70+
</td>
71+
</tr>
72+
73+
<tr>
74+
<td>
75+
<strong><a href="https://github.com/klerick/nestjs-json-api/tree/master/libs/json-api/json-api-nestjs-microorm">json-api-nestjs-microorm</a></strong>
76+
</td>
77+
<td>
78+
MikroORM adapter for json-api-nestjs. Provides JSON:API support with MikroORM entities, migrations, and advanced query features.
79+
</td>
80+
</tr>
81+
82+
<tr>
83+
<td>
84+
<strong><a href="https://github.com/klerick/nestjs-json-api/tree/master/libs/json-api/json-api-nestjs-sdk">json-api-nestjs-sdk</a></strong>
85+
</td>
86+
<td>
87+
Type-safe client SDK for consuming JSON:API endpoints. Works with Axios, Fetch API, and Angular HttpClient. Supports filtering, sorting, includes, atomic operations, and provides full TypeScript type inference.
88+
</td>
89+
</tr>
90+
</table>
91+
92+
---
93+
94+
### 2. JSON-RPC
95+
96+
Implement **JSON-RPC 2.0** servers and clients with support for HTTP and WebSocket transports, batch requests, and automatic method discovery.
97+
98+
<table>
99+
<tr>
100+
<th>Package</th>
101+
<th>Description</th>
102+
</tr>
103+
104+
<tr>
105+
<td>
106+
<strong><a href="https://github.com/klerick/nestjs-json-api/tree/master/libs/json-rpc/nestjs-json-rpc">nestjs-json-rpc</a></strong>
107+
</td>
108+
<td>
109+
JSON-RPC 2.0 server implementation for NestJS. Supports HTTP and WebSocket transports, batch requests, custom error handling, and automatic method registration via decorators.
110+
</td>
111+
</tr>
112+
113+
<tr>
114+
<td>
115+
<strong><a href="https://github.com/klerick/nestjs-json-api/tree/master/libs/json-rpc/nestjs-json-rpc-sdk">nestjs-json-rpc-sdk</a></strong>
116+
</td>
117+
<td>
118+
Type-safe JSON-RPC client SDK with automatic method inference, batch request support, and WebSocket/HTTP transport options.
119+
</td>
120+
</tr>
121+
</table>
122+
123+
---
124+
125+
### 3. Access Control (ACL)
126+
127+
Add fine-grained **Access Control Lists** to your JSON:API endpoints using **[CASL](https://casl.js.org/)** with template-based rule materialization.
128+
129+
<table>
130+
<tr>
131+
<th>Package</th>
132+
<th>Description</th>
133+
</tr>
134+
135+
<tr>
136+
<td>
137+
<strong><a href="https://github.com/klerick/nestjs-json-api/tree/master/libs/acl-permissions/nestjs-acl-permissions">nestjs-acl-permissions</a></strong>
138+
</td>
139+
<td>
140+
Type-safe ACL module with CASL integration for JSON:API endpoints. Features template interpolation, field-level permissions, context-based rules, lazy evaluation, and transparent ORM-level filtering. Can be used standalone or with automatic integration via <code>json-api-nestjs</code>.
141+
</td>
142+
</tr>
143+
</table>
8144

145+
---
9146

10-
- **[JSON:API](https://jsonapi.org/)** – A specification for building RESTful APIs with standardized request and response formats.
11-
12-
> **[json-api-nestjs](https://github.com/klerick/nestjs-json-api/tree/master/libs/json-api/json-api-nestjs)** - This package enables you to quickly set up a server API that adheres to the JSON:API specification, handling standard CRUD operations for your resources.</br>
13-
> **[json-api-nestjs-microorm](https://github.com/klerick/nestjs-json-api/tree/master/libs/json-api/json-api-nestjs-microorm)** - This package is adapter for MicroOrm.</br>
14-
> **[json-api-nestjs-typeorm](https://github.com/klerick/nestjs-json-api/tree/master/libs/json-api/json-api-nestjs-typeorm)** - This package is adapter for TypeOrm.</br>
15-
> **[json-api-nestjs-sdk](https://github.com/klerick/nestjs-json-api/tree/master/libs/json-api/json-api-nestjs-sdk)** - tool for client, call api over *json-api-nestjs*
147+
## 🚀 Quick Start
16148

149+
### Installation
17150

18-
- **[JSON-RPC](https://www.jsonrpc.org/)** – A protocol for remote procedure calls using JSON.
151+
This monorepo uses [Nx](https://nx.dev/) and supports **TypeORM** and **MikroORM** with [PGlite](https://github.com/electric-sql/pglite) for local development.
19152

20-
> **[nestjs-json-rpc](https://github.com/klerick/nestjs-json-api/tree/master/libs/json-rpc/nestjs-json-rpc)** - Use this package to implement remote procedure call (RPC) functionality in your NestJS applications, enabling efficient inter-service communication.</br>
21-
> **[nestjs-json-rpc-sdk](https://github.com/klerick/nestjs-json-api/tree/master/libs/json-rpc/nestjs-json-rpc-sdk)** - This tool offers a straightforward way to call remote procedures from your client-side code, ensuring smooth communication with your JSON-RPC server.
153+
```bash
154+
# Install dependencies
155+
npm install
156+
```
157+
158+
#### Setup TypeORM Database
159+
160+
```bash
161+
# Initialize database and run migrations
162+
npm run typeorm:up:remove # Removes existing DB and runs migrations
163+
164+
# Or just run migrations (if DB exists)
165+
npm run typeorm:up
166+
167+
# Seed the database
168+
npm run typeorm:seeder
169+
```
22170

23-
- **ACL tools** - tool for acl over *json-api-nestjs*(coming soon...)
24-
## Installation
171+
#### Setup MikroORM Database
25172

26173
```bash
27-
$ npm install
28-
$ npm run typeorm:run
29-
$ npm run seed:run
174+
# Initialize database and run migrations
175+
npm run microorm:up:remove # Removes existing DB and runs migrations
176+
177+
# Or just run migrations (if DB exists)
178+
npm run microorm:up
179+
180+
# Seed the database
181+
npm run microorm:seeder
30182
```
31183

32-
## Running the example app
184+
---
185+
186+
### Running Demo Applications
187+
188+
#### JSON:API Server (TypeORM)
33189

34190
```bash
35-
# dev server
36-
$ nx run json-api-server:serve:development
191+
# Using npm script
192+
npm run demo:json-api
193+
194+
# Or using nx directly
195+
nx run json-api-server:serve-typeorm
196+
```
197+
198+
Server will start on `http://localhost:3000` (or configured port)
199+
200+
Available endpoints:
201+
- `GET /api/users` - List all users
202+
- `GET /api/users/:id` - Get single user
203+
- `POST /api/users` - Create user
204+
- `PATCH /api/users/:id` - Update user
205+
- `DELETE /api/users/:id` - Delete user
206+
- `GET /api/users/:id/relationships/:rel` - Get relationships
207+
- And more...
37208

209+
#### JSON:API Server (MikroORM)
210+
211+
```bash
212+
# Using nx
213+
nx run json-api-server:serve-microorm
38214
```
39-
## License
40215

41-
The plugin is [MIT licensed](LICENSE).
216+
---
217+
218+
## 🌟 Features
219+
220+
- **Automatic CRUD Generation** – Generate complete REST APIs from ORM entities
221+
- **JSON:API Compliant** – Full specification support including relationships, filtering, sorting, pagination, sparse fieldsets
222+
- **Atomic Operations** – Perform multiple operations in a single request
223+
- **Type Safety** – Full TypeScript support with type inference
224+
- **Multiple ORMs** – Support for TypeORM and MikroORM
225+
- **JSON-RPC 2.0** – Implement RPC servers with HTTP/WebSocket transports
226+
- **Access Control** – Fine-grained permissions with CASL integration
227+
- **Swagger/OpenAPI** – Automatic API documentation generation
228+
- **Extensible** – Override default controllers and services
229+
230+
---
231+
232+
## 📖 Documentation
233+
234+
Each package has detailed documentation in its own README:
235+
236+
- [json-api-nestjs](libs/json-api/json-api-nestjs/README.md)
237+
- [json-api-nestjs-typeorm](libs/json-api/json-api-nestjs-typeorm/README.md)
238+
- [json-api-nestjs-microorm](libs/json-api/json-api-nestjs-microorm/README.md)
239+
- [json-api-nestjs-sdk](libs/json-api/json-api-nestjs-sdk/README.md)
240+
- [nestjs-json-rpc](libs/json-rpc/nestjs-json-rpc/README.md)
241+
- [nestjs-json-rpc-sdk](libs/json-rpc/nestjs-json-rpc-sdk/README.md)
242+
- [nestjs-acl-permissions](libs/acl-permissions/nestjs-acl-permissions/README.md)
243+
244+
---
245+
246+
## 🤝 Contributing
247+
248+
Contributions are welcome! Please feel free to submit a Pull Request.
249+
250+
---
251+
252+
## 📝 License
253+
254+
This project is [MIT licensed](LICENSE).
255+
256+
---
257+
258+
<p align="center">Made with ❤️ by <a href="https://github.com/klerick">Aleksandr Kharkovey</a></p>

docker-compose.yaml

Lines changed: 0 additions & 42 deletions
This file was deleted.

nx.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,8 @@
155155
"releaseTagPattern": "{projectName}@{version}"
156156
},
157157
"defaultBase": "master",
158-
"nxCloudId": "67c859dd862a93f16da79c89"
158+
"nxCloudId": "67c859dd862a93f16da79c89",
159+
"tui": {
160+
"enabled": false
161+
}
159162
}

0 commit comments

Comments
 (0)