Skip to content

Commit ffbb458

Browse files
committed
feat: added logger interceptor
1 parent d77d61c commit ffbb458

File tree

14 files changed

+415
-74
lines changed

14 files changed

+415
-74
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ This is an Express service written in [TypeScript](https://www.typescriptlang.or
1717
- [PostgreSQL](https://www.postgresql.org/) database for store user data
1818
- [Prisma ORM](https://www.prisma.io/) for managing the database
1919
- Automated [OpenAPI](https://www.openapis.org/what-is-openapi) specifications using [JsDocs](https://jsdoc.app/) and [Swagger UI](https://swagger.io/tools/swagger-ui/) for generating documentation.
20+
- [Role-Based Access Control (RBAC)](https://www.redhat.com/en/topics/security/what-is-role-based-access-control) for managing API resources
21+
- Rotate Logs using [Winston](https://github.com/winstonjs/winston)
2022

2123
## Project Structure
2224

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
volumes:
1616
- ./src:/usr/workspace/app/src
1717
- pnpm_store:/pnpm/.pnpm-store
18-
command: sh -c "pnpm install && node dynamic-url-config.js && npx prisma generate && pnpm dev"
18+
command: sh -c "pnpm migrate:dev && pnpm dev"
1919
depends_on:
2020
- postgres
2121
- redis

dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ ENV PNPM_HOME="/pnpm"
77
ENV PATH="$PNPM_HOME:$PATH"
88
RUN mkdir -p $PNPM_HOME
99

10-
RUN pnpm config set store-dir "$PNPM_HOME/.pnpm-store" --global
10+
COPY . .
1111

12-
COPY package.json pnpm-lock.yaml* dynamic-url-config.js ./
12+
RUN pnpm config set store-dir "$PNPM_HOME/.pnpm-store" --global
13+
RUN apk add --no-cache openssl
1314
RUN pnpm install --frozen-lockfile
14-
COPY . .
1515

1616
EXPOSE 3000
17-
CMD [ "pnpm", "start" ]
17+
CMD [ "pnpm", "start" ]w

package.json

Lines changed: 57 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,59 @@
11
{
2-
"name": "genai-langchain-api",
3-
"version": "1.0.0",
4-
"description": "This is an Express service that provides authorization functionality and includes gen-AI features using RAG, Redis, Postgres, and Langchain.",
5-
"scripts": {
6-
"prestart": "node dynamic-url-config.js",
7-
"predev": "node dynamic-url-config.js",
8-
"start": "tsx src/app.ts",
9-
"dev": "tsx watch src/app.ts"
10-
},
11-
"keywords": [
12-
"AI",
13-
"LangChain",
14-
"LLM",
15-
"Express",
16-
"RAG"
17-
],
18-
"author": "William Amaral",
19-
"license": "ISC",
20-
"dependencies": {
21-
"@langchain/community": "^0.3.1",
22-
"@langchain/core": "^0.3.3",
23-
"@langchain/google-genai": "^0.1.0",
24-
"@langchain/redis": "^0.1.0",
25-
"@prisma/client": "5.20.0",
26-
"@types/redis": "^4.0.11",
27-
"express": "^4.21.0",
28-
"jsonwebtoken": "^9.0.2",
29-
"langchain": "^0.3.2",
30-
"multer": "1.4.5-lts.1",
31-
"pdf-parse": "^1.1.1",
32-
"redis": "^4.7.0",
33-
"swagger-jsdoc": "^6.2.8",
34-
"swagger-ui-express": "^5.0.1",
35-
"zod": "^3.23.8"
36-
},
37-
"devDependencies": {
38-
"@types/cors": "^2.8.17",
39-
"@types/express": "^4.17.21",
40-
"@types/jsonwebtoken": "^9.0.7",
41-
"@types/multer": "^1.4.12",
42-
"@types/node": "^22.5.5",
43-
"@types/swagger-jsdoc": "^6.0.4",
44-
"@types/swagger-ui-express": "^4.1.6",
45-
"cors": "^2.8.5",
46-
"dotenv": "^16.4.5",
47-
"nodemon": "^3.1.4",
48-
"prisma": "^5.20.0",
49-
"ts-node": "^10.9.2",
50-
"tslib": "^2.7.0",
51-
"tsx": "^4.19.1",
52-
"typescript": "^5.6.2"
53-
},
54-
"packageManager": "[email protected]+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b"
2+
"name": "genai-langchain-api",
3+
"version": "1.0.0",
4+
"description": "This is an Express service that provides authorization functionality and includes gen-AI features using RAG, Redis, Postgres, and Langchain.",
5+
"scripts": {
6+
"prestart": "node dynamic-url-config.js",
7+
"migrate:dev": "npx prisma migrate dev",
8+
"predev": "node dynamic-url-config.js",
9+
"start": "tsx src/app.ts",
10+
"dev": "tsx watch src/app.ts",
11+
"postinstall": "npx prisma generate"
12+
},
13+
"keywords": [
14+
"AI",
15+
"LangChain",
16+
"LLM",
17+
"Express",
18+
"RAG"
19+
],
20+
"author": "William Amaral",
21+
"license": "ISC",
22+
"dependencies": {
23+
"@langchain/community": "^0.3.1",
24+
"@langchain/core": "^0.3.3",
25+
"@langchain/google-genai": "^0.1.0",
26+
"@langchain/redis": "^0.1.0",
27+
"@prisma/client": "5.20.0",
28+
"@types/redis": "^4.0.11",
29+
"express": "^4.21.0",
30+
"jsonwebtoken": "^9.0.2",
31+
"langchain": "^0.3.2",
32+
"multer": "1.4.5-lts.1",
33+
"pdf-parse": "^1.1.1",
34+
"redis": "^4.7.0",
35+
"swagger-jsdoc": "^6.2.8",
36+
"swagger-ui-express": "^5.0.1",
37+
"winston": "^3.17.0",
38+
"winston-daily-rotate-file": "^5.0.0",
39+
"zod": "^3.23.8"
40+
},
41+
"devDependencies": {
42+
"@types/cors": "^2.8.17",
43+
"@types/express": "^4.17.21",
44+
"@types/jsonwebtoken": "^9.0.7",
45+
"@types/multer": "^1.4.12",
46+
"@types/node": "^22.5.5",
47+
"@types/swagger-jsdoc": "^6.0.4",
48+
"@types/swagger-ui-express": "^4.1.6",
49+
"cors": "^2.8.5",
50+
"dotenv": "^16.4.5",
51+
"nodemon": "^3.1.4",
52+
"prisma": "^5.20.0",
53+
"ts-node": "^10.9.2",
54+
"tslib": "^2.7.0",
55+
"tsx": "^4.19.1",
56+
"typescript": "^5.6.2"
57+
},
58+
"packageManager": "[email protected]+sha512.0a203ffaed5a3f63242cd064c8fb5892366c103e328079318f78062f24ea8c9d50bc6a47aa3567cabefd824d170e78fa2745ed1f16b132e16436146b7688f19b"
5559
}

0 commit comments

Comments
 (0)