Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
kristianbinau committed Sep 25, 2023
0 parents commit edbcf39
Show file tree
Hide file tree
Showing 61 changed files with 14,567 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/node_modules
/.github
.idea
.editorconfig
.env.example
.gitattributes
.gitignore
.vscode
README.md
/build
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
31 changes: 31 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Environment, local|test|prod
NODE_ENV=local

# Server
HOST=0.0.0.0
PORT=3000
SECRET=7ZB68E3HZ9HWGe8FzUvNWZcoYD9uuwkp25Y66S6RkszKadFMJCj9ShXL7TBcieG9yoRAsdTKzJcEgQUYbd6dtjXgmZMQhVNKypNeq6yKKLVht7gUtXypaoxgoRjQDHLceCWmJhM6GbwYiyLHmVYA8L9zuJUhYW2atZiv4Fxoc4YqzaCCrSZxzPBT9rFDSCtHsXXDEShMvULSStZvwt26tesWtxEMx5Q43a3s6eHrPJUPgVX3aAZsmYRu3bzCHvRp
PRIVATE="-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIB63sfXk5HebxHMAoWavbxtK84sjVucZCNm+5Y3au6mb
-----END PRIVATE KEY-----"
PUBLIC="-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEA/nqSs2DZmox+sRNR9d9XdaO3C2yJABIO5gdJlBcswNI=
-----END PUBLIC KEY-----"

# DB
DATABASE_HOST="localhost"
DATABASE_PORT="5432"
DATABASE_USER="root"
DATABASE_PASSWORD="root"
DATABASE_NAME="postgres"

DATABASE_URL_WITHOUT_SCHEMA="postgresql://${DATABASE_USER}:${DATABASE_PASSWORD}@${DATABASE_HOST}:${DATABASE_PORT}"
DATABASE_URL="${DATABASE_URL_WITHOUT_SCHEMA}/${DATABASE_NAME}"
DATABASE_URL_NON_POOLING="${DATABASE_URL_WITHOUT_SCHEMA}/${DATABASE_NAME}"

# Redis
REDIS_HOST="redis"
REDIS_PORT="6379"
REDIS_USER=""
REDIS_PASSWORD=""
REDIS_URL="rediss://${REDIS_USER}:${REDIS_PASSWORD}@${REDIS_HOST}:${REDIS_PORT}"
7 changes: 7 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-env node */
module.exports = {
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'prettier'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
root: true,
};
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!--- Provide a general summary of the issue in the Title above -->

## Detailed Description

<!--- Provide a detailed description of the change or addition you are proposing -->

## Context

<!--- Why is this change important to you? How would you use it? -->
<!--- How can it benefit other users? -->

## Possible Implementation

<!--- Not obligatory, but suggest an idea for implementing addition or change -->
23 changes: 23 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!--
Thanks for contributing!
Provide a description of your changes below and a general summary in the title
Please look at the following checklist to ensure that your PR can be accepted quickly:
-->

## Description

<!--- Describe your changes in detail -->

## Type of Change

<!--- Put an `x` in all the boxes that apply: -->

- [ ] ✨ New feature (non-breaking change which adds functionality)
- [ ] 🛠️ Bug fix (non-breaking change which fixes an issue)
- [ ] ❌ Breaking change (fix or feature that would cause existing functionality to change)
- [ ] 🧹 Code refactor
- [ ] ✅ Build configuration change
- [ ] 📝 Documentation
- [ ] 🗑️ Chore
34 changes: 34 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build
on:
pull_request:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v3

- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8

- name: Setup Node - ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Generate Prisma Client
run: pnpm exec prisma generate

- name: Run Build
run: pnpm run build
10 changes: 10 additions & 0 deletions .github/workflows/semantic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Semantic

on: [pull_request]

permissions:
pull-requests: 'read'

jobs:
semantic-pull-request:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/semantic_pull_request.yml@v1
31 changes: 31 additions & 0 deletions .github/workflows/style.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Style
on:
pull_request:
branches:
- master
jobs:
format:
name: Format
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
steps:
- uses: actions/checkout@v3

- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8

- name: Setup Node - ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Check Format
run: pnpm exec prettier --check .
100 changes: 100 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Test
on:
pull_request:
branches:
- master
permissions:
checks: write
pull-requests: write
contents: write
jobs:
test:
name: Test
concurrency: ci-${{ github.ref }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18]
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
# optional (defaults to `postgres`)
POSTGRES_DB: postgres_db
# required
POSTGRES_PASSWORD: postgres_password
# optional (defaults to `5432`)
POSTGRES_PORT: 5432
# optional (defaults to `postgres`)
POSTGRES_USER: postgres_user
ports:
# maps tcp port 5432 on service container to the host
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
DATABASE_URL: 'postgresql://postgres_user:postgres_password@localhost:5432/postgres_db'
DATABASE_URL_NON_POOLING: 'postgresql://postgres_user:postgres_password@localhost:5432/postgres_db'
DATABASE_URL_WITHOUT_SCHEMA: 'postgresql://postgres_user:postgres_password@localhost:5432'
REDIS_URL: 'redis://localhost'
SECRET: '7ZB68E3HZ9HWGe8FzUvNWZcoYD9uuwkp25Y66S6RkszKadFMJCj9ShXL7TBcieG9yoRAsdTKzJcEgQUYbd6dtjXgmZMQhVNKypNeq6yKKLVht7gUtXypaoxgoRjQDHLceCWmJhM6GbwYiyLHmVYA8L9zuJUhYW2atZiv4Fxoc4YqzaCCrSZxzPBT9rFDSCtHsXXDEShMvULSStZvwt26tesWtxEMx5Q43a3s6eHrPJUPgVX3aAZsmYRu3bzCHvRp'
PRIVATE: |
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEIB63sfXk5HebxHMAoWavbxtK84sjVucZCNm+5Y3au6mb
-----END PRIVATE KEY-----
PUBLIC: |
-----BEGIN PUBLIC KEY-----
MCowBQYDK2VwAyEA/nqSs2DZmox+sRNR9d9XdaO3C2yJABIO5gdJlBcswNI=
-----END PUBLIC KEY-----
steps:
- uses: actions/checkout@v3

- name: Setup Redis server
uses: supercharge/[email protected]

- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: 8

- name: Setup Node - ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Run prisma migrations & generate prisma client
run: pnpm exec prisma migrate dev

- name: Lint code
run: pnpm run lint

- name: Run tests
run: pnpm run test --coverage

- name: Comment coverage report on pull request
if: ${{ github.event_name == 'pull_request' }}
uses: ArtiomTr/jest-coverage-report-action@v2

- name: Generate coverage badge
if: ${{ github.ref == 'refs/heads/master' }}
uses: jaywcjlove/coverage-badges-cli@main
with:
source: coverage/coverage-summary.json
output: coverage/badge.svg

- name: Publish coverage report to GitHub Pages
if: ${{ github.ref == 'refs/heads/master' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: coverage
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*

# env configuration
.env

# Coverage directory used by tools like istanbul
coverage

# Compiled typescript
build

# Dependency directories
node_modules

# vim swap files
*.swp

# webstorm
.idea

# vscode
.vscode
*code-workspace
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
pnpm-lock.yaml
package-lock.json
prisma
build
13 changes: 13 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @type {import("@types/prettier").Options} */
// Extracted from `webdev-configs` (https://github.com/JulianCataldo/web-garden/tree/develop/configs)

module.exports = {
printWidth: 100,
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'all',

// See: https://github.com/prettier/prettier/issues/7475
useTabs: true,
};
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
migrate-dev:
pnpm exec prisma migrate dev
migrate-deploy:
pnpm exec prisma migrate deploy
migrate-reset:
pnpm exec prisma migrate reset
prisma-generate:
pnpm exec prisma generate
prod:
pnpm run build
pnpm run start
dev:
pnpm run dev
test:
pnpm run test
test-coverage:
pnpm run test --coverage
format:
pnpm run format
Loading

0 comments on commit edbcf39

Please sign in to comment.