Skip to content

Commit e4645e3

Browse files
Merge pull request #4 from muneebhashone/openapi-integration
Openapi integration
2 parents 36ca503 + d955a67 commit e4645e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+989
-2033928
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,12 @@ Before you get started, make sure you have the following installed on your machi
2424
```sh
2525
docker compose up -d
2626
```
27-
2827
2. **Install Dependencies**:
2928

3029
- Use pnpm to install all the necessary dependencies:
3130
```sh
3231
pnpm i
3332
```
34-
3533
3. **Configure Environment Variables**:
3634

3735
- Create a `.env` file in the root directory.
@@ -83,3 +81,7 @@ Before you get started, make sure you have the following installed on your machi
8381
## Contributions
8482

8583
Feel free to contribute to this project by submitting issues or pull requests. Let's build something amazing together!
84+
85+
## **License**
86+
87+
This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.

build.ts

+1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ export default defineConfig({
99
minify: true,
1010
platform: 'node',
1111
tsconfig: 'tsconfig.json',
12+
keepNames: true,
1213
});

docker-compose.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ services:
1010
MONGO_INITDB_ROOT_USERNAME: root
1111
MONGO_INITDB_ROOT_PASSWORD: example
1212
volumes:
13-
- mongodb_city_link:/data/db
13+
- mongodb_typescript_backend_toolkit:/data/db
1414

1515
redis:
1616
image: redis:latest
@@ -20,6 +20,6 @@ services:
2020
- redis:/data
2121

2222
volumes:
23-
mongodb_city_link:
23+
mongodb_typescript_backend_toolkit:
2424
external: true
2525
redis:

documentation/Insomnia_2024-08-11.json

-1
This file was deleted.

ecosystem.config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module.exports = {
22
apps: [
33
{
4-
name: 'city-link-api',
4+
name: 'typescript-backend-toolkit',
55
script: './dist/main.js',
66
},
77
],

openapi-docs.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
openapi: 3.0.0
2+
info:
3+
version: 1.0.0
4+
title: My API
5+
description: This is the API
6+
servers:
7+
- url: v1
8+
components:
9+
securitySchemes:
10+
bearerAuth:
11+
type: http
12+
scheme: bearer
13+
bearerFormat: JWT
14+
schemas:
15+
UserId:
16+
type: string
17+
example: "1212121"
18+
User:
19+
type: object
20+
properties:
21+
id:
22+
type: string
23+
example: "1212121"
24+
name:
25+
type: string
26+
example: John Doe
27+
age:
28+
type: number
29+
example: 42
30+
required:
31+
- id
32+
- name
33+
- age
34+
parameters:
35+
UserId:
36+
schema:
37+
$ref: "#/components/schemas/UserId"
38+
required: true
39+
name: id
40+
in: path
41+
paths:
42+
/users/{id}:
43+
get:
44+
description: Get user data by its id
45+
summary: Get a single user
46+
security:
47+
- bearerAuth: []
48+
parameters:
49+
- $ref: "#/components/parameters/UserId"
50+
responses:
51+
"200":
52+
description: Object with user data.
53+
content:
54+
application/json:
55+
schema:
56+
$ref: "#/components/schemas/User"
57+
"204":
58+
description: No content - successful operation

package.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "shipment-tracking-queue",
2+
"name": "typescript-backend-toolkit",
33
"version": "1.0.0",
44
"description": "",
55
"main": "dist/main.js",
@@ -30,6 +30,7 @@
3030
"@types/node": "^18.11.18",
3131
"@types/nodemailer": "^6.4.8",
3232
"@types/passport": "^1.0.11",
33+
"@types/swagger-ui-express": "^4.1.6",
3334
"@types/validator": "^13.7.17",
3435
"@typescript-eslint/eslint-plugin": "^5.62.0",
3536
"@typescript-eslint/parser": "^7.11.0",
@@ -47,6 +48,7 @@
4748
"typescript-eslint": "^7.11.0"
4849
},
4950
"dependencies": {
51+
"@asteasolutions/zod-to-openapi": "^7.1.1",
5052
"@aws-sdk/client-s3": "^3.606.0",
5153
"@bull-board/api": "^5.19.0",
5254
"@bull-board/express": "^5.16.0",
@@ -81,14 +83,17 @@
8183
"multer-s3": "^3.0.1",
8284
"nanoid": "^3.3.7",
8385
"nodemailer": "^6.9.13",
86+
"openapi3-ts": "^4.3.3",
8487
"passport": "^0.7.0",
8588
"passport-jwt": "^4.0.1",
8689
"pino": "^9.1.0",
8790
"pino-http": "^10.1.0",
8891
"pino-pretty": "^11.1.0",
8992
"redis": "^4.6.11",
9093
"socket.io": "^4.7.5",
94+
"swagger-ui-express": "^5.0.1",
9195
"validator": "^13.12.0",
96+
"yaml": "^2.5.0",
9297
"zod": "^3.21.4"
9398
},
9499
"author": "",

pnpm-lock.yaml

+61-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

0 commit comments

Comments
 (0)