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

refactor: Moved items of backend folder to root #64

Closed
wants to merge 2 commits into from
Closed
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
6 changes: 5 additions & 1 deletion backend/.env.example → .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ AWS_SECRET_ACCESS_KEY=
AWS_S3_BUCKET_NAME=
AWS_REGION=
DOMAIN=https://culero.com/
PROFILES_DIRECTORY=
PROFILES_DIRECTORY=

REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_PASSWORD=
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:
[
'Dockerfile',
'.github/workflows/stage-backend.yml',
'fly.backend.toml',
'api/**/*',
'package.json',
]

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:
[
'Dockerfile',
'.github/workflows/stage-backend.yml',
'fly.backend.toml',
'api/**/*',
'package.json',
]

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.

7 changes: 4 additions & 3 deletions backend/README.md → README-backend.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ The backend is a NestJS based application. It uses PostgreSQL as a database and

- **Node.js** installed
- **pnpm** installed
- **PostgreSQL** up and running on your machine on port `5432`. If you change this, or you are using a different database, you will need to change the connection string in the `.env` file.
- **PostgreSQL** up and running on your machine on port `5432`. If you change this, or you are using a different database, you will need to change the connection string in the `.env` file. Alternatively, you can use the docker compose file to run the database.
- **Redis** up and running on your machine on port `6379`. If you change this, you will need to change the connection string in the `.env` file. You can also use the docker compose file to run the Redis server.
- Port `4200` should be free. This will be used by the backend to run the server.
- **AWS S3 bucket** for storing the images. This is optional, but if you want to use the image upload feature, you will need to fill in the required values in the `.env` file.
- **nest cli** installed globally. If not, you can install it by running `pnpm i -g @nestjs/cli`
Expand All @@ -34,10 +35,10 @@ The backend is a NestJS based application. It uses PostgreSQL as a database and
pnpm install
```

4. Make sure your database is running. If you would like to use docker, run the following command:
4. Make sure your database and redis server are up and running. If you don't have them installed, you can run them in a container using the following command:

```sh
docker run --name culero-psql --network host -e POSTGRES_PASSWORD=password -d postgres
docker compose up -d
```

5. For Prisma to work properly, generate the types
Expand Down
Loading
Loading