@anthonylzq/simba.js 3.1.0 → 4.2.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.
- package/README.md +27 -13
- package/lib/index.js +0 -2
- package/lib/src/functions/api.js +377 -345
- package/lib/src/functions/tsconfig.js +1 -1
- package/lib/src/index.js +4 -4
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# Simba.js
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@anthonylzq/simba.js)
|
|
4
|
+
[](https://github.com/AnthonyLzq/simba.js/blob/master/LICENSE)
|
|
4
5
|
[](https://standardjs.com)
|
|
6
|
+
[](https://reactjs.org/docs/how-to-contribute.html#your-first-pull-request)
|
|
5
7
|
|
|
6
8
|
Set up a modern backend app by running one command. This project has the goal to create a complete setup for a backend application using `TypeScript` and `Express` or `Fastify`. It will create many files that are usually created manually. Think about Simba.js like a [CRA](https://create-react-app.dev/), but for backend development. Check the [**project structure**](#project-structure) for more information.
|
|
7
9
|
|
|
@@ -134,9 +136,8 @@ Regardless of the option chosen, a new folder will be generated with the name of
|
|
|
134
136
|
┃ ┗ 📜index.ts
|
|
135
137
|
┣ 📂network
|
|
136
138
|
┃ ┣ 📂routes
|
|
137
|
-
┃ ┃ ┣ 📂
|
|
138
|
-
┃ ┃ ┃
|
|
139
|
-
┃ ┃ ┃ ┗ 📜user.ts
|
|
139
|
+
┃ ┃ ┣ 📂utils
|
|
140
|
+
┃ ┃ ┃ ┗ 📜docs.ts
|
|
140
141
|
┃ ┃ ┣ 📜home.ts
|
|
141
142
|
┃ ┃ ┣ 📜index.ts
|
|
142
143
|
┃ ┃ ┗ 📜user.ts
|
|
@@ -144,6 +145,9 @@ Regardless of the option chosen, a new folder will be generated with the name of
|
|
|
144
145
|
┃ ┣ 📜response.ts
|
|
145
146
|
┃ ┣ 📜routes.ts
|
|
146
147
|
┃ ┗ 📜server.ts
|
|
148
|
+
┣ 📂schemas
|
|
149
|
+
┃ ┣ 📜index.ts
|
|
150
|
+
┃ ┗ 📜user.ts
|
|
147
151
|
┣ 📂services
|
|
148
152
|
┃ ┣ 📂utils
|
|
149
153
|
┃ ┃ ┣ 📂messages
|
|
@@ -181,8 +185,6 @@ Regardless of the option chosen, a new folder will be generated with the name of
|
|
|
181
185
|
📂node_modules
|
|
182
186
|
📂src
|
|
183
187
|
┣ 📂@types
|
|
184
|
-
┃ ┣ 📂dto
|
|
185
|
-
┃ ┃ ┗ 📜user.d.ts
|
|
186
188
|
┃ ┣ 📂models
|
|
187
189
|
┃ ┃ ┗ 📜user.d.ts
|
|
188
190
|
┃ ┗ 📜index.d.ts
|
|
@@ -198,9 +200,8 @@ Regardless of the option chosen, a new folder will be generated with the name of
|
|
|
198
200
|
┃ ┗ 📜index.ts
|
|
199
201
|
┣ 📂network
|
|
200
202
|
┃ ┣ 📂routes
|
|
201
|
-
┃ ┃ ┣ 📂
|
|
202
|
-
┃ ┃ ┃
|
|
203
|
-
┃ ┃ ┃ ┗ 📜user.ts
|
|
203
|
+
┃ ┃ ┣ 📂utils
|
|
204
|
+
┃ ┃ ┃ ┗ 📜docs.ts
|
|
204
205
|
┃ ┃ ┣ 📜docs.ts
|
|
205
206
|
┃ ┃ ┣ 📜home.ts
|
|
206
207
|
┃ ┃ ┣ 📜index.ts
|
|
@@ -209,6 +210,9 @@ Regardless of the option chosen, a new folder will be generated with the name of
|
|
|
209
210
|
┃ ┣ 📜response.ts
|
|
210
211
|
┃ ┣ 📜routes.ts
|
|
211
212
|
┃ ┗ 📜server.ts
|
|
213
|
+
┣ 📂schemas
|
|
214
|
+
┃ ┣ 📜index.ts
|
|
215
|
+
┃ ┗ 📜user.ts
|
|
212
216
|
┣ 📂services
|
|
213
217
|
┃ ┣ 📂utils
|
|
214
218
|
┃ ┃ ┣ 📂messages
|
|
@@ -269,7 +273,7 @@ If you want to check the content of the files, please check the [example](https:
|
|
|
269
273
|
|
|
270
274
|
- The provided project structure is inspired in my personal experience as [`Node.js`](https://nodejs.org/en/) developer and the [`Nest`](https://nestjs.com/) framework. It follows a layered architecture:
|
|
271
275
|
|
|
272
|
-
1. Presentation layer (network layer): it is represented by the network
|
|
276
|
+
1. Presentation layer (network layer): it is represented by the network and schemas folders, which contains the routes and the schemas necessary for each route.
|
|
273
277
|
2. Business layer (services layer): it is represented by the services folder, which contains all the code related to the business logic of your application.
|
|
274
278
|
3. Persistance layer (database layer): it is represented by the database folder, which contains the database connection, models and queries (that will be used by the services). Multiple database connection are possible and should be implemented here.
|
|
275
279
|
|
|
@@ -282,7 +286,14 @@ If you want to check the content of the files, please check the [example](https:
|
|
|
282
286
|
|
|
283
287
|
## What is new?
|
|
284
288
|
|
|
285
|
-
Please check the [`changelog.md`](https://github.com/AnthonyLzq/simba.js/blob/master/CHANGELOG.md) file. Also, if you want to check what is coming, check the [road map](https://simbajs.notion.site/simbajs/783092dc7d444067b4c56a25d671f658?v=31060f3d17524ca58870e86c2960a6df).
|
|
289
|
+
Please check the [`changelog.md`](https://github.com/AnthonyLzq/simba.js/blob/master/CHANGELOG.md) file. Also, if you want to check what is coming, check the [road map](https://simbajs.notion.site/simbajs/783092dc7d444067b4c56a25d671f658?v=31060f3d17524ca58870e86c2960a6df).
|
|
290
|
+
|
|
291
|
+
### Version 4.x.x
|
|
292
|
+
|
|
293
|
+
In this major version I would be focusing on adding new possible configurations according to the road map. The major changes of this version will be described here:
|
|
294
|
+
|
|
295
|
+
- Replaced [`joi`](https://www.npmjs.com/package/joi) in favor of [`ajv`](https://www.npmjs.com/package/ajv) + [`@sinclair/typebox`](https://www.npmjs.com/package/@sinclair/typebox) in the Express case. [Why did I do this?](https://simbajs.notion.site/TypeBox-support-for-Express-f4e3cf8dd06f4c7ba4d8e4051a52688c)
|
|
296
|
+
- Using more descriptive nouns, now every database object is represented with a DBO at the end, like: _UserDBO_. Also the objects that are sent and received will have a DTO at the end, like: _UserDTO_.
|
|
286
297
|
|
|
287
298
|
## <a name="notes"></a>Notes
|
|
288
299
|
|
|
@@ -312,6 +323,8 @@ Here is the list of the packages that are being installed, as `devDependencies`:
|
|
|
312
323
|
|
|
313
324
|
As `dependencies`:
|
|
314
325
|
|
|
326
|
+
- [`@sinclair/typebox`](https://www.npmjs.com/package/@sinclair/typebox)
|
|
327
|
+
- [`ajv`](https://www.npmjs.com/package/ajv)
|
|
315
328
|
- [`http-errors`](https://www.npmjs.com/package/http-errors)
|
|
316
329
|
- [`mongoose`](https://mongoosejs.com/)
|
|
317
330
|
|
|
@@ -320,13 +333,14 @@ As `dependencies`:
|
|
|
320
333
|
As `devDependencies`:
|
|
321
334
|
|
|
322
335
|
- [`@types/express`](https://www.npmjs.com/package/@types/express)
|
|
336
|
+
- [`@types/cors`](https://www.npmjs.com/package/@types/cors)
|
|
323
337
|
- [`@types/morgan`](https://www.npmjs.com/package/@types/morgan)
|
|
324
338
|
- [`@types/swagger-ui-express`](https://www.npmjs.com/package/@types/swagger-ui-express)
|
|
325
339
|
|
|
326
340
|
As `dependencies`:
|
|
327
341
|
|
|
328
|
-
- [`
|
|
329
|
-
- [`
|
|
342
|
+
- [`cors`](https://www.npmjs.com/package/cors)
|
|
343
|
+
- [`express`](https://www.npmjs.com/package/express)
|
|
330
344
|
- [`morgan`](https://www.npmjs.com/package/morgan)
|
|
331
345
|
- [`swagger-ui-express`](https://www.npmjs.com/package/swagger-ui-express)
|
|
332
346
|
|
|
@@ -334,8 +348,8 @@ As `dependencies`:
|
|
|
334
348
|
|
|
335
349
|
As `dependencies`:
|
|
336
350
|
|
|
337
|
-
- [`@sinclair/typebox`](https://www.npmjs.com/package/@sinclair/typebox)
|
|
338
351
|
- [`fastify`](https://www.npmjs.com/package/fastify)
|
|
352
|
+
- [`fastify-cors`](https://www.npmjs.com/package/fastify-cors)
|
|
339
353
|
- [`fastify-swagger`](https://www.npmjs.com/package/fastify-swagger)
|
|
340
354
|
|
|
341
355
|
Feel free to contribute to this project. Every contribution will be appreciated.
|