Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Starting the whole app #60

Merged
merged 4 commits into from
Oct 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"license": "UNLICENSED",
"scripts": {
"build": "nest build",
"start": "nest start",
"dev": "nest start --exec \"node --env-file=.env\" --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"start:old": "nest start --exec \"node --env-file=.env\"",
"start:debug": "nest start --debug --watch",
"start": "node --env-file=.env dist/src/main.js",
"typecheck": "tsc --noEmit",
"test": "jest",
"test:watch": "jest --watch",
Expand All @@ -32,6 +32,7 @@
"@nestjs/graphql": "^12.2.0",
"@nestjs/passport": "^10.0.3",
"@nestjs/platform-express": "^10.0.0",
"@nestjs/serve-static": "^4.0.2",
"argon2": "^0.41.1",
"cache-manager": "^6.1.0",
"class-transformer": "^0.5.1",
Expand Down
5 changes: 5 additions & 0 deletions apps/api/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Module } from "@nestjs/common";
import { ConfigModule } from "@nestjs/config";
import { APP_GUARD } from "@nestjs/core";
import { GraphQLModule } from "@nestjs/graphql";
import { ServeStaticModule } from "@nestjs/serve-static";
import { Request, Response } from "express";
import { AppResolver } from "./app.resolver";
import { AppService } from "./app.service";
Expand Down Expand Up @@ -40,6 +41,10 @@ import { validate } from "./utils/env.validate";
database: String(process.env.POSTGRES_DB),
}),
AuthModule,
ServeStaticModule.forRoot({
rootPath: join(__dirname, "../../..", "web", "dist"),
exclude: ["/api*", "/graphql*"],
}),
],
providers: [
AppService,
Expand Down
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"dev": "vite",
"build": "tsc -b && vite build",
"start": "pnpm run preview",
"typecheck": "tsc -b --noEmit",
"preview": "vite preview"
},
Expand Down
28 changes: 0 additions & 28 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,9 @@ services:
- 5432:5432
env_file:
- ./apps/api/.env
# environment:
# - POSTGRES_DB
# - POSTGRES_USER
# - POSTGRES_PASSWORD

# db-test:
# image: postgres:14.1-alpine
# restart: always
# ports:
# - 5433:5432
# environment:
# POSTGRES_DB: disworse-test
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: postgres

cache:
image: redis
container_name: cache
restart: always
ports:
- 6379:6379

project:
image: node
working_dir: /app
ports:
- 3333:3333
volumes:
- .:/app
command: sh -c "scripts/entrypoint.sh"
# command: cat "scripts/entrypoint.sh"
depends_on:
- cache
- pg
15 changes: 11 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,22 @@
"scripts": {
"preinstall": "npx only-allow pnpm",
"build": "turbo build",
"dev": "turbo dev",
"build:web": "turbo build --filter web",
"build:api": "turbo build --filter api",
"dev": "pnpm run compose:up && turbo dev",
"dev:web": "turbo dev --filter web",
"dev:api": "pnpm run compose:up && turbo dev --filter api",
"start": "pnpm run compose:up && turbo build && turbo start --filter api",
"start:web": "pnpm run build:web && turbo start --filter web",
"start:api": "pnpm run compose:up && pnpm run build:api && turbo start --filter api",
"compose:up": "docker compose -f docker-compose.dev.yml up -d --build",
"compose:down": "docker compose down -v",
"typecheck": "turbo typecheck",
"lint": "biome check .",
"lint:fix": "biome check . --write",
"lint:fix:unsafe": "biome check . --write --unsafe",
"prepare": "husky",
"commitlint": "commitlint --edit",
"compose:up": "docker compose -f docker-compose.dev.yml up -d --build",
"compose:down": "docker compose down -v"
"commitlint": "commitlint --edit"
},
"lint-staged": {
"**/*": ["biome check . --write"]
Expand Down
32 changes: 32 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 0 additions & 9 deletions scripts/entrypoint.sh

This file was deleted.

5 changes: 5 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
"cache": false,
"persistent": true
},
"start": {
"dependsOn": ["^build"],
"inputs": ["$TURBO_DEFAULT$", ".env*"],
"outputs": ["dist/**"]
},
"typecheck": {
"cache": false
},
Expand Down