feat: reorganize project into seperate frontend and backend code
This commit is contained in:
parent
c4d152cf7a
commit
65b957fbc2
169 changed files with 14596 additions and 484 deletions
|
@ -1,63 +0,0 @@
|
||||||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
|
||||||
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
|
|
||||||
{
|
|
||||||
"name": "waterwolf-auth",
|
|
||||||
// Update the 'dockerComposeFile' list if you have more compose files or use different names.
|
|
||||||
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
|
|
||||||
"dockerComposeFile": ["../docker-compose.yml", "docker-compose.yml"],
|
|
||||||
// The 'service' property is the name of the service for the container that VS Code should
|
|
||||||
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
|
|
||||||
"service": "waterwolf-auth",
|
|
||||||
// The optional 'workspaceFolder' property is the path VS Code should open by default when
|
|
||||||
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
|
|
||||||
"workspaceFolder": "/app/",
|
|
||||||
"features": {
|
|
||||||
"ghcr.io/cirolosapio/devcontainers-features/alpine-git:0": {}
|
|
||||||
},
|
|
||||||
// Features to add to the dev container. More info: https://containers.dev/features.
|
|
||||||
// "features": {},
|
|
||||||
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
||||||
"forwardPorts": [3000, "mysql:3306", "redis:6379"],
|
|
||||||
|
|
||||||
"portsAttributes": {
|
|
||||||
"3000": {
|
|
||||||
"label": "Application port"
|
|
||||||
},
|
|
||||||
"9464": {
|
|
||||||
"label": "Metrics port",
|
|
||||||
"onAutoForward": "ignore"
|
|
||||||
},
|
|
||||||
"mysql:3306": {
|
|
||||||
"label": "MySQL"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// Uncomment the next line if you want start specific services in your Docker Compose config.
|
|
||||||
// "runServices": [],
|
|
||||||
// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
|
|
||||||
// "shutdownAction": "none",
|
|
||||||
// Uncomment the next line to run commands after the container is created.
|
|
||||||
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
|
|
||||||
// Configure tool-specific properties.
|
|
||||||
"customizations": {
|
|
||||||
"vscode": {
|
|
||||||
"extensions": [
|
|
||||||
"dbaeumer.vscode-eslint",
|
|
||||||
"editorconfig.editorconfig",
|
|
||||||
"github.vscode-github-actions",
|
|
||||||
"visualstudioexptteam.vscodeintellicode",
|
|
||||||
"orta.vscode-jest",
|
|
||||||
"eamodio.gitlens",
|
|
||||||
"firsttris.vscode-jest-runner",
|
|
||||||
"christian-kohler.path-intellisense",
|
|
||||||
"esbenp.prettier-vscode",
|
|
||||||
"rvest.vs-code-prettier-eslint",
|
|
||||||
"steoates.autoimport",
|
|
||||||
"pmneo.tsimporter",
|
|
||||||
"christian-kohler.npm-intellisense",
|
|
||||||
"rohinivsenthil.rabbitrace"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
|
|
||||||
// "remoteUser": "devcontainer"
|
|
||||||
}
|
|
|
@ -1,26 +0,0 @@
|
||||||
version: '3.8'
|
|
||||||
services:
|
|
||||||
# Update this to the name of the service you want to work with in your docker-compose.yml file
|
|
||||||
waterwolf-auth:
|
|
||||||
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
|
|
||||||
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
|
|
||||||
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
|
|
||||||
# array). The sample below assumes your primary file is in the root of your project.
|
|
||||||
#
|
|
||||||
# build:
|
|
||||||
# context: .
|
|
||||||
# dockerfile: .devcontainer/Dockerfile
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
# Update this to wherever you want VS Code to mount the folder of your project
|
|
||||||
- ..:/app:cached
|
|
||||||
|
|
||||||
# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
|
|
||||||
# cap_add:
|
|
||||||
# - SYS_PTRACE
|
|
||||||
# security_opt:
|
|
||||||
# - seccomp:unconfined
|
|
||||||
|
|
||||||
# Overrides default command so things don't shut down after the process ends.
|
|
||||||
command: /bin/sh -c "while sleep 1000; do :; done"
|
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -90,7 +90,7 @@ out
|
||||||
|
|
||||||
# Nuxt.js build / generate output
|
# Nuxt.js build / generate output
|
||||||
.nuxt
|
.nuxt
|
||||||
dist
|
apps/backend/dist
|
||||||
|
|
||||||
# Gatsby files
|
# Gatsby files
|
||||||
.cache/
|
.cache/
|
||||||
|
|
|
@ -5,6 +5,7 @@ ENV PATH="$PNPM_HOME:$PATH"
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
COPY . /app
|
COPY . /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
RUN rm -rf /app/node_modules
|
||||||
|
|
||||||
# Install Prod Dependencies
|
# Install Prod Dependencies
|
||||||
FROM base AS prod-deps
|
FROM base AS prod-deps
|
|
@ -1,9 +1,9 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://json.schemastore.org/nest-cli",
|
"$schema": "https://json.schemastore.org/nest-cli",
|
||||||
"collection": "@nestjs/schematics",
|
"collection": "@nestjs/schematics",
|
||||||
"sourceRoot": "src",
|
"sourceRoot": "src",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"deleteOutDir": true,
|
"deleteOutDir": true,
|
||||||
"plugins": ["@nestjs/swagger"]
|
"plugins": ["@nestjs/swagger"]
|
||||||
}
|
}
|
||||||
}
|
}
|
117
apps/backend/package.json
Normal file
117
apps/backend/package.json
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
{
|
||||||
|
"name": "waterwolf-oauth-core",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "",
|
||||||
|
"author": "",
|
||||||
|
"private": true,
|
||||||
|
"license": "UNLICENSED",
|
||||||
|
"scripts": {
|
||||||
|
"build": "nest build",
|
||||||
|
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
|
||||||
|
"start": "nest start",
|
||||||
|
"dev": "nest start --watch",
|
||||||
|
"start:debug": "nest start --debug --watch",
|
||||||
|
"start:prod": "node dist/main",
|
||||||
|
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
|
||||||
|
"test": "jest",
|
||||||
|
"test:watch": "jest --watch",
|
||||||
|
"test:cov": "jest --coverage",
|
||||||
|
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
|
||||||
|
"test:e2e": "jest --config ./test/jest-e2e.json",
|
||||||
|
"typeorm": "ts-node --project tsconfig.json ./node_modules/typeorm/cli",
|
||||||
|
"typeorm:run-migrations": "npm run typeorm migration:run -- -d ./src/app.datasource.ts",
|
||||||
|
"typeorm:generate-migration": "npm run typeorm -- -d ./src/app.datasource.ts migration:generate ./src/database/migrations/$npm_config_name",
|
||||||
|
"typeorm:create-migration": "npm run typeorm -- migration:create ./src/database/migrations/$npm_config_name",
|
||||||
|
"typeorm:revert-migration": "npm run typeorm -- -d ./src/app.datasource.ts migration:revert",
|
||||||
|
"prepare": "ts-patch install && typia patch"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@atech/postal": "^1.0.0",
|
||||||
|
"@nestjs/bullmq": "^10.2.1",
|
||||||
|
"@nestjs/common": "^10.4.4",
|
||||||
|
"@nestjs/config": "^3.2.3",
|
||||||
|
"@nestjs/core": "^10.4.4",
|
||||||
|
"@nestjs/platform-express": "^10.4.4",
|
||||||
|
"@nestjs/serve-static": "^4.0.2",
|
||||||
|
"@nestjs/swagger": "^7.4.2",
|
||||||
|
"@nestjs/terminus": "^10.2.3",
|
||||||
|
"@nestjs/typeorm": "^10.0.2",
|
||||||
|
"@opentelemetry/api": "^1.9.0",
|
||||||
|
"argon2": "^0.40.3",
|
||||||
|
"axios": "^1.7.7",
|
||||||
|
"axios-retry": "^4.5.0",
|
||||||
|
"bullmq": "^5.20.0",
|
||||||
|
"class-transformer": "^0.5.1",
|
||||||
|
"class-validator": "^0.14.1",
|
||||||
|
"cookie-parser": "^1.4.7",
|
||||||
|
"dotenv": "^16.4.5",
|
||||||
|
"handlebars": "^4.7.8",
|
||||||
|
"hbs": "^4.2.0",
|
||||||
|
"ioredis": "^5.4.1",
|
||||||
|
"keygrip": "^1.1.0",
|
||||||
|
"mysql2": "^3.11.3",
|
||||||
|
"nanoid": "^5.0.7",
|
||||||
|
"nestjs-cls": "^4.4.1",
|
||||||
|
"nestjs-http-promise": "^3.0.0",
|
||||||
|
"nestjs-otel": "^6.1.1",
|
||||||
|
"nestjs-postal-client": "^0.0.6",
|
||||||
|
"oidc-provider": "^8.5.1",
|
||||||
|
"psl": "^1.9.0",
|
||||||
|
"pug": "^3.0.3",
|
||||||
|
"reflect-metadata": "^0.2.2",
|
||||||
|
"rxjs": "^7.8.1",
|
||||||
|
"typeorm": "^0.3.20",
|
||||||
|
"typia": "^6.11.2",
|
||||||
|
"uuid": "^10.0.0",
|
||||||
|
"wildcard": "^2.0.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@nestjs/cli": "^10.4.5",
|
||||||
|
"@nestjs/schematics": "^10.1.4",
|
||||||
|
"@nestjs/testing": "^10.4.4",
|
||||||
|
"@types/cookie-parser": "^1.4.7",
|
||||||
|
"@types/express": "^4.17.21",
|
||||||
|
"@types/jest": "^29.5.13",
|
||||||
|
"@types/keygrip": "^1.0.6",
|
||||||
|
"@types/node": "^20.16.11",
|
||||||
|
"@types/oidc-provider": "^8.5.2",
|
||||||
|
"@types/psl": "^1.1.3",
|
||||||
|
"@types/supertest": "^6.0.2",
|
||||||
|
"@types/uuid": "^10.0.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||||
|
"@typescript-eslint/parser": "^7.18.0",
|
||||||
|
"eslint": "^8.57.1",
|
||||||
|
"eslint-config-prettier": "^9.1.0",
|
||||||
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
|
"jest": "^29.7.0",
|
||||||
|
"prettier": "^3.3.3",
|
||||||
|
"sequelize-cli": "^6.6.2",
|
||||||
|
"source-map-support": "^0.5.21",
|
||||||
|
"supertest": "^7.0.0",
|
||||||
|
"tailwindcss": "^3.4.14",
|
||||||
|
"ts-jest": "^29.2.5",
|
||||||
|
"ts-loader": "^9.5.1",
|
||||||
|
"ts-node": "^10.9.2",
|
||||||
|
"ts-patch": "^3.2.1",
|
||||||
|
"tsconfig-paths": "^4.2.0",
|
||||||
|
"typescript": "^5.6.2"
|
||||||
|
},
|
||||||
|
"jest": {
|
||||||
|
"moduleFileExtensions": [
|
||||||
|
"js",
|
||||||
|
"json",
|
||||||
|
"ts"
|
||||||
|
],
|
||||||
|
"rootDir": "src",
|
||||||
|
"testRegex": ".*\\.spec\\.ts$",
|
||||||
|
"transform": {
|
||||||
|
"^.+\\.(t|j)s$": "ts-jest"
|
||||||
|
},
|
||||||
|
"collectCoverageFrom": [
|
||||||
|
"**/*.(t|j)s"
|
||||||
|
],
|
||||||
|
"coverageDirectory": "../coverage",
|
||||||
|
"testEnvironment": "node"
|
||||||
|
},
|
||||||
|
"packageManager": "pnpm@9.5.0+sha512.140036830124618d624a2187b50d04289d5a087f326c9edfc0ccd733d76c4f52c3a313d4fc148794a2a9d81553016004e6742e8cf850670268a7387fc220c903"
|
||||||
|
}
|
8700
apps/backend/pnpm-lock.yaml
Normal file
8700
apps/backend/pnpm-lock.yaml
Normal file
File diff suppressed because it is too large
Load diff
|
@ -46,6 +46,7 @@ import { ViewModule } from './view/view.module';
|
||||||
cache: true,
|
cache: true,
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
load: [config, databaseConfig],
|
load: [config, databaseConfig],
|
||||||
|
envFilePath: ['.env', '.env.local', '../../.env', '../../.env.local'],
|
||||||
}),
|
}),
|
||||||
TypeOrmModule.forRootAsync({
|
TypeOrmModule.forRootAsync({
|
||||||
imports: [ConfigModule],
|
imports: [ConfigModule],
|
|
@ -1,6 +1,6 @@
|
||||||
import { createParamDecorator } from '@nestjs/common';
|
import { createParamDecorator } from '@nestjs/common';
|
||||||
import { ClsServiceManager } from 'nestjs-cls';
|
import { ClsServiceManager } from 'nestjs-cls';
|
||||||
import { User } from 'src/database/models/user.model';
|
import { User } from '../../database/models/user.model';
|
||||||
|
|
||||||
export const CurrentUser = createParamDecorator((): User | null => {
|
export const CurrentUser = createParamDecorator((): User | null => {
|
||||||
const cls = ClsServiceManager.getClsService();
|
const cls = ClsServiceManager.getClsService();
|
|
@ -402,7 +402,7 @@ export class OidcService implements OnModuleInit {
|
||||||
* @returns {Promise<void>} - Returns a promise that resolves when the keys are loaded
|
* @returns {Promise<void>} - Returns a promise that resolves when the keys are loaded
|
||||||
*/
|
*/
|
||||||
private async loadKeys(): Promise<void> {
|
private async loadKeys(): Promise<void> {
|
||||||
const keysFolder = this.getKeysFolder();
|
const keysFolder = await this.getKeysFolder();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.jwks = JSON.parse(await fs.readFile(keysFolder + 'keys/jwks.json', 'utf8'));
|
this.jwks = JSON.parse(await fs.readFile(keysFolder + 'keys/jwks.json', 'utf8'));
|
||||||
|
@ -418,7 +418,8 @@ export class OidcService implements OnModuleInit {
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
return __dirname + '/../../../../../';
|
return __dirname + '/../../../../../';
|
||||||
}
|
}
|
||||||
return __dirname + '/../../../../';
|
|
||||||
|
return __dirname.split('apps')[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -2,7 +2,7 @@ import { Module } from '@nestjs/common';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
|
|
||||||
import { RedisModule } from '../redis/redis.module';
|
import { RedisModule } from '../redis/redis.module';
|
||||||
import { DATABASE_ENTITIES } from 'src/database/database.entities';
|
import { DATABASE_ENTITIES } from '../database/database.entities';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [TypeOrmModule.forFeature(DATABASE_ENTITIES), RedisModule],
|
imports: [TypeOrmModule.forFeature(DATABASE_ENTITIES), RedisModule],
|
|
@ -59,6 +59,6 @@ async function bootstrap() {
|
||||||
app.setBaseViewsDir(join(__dirname, '..', 'views'));
|
app.setBaseViewsDir(join(__dirname, '..', 'views'));
|
||||||
app.setViewEngine('hbs');
|
app.setViewEngine('hbs');
|
||||||
|
|
||||||
await app.listen(3000);
|
await app.listen(3001);
|
||||||
}
|
}
|
||||||
bootstrap();
|
bootstrap();
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue