Skip to content

Commit

Permalink
Merge pull request #35 from fullstack-development/v5
Browse files Browse the repository at this point in the history
V5
  • Loading branch information
hersveit authored Jun 9, 2024
2 parents 7786f2f + 50b6ffb commit e7ebaa2
Show file tree
Hide file tree
Showing 191 changed files with 7,461 additions and 24,976 deletions.
10 changes: 6 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
**/node_modules
**/dist
**/build
api/.prisma-lib
.git
node_modules
dist
typeorm.env
api.env

4 changes: 2 additions & 2 deletions api/.eslintrc.js → .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
project: './tsconfig.eslint.json',
sourceType: 'module',
},
extends: ['plugin:@typescript-eslint/recommended', 'plugin:prettier/recommended'],
extends: ['plugin:@typescript-eslint/recommended'],
root: true,
env: {
node: true,
Expand All @@ -14,7 +14,7 @@ module.exports = {
rules: {
'max-len': [
'error',
100,
120,
{
ignorePattern: '^import\\s.+\\sfrom\\s.+;$',
ignoreUrls: true,
Expand Down
44 changes: 38 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@
node_modules/
# compiled output
/dist
/node_modules

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

# OS
.DS_Store

# 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

.vscode
yarn-error.log
.env
.e2e.env

*/**/node_modules_docker_dev
*/**/.ignore
.env
typeorm.env
api.env
4 changes: 0 additions & 4 deletions .husky/commit-msg

This file was deleted.

3 changes: 2 additions & 1 deletion api/.prettierrc.js → .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module.exports = {
plugins: ['prettier-plugin-organize-imports'],
bracketSpacing: true,
jsxBracketSameLine: false,
printWidth: 100,
printWidth: 120,
semi: true,
singleQuote: true,
tabWidth: 4,
Expand Down
48 changes: 0 additions & 48 deletions Dockerfile.api

This file was deleted.

56 changes: 1 addition & 55 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1 @@
# Starter kit Node js

## Links

1. [API doc](./api/Readme.md)

## Preparations
### Installation

Do installations step by step:

1. Install dependencies for `api`

```bash
cd ./api
yarn
```

The postinstall script will generate prisma types for you

`On windows can be not work auto generating prisma schema. You can manual copy schema.prisma in api/src/schema.prisma`

2. Then install dependencies for `e2e`

```bash
cd ./e2e
yarn
```

The postinstall script will generate prisma types for you

`On windows can be not work auto generating prisma schema. You can manual copy schema.prisma in e2e/src/schema.prisma`

### Launch

#### Local with docker

1. Run docker containers via docker-compose from the root folder of the repository

```bash
docker compose -f stk.docker-compose.yaml up -d --build
```

2. Go to `api/env` folder and create copy of `dev.example.env` to `dev.env`
```bash
cd ./api/env
cp ./dev.example.env ./dev.env
```
3. Copy `schema.prisma` from root dir in `api/src/schema.prisma`
4. Go up to `api` and launch migrations
```bash
cd ../
source ./env/dev.env && DATABASE_URL=$DATABASE_URL yarn prisma:migrate:deploy
```
- Press `Yes (y)` if it asks you to install missed dependencies
# Starter kit Node js V5
19 changes: 19 additions & 0 deletions api.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:18-alpine3.18 AS dependencies
RUN npm install -g pnpm
USER node
RUN mkdir -p /home/node/app
WORKDIR /home/node/app
COPY --chown=node . .
RUN pnpm i

FROM dependencies AS build
WORKDIR /home/node/app
RUN pnpm run api:build

FROM node:18-alpine3.18
RUN npm install -g pnpm
USER node
RUN mkdir -p /home/node/app
WORKDIR /home/node/app
COPY --chown=node --from=build /home/node/app .
CMD ["pnpm", "run", "api:prod"]
13 changes: 13 additions & 0 deletions api.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PORT=3000

DB_NAME="stk_db"
DB_HOST="localhost"
DB_USERNAME="admin"
DB_PASSWORD="1234"
DB_PORT=5432
DOMAIN=https://localhost

JWT_SECRET="123"
JWT_EXPIRES_IN="2min"
JWT_REFRESH_SECRET="321"
JWT_REFRESH_EXPIRES_IN="2days"
9 changes: 0 additions & 9 deletions api/.dockerignore

This file was deleted.

1 change: 0 additions & 1 deletion api/.eslintignore

This file was deleted.

38 changes: 0 additions & 38 deletions api/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion api/.prettierignore

This file was deleted.

9 changes: 0 additions & 9 deletions api/Dockerfile.dev

This file was deleted.

31 changes: 0 additions & 31 deletions api/Readme.md

This file was deleted.

53 changes: 0 additions & 53 deletions api/buildPrepare.js

This file was deleted.

13 changes: 0 additions & 13 deletions api/env/dev.example.env

This file was deleted.

1 change: 0 additions & 1 deletion api/jest-setup-file.ts

This file was deleted.

Loading

0 comments on commit e7ebaa2

Please sign in to comment.