Skip to content

Commit

Permalink
refactored backend folder
Browse files Browse the repository at this point in the history
  • Loading branch information
rajdip-b committed Mar 22, 2024
1 parent 426d1ea commit 97b7e09
Show file tree
Hide file tree
Showing 82 changed files with 52 additions and 227 deletions.
File renamed without changes.
File renamed without changes.
10 changes: 1 addition & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ on:
- '!main'
- '!develop'
- '*'
paths: ['apps/api/**']
pull_request:
paths: ['apps/api/**']

jobs:
lint:
Expand All @@ -22,10 +20,8 @@ jobs:
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
working-directory: ./backend
run: pnpm install
- name: Run Prettier (Pre-commit or in workflow)
working-directory: ./backend
- name: Run ESLint
run: pnpm lint

test:
Expand All @@ -39,14 +35,10 @@ jobs:
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
working-directory: ./backend
run: pnpm install
- name: Run ESLint
working-directory: ./backend
run: pnpm lint
- name: Run unit tests
working-directory: ./backend
run: pnpm run test:unit
- name: Run e2e tests
working-directory: ./backend
run: pnpm run test:e2e
15 changes: 10 additions & 5 deletions .github/workflows/prod-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ on:
push:
branches:
- main
paths: ['backend/**', '.github/workflows/prod-backend.yml']
paths:
[
'src/**',
'.github/workflows/prod-backend.yml',
'Dockerfile',
'package.json',
'fly.backend.toml',
]

env:
DATABASE_URL: ${{ secrets.DB_PROD_URL }}
Expand All @@ -22,15 +29,13 @@ jobs:
- name: Install pnpm
run: npm install -g pnpm
- name: pnpm install
working-directory: ./backend
run: pnpm install
- name: Deploy migrations
working-directory: ./backend
run: pnpm db:deploy-migrations
- name: Deploy to prod
run: |
~/.fly/bin/fly deploy \
--config fly.backend.toml \
--dockerfile ./backend/Dockerfile \
--dockerfile Dockerfile \
--app culero-stage-api \
--access-token ${{ secrets.FLY_ACCESS_TOKEN }}
--access-token ${{ secrets.FLY_ACCESS_TOKEN }}
13 changes: 9 additions & 4 deletions .github/workflows/stage-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ on:
push:
branches:
- develop
paths: ['backend/**', '.github/workflows/stage-backend.yml']
paths:
[
'src/**',
'.github/workflows/prod-backend.yml',
'Dockerfile',
'package.json',
'fly.backend.toml',
]

env:
DATABASE_URL: ${{ secrets.DB_STAGE_URL }}
Expand All @@ -22,15 +29,13 @@ jobs:
- name: Install pnpm
run: npm install -g pnpm
- name: pnpm install
working-directory: ./backend
run: pnpm install
- name: Deploy migrations
working-directory: ./backend
run: pnpm db:deploy-migrations
- name: Deploy to stage
run: |
~/.fly/bin/fly deploy \
--config fly.backend.toml \
--dockerfile ./backend/Dockerfile \
--dockerfile Dockerfile \
--app culero-stage-api \
--access-token ${{ secrets.FLY_ACCESS_TOKEN }}
176 changes: 26 additions & 150 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,163 +1,39 @@
# ---- macOS ----
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# compiled output
/dist
/node_modules

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# ---- Node ----
# Logs
logs
*.log
npm-debug.log*
pnpm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz
# OS
.DS_Store

# Yarn Integrity file
.yarn-integrity
# Tests
/coverage
/.nyc_output

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# dotenv environment variable files
.env
.env.stage
.env.prod

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

.vscode/
.idea/

**/coverage-e2e/
.env.stage
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions backend/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ WORKDIR /app

RUN npm i -g pnpm

COPY backend/package.json .
COPY backend/tsconfig.json .
COPY package.json .
COPY tsconfig.json .

RUN pnpm install

COPY backend .
COPY . .

RUN pnpm db:generate-types
RUN pnpm build
Expand Down
16 changes: 0 additions & 16 deletions Makefile

This file was deleted.

File renamed without changes.
39 changes: 0 additions & 39 deletions backend/.gitignore

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 3 additions & 1 deletion backend/package.json → package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
"db:validate": "pnpm dlx prisma validate --schema=src/prisma/schema.prisma",
"db:format": "pnpm dlx prisma format --schema=src/prisma/schema.prisma",
"db:reset": "pnpm dlx prisma migrate reset --force --schema=src/prisma/schema.prisma",
"prepare": "husky"
"prepare": "husky",
"docker:build": "docker build -t culero-api .",
"docker:run": "docker run --network host --env-file .env --rm culero-api"
},
"dependencies": {
"@arendajaelu/nestjs-passport-apple": "^2.0.2",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 97b7e09

Please sign in to comment.