Skip to content

Commit

Permalink
πŸš€ V2 Going Full Stack (#412)
Browse files Browse the repository at this point in the history
* feat: TS Rest for backend api

* feat: Use Next Router

* fix: Upgrade storybook

* wip: trpc next-auth

* wip: Remove next-auth

* wip open api

* fix: Add secure true for the auth cookie

* fix: Clean up open api

* fix: Add activate page and add all rest endpoints

* fix: Logout

* fix: warnings

* fix: Translations

* fix: Update next & prisma

* fix: Remove buggy Cypress

* fix: Upgrade deps

* fix: node version 18+

* fix: ci

* fix: Use node 18

* fix: Prettier

* feat: Basic email setup

* wip: Email & translations

* fix: Rollback chakra ui for select style issue

No border radius on select

* wip: Emails

* feat: use postgres

* feat: Emails

* feat: builds and openapi

* fix: Rollback swagger ui package

* fix: Remove open api script

* fix: Readme

* fix: Missing translations

* wip: Dev hint

* fix: Sort users by id

* feat: move build-info.json

* fix: Remove "coucou" from @yoannfleurydev

* fix: Auth cookie in dev for safari

* fix: Register / Reset password feedback design

* feat: pnpm now the default package manager for Start UI

* Feat/fullstack playwright (#411)

* feat: init playwright

* ci(e2e): add postgres service in github action

* ci(e2e): remove failing browser

Update reporter to use "github" one in CI

* feat: add utils to authenticate

update playwright config with default urls
remove gitlab component testings

* feat: update recommended extensions

* doc(e2e): update README.md

* fix: pnpm update

* wip: add target branch to test CI

* ci(e2e): use pnpm instead of yarn

* fix: Sonar issues

* feat: Improve verification token security

* fix: Auth

* fix: trpc procedure chaining

* feat: new open api adapter

* fix: Remove old redirect

* fix: Update trpc

* feat: improve env var management

* fix: Add eslint rule to prevent process.env usage

* feat: loggers

* feat: extended trpc error for better prisma error management

* fix: Cleanup logger

* fix: Conflict errors in front

* fix: Add some logs on auth route

* fix: Typo

* fix: Emails buttons style

* feat: Improve logger

* feat: latest logs for auth

* feat: type not used anymore

* feat: add openapi and logger for account

* fix: using correct variable for CI

* feat: add loggers for repositories

* fix: Move ExtendedTRPCError from db to api/errors

* fix: Remove unused type

* feat: Add verification for yarn / npm version with please-use-pnpm

* feat: Bump package.json version 2.0.0

* fix: Rollback npm/yarn version check (issue with playwright)

* fix: Upgrade Swagger UI

Fix error message problem

* feat: Add logs for users

* fix: Conflict name in Repository form

* fix: swagger build (don't upgrade to >=5 at the moment)

* feat: basic pwa setup for lighthouse to be happy

* fix: Archi server

* fix: error if build info does not exist

* feat: enable pwa only on build

add webworker typings in tsconfig, useful for service worker

* refactor: remove old serve static config

* feat: use vercel url by default for public base url

* fix: Remove prisma query logs in debug

* feat: update t3 env validator

* fix: Extract tRPC provider from Providers

* feat: Docker image name and port env var

* fix: Env Dev Hint zindex issue

* fix: Set debug log level by default in dev

* fix: tRPC provider order issue

* fix: Smtp example env var

* fix: typo

* feat: code auth flow

* feat: remove password related code and transform is demo env var

* feat: Validation retry delay

* feat: add demo and dev log in hints

* fix: Add theme for pin input and improve FieldPinInput

* feat: register flow (will need a specific mutation to verify the email)

* refactor: use hook

* fix: Improve UX for auth flow

* fix: Remove unused import

* fix: Allows 0 delay for the first 3 retry

* fix: Translation

* feat: Auth emails

* feat: fusion activated to accountStatus

* feat: add email to verification token

* feat: Add email address change template

* wip: Change email flow

* fix: check auth and guard issues

* feat: register flow

* wip: Email change flow

* feat: Update email flow

* fix: Public guard issue

* feat: Login redirect

* fix: Tests

* tests: Add registers tests

* tests: Improve auth tests

* tests: Use translations in tests

* feat: Translations

* fix: Minor sonar issues

* fix: Allows login in demo mode

* fix: Guard authenticated issue

* fix: Disable smart tanstack query network on dev or test

* fix: Improve layout folder organisation

* fix: Improve auth guards

* feat: improve logs

* feat: improve prisma seeds

* fix: Rename "admin" menu to "management"

* fix: Move api documentation in account menu

* wip: app/admin split

* fix: Dark mode contrasts

* feat: Refact admin layout / layout page

* feat: AppLayoutPage

* fix: Move home and dashboard in their own directory

* feat: Add public layouts

* fix: Improve app nav

* feat: Add logout

* fix: Container size

* feat: Improve app account layout

* fix: Dark mode navbars

* feat: improve Select

* feat: Allows multiple roles

* fix: seed emails

* fix: Roles

* fix: Rename role to authorizations

* fix: better protected procedure

* fix: Authorizations

* fix: Translations

* fix: Improve login ux

* fix: Factorise code validation success

* fix: Tests

* fix: Translations

* feat: Use load more instead of pagination

* feat: Add search on lists

* feat: Add app page for repositories

* fix: Cursor type

* feat: Add admin link in app account

* fix: Wording of sign in button

* fix: Admin badge, replaced with tags

* fix: Move trpc types in lib

* fix: Css issue

* fix: Open Admin in new tab

* fix: Show admin link only to admin users

* fix: protectedProcedure authorizations

* fix: GuardAuthenticated

* fix: typo

* fix: translation typo

* feat: Upgrade dependencies

* fix: Remove unused translation file

* fix: Rename e2e login utils to loginApp

* feat: Add SheetModal component and use it in ConfirmModal

* fix: Not found email link

* fix: Loading login button style

* fix: iOS safe spaces

* fix: Add certificates in gitignore

* feat: replace swagger with stoplight

* fix: internal server error when jwt is not well formatted

* feat: update nextjs

* feat: Navigation loading indicator

* fix: Improve feedback loading waiting for navigation

* fix: Hash verification code in database

* fix: Set default list size to 20

* fix: Send readable code in email

* fix: Update Readme

* fix: PWA less agressive caching

* feat: Allows nodejs 20

* feat: Upgrade storybook

* feat: Upgrade dependencies

* test: Add some tests

* feat: Improve global UI/UX

* fix: Alignment issue

* fix: Nav size

* fix: Heading size for create pages

* fix: Add subtle shadow on buttons

* fix: Improve searchinput

* fix: Wording

* fix: Card shadows and admin background

* fix: Save wording

* fix: Remove shadow on link variant for buttons

* fix: Submit button on profile form

* fix: Add visibility for search clear button

* feat: Update deps

* fix: Remove broken loading

* fix: GuardAuthenticated if isAuthenticated change

* fix: Improve authenticated guard

* fix: Title metadata

* feat: Add cancel button

* feat: Improve form UX

* fix: Remove unused imports

* feat: new Datalist

* fix: Use text-dimmed everywhere app

* fix: Datalist alignment

* fix: App nav mobile safe zone

* fix: Button style

* feat: Add cancel buttons on user account forms

* fix: Remove unused import

* fix: Datalist loading

* fix: Clean datalist empty state

* Update day picker component (#413)

* feat: update DayPicker component

* wip: fields

* fix: disable type checking on disabled prop

* style: update dark style of daypicker

* style: dark mode support on month picker

* fix: errors handling on day picker, add missing translations

* fix: typings and default value when input is empty

* remove example

* fix: first value from popper on DayPicker

* fix: simplify null check

* fix: dayPicker style

* fix: remove prevent update on blur and remove default size

* Update src/features/auth/LoginForm.tsx

* feat: translation and ui improvements

* feat(daypicker): some code and typings improvements (#418)

* fix: missing t in dependencies

* fix: field select multi + creatable

* fix: improve select and remove multiselect

* fix: Missing z.infer on user type

* fix: Update timeouts for playwright

* feat: Add max failure for e2e test in ci

* fix: Open api issue

* fix: Use custom empty text in repositories admin

* feat: Add basic test for rest API schema

* fix: e2e tests

* fix: Datalist empty state

* feat: Update storybook

* fix: Limit github actions to 30 minutes max

* fix: Minor style fixes

* fix: Seed file typo

* fix: Simplify seed for duplication

* fix: Comment typo in router.ts file

* fix: set eslint rule sonarjs/prefer-immediate-return to warn instead of error

* fix: Typescript issue for optional nextCursor

* fix: use prisma transaction instead of Promise.all

* fix: Extract where clause on listing into constant

* upgrade dependencies

* fix: Sonar bug report

* fix: Sonar code smell

* fix: Rollback playwright to version 1.39.0 waiting for 1.41.0

* fix: Handle case if APP_PATH or ADMIN_PATH are empty

* fix: Move readme assets

* fix: Add default input to empty object in listing tRPC routes

* fix: Simplify loadmore ui

* fix: Remove useless imports

* fix: Invalidation repositories after delete

* fix: Add divider in repository actions for consistency

* [V2] feat: docker compose postgres (#429)

* feat: docker compose postgres

* fix: Remove unused MINIO env vars

* fix: Remplace db:start with dk:start

---------

Co-authored-by: Ivan Dalmet <ivan@dalmet.fr>

* fix: Docker postgres version

* fix: Typo in readme

* feat: Add button danger primary

And rename button danger to button danger secondary

---------

Co-authored-by: Ivan Dalmet <ivan@dalmet.fr>
Co-authored-by: Renan Decamps <DecampsRenan@users.noreply.github.com>
  • Loading branch information
3 people authored Dec 22, 2023
1 parent f94cf0a commit 53264ff
Show file tree
Hide file tree
Showing 375 changed files with 29,304 additions and 22,529 deletions.
24 changes: 20 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
NEXT_PUBLIC_BASE_URL="http://localhost:3000"
NEXT_PUBLIC_API_BASE_URL="http://localhost:3000/api/jhipster-mocks"
# DOCKER
DOCKER_DATABASE_PORT="5432"
DOCKER_DATABASE_NAME="startui"
DOCKER_DATABASE_USERNAME="startui"
DOCKER_DATABASE_PASSWORD="startui"

# PUBLIC CONFIG
NEXT_PUBLIC_BASE_URL="http://localhost:3000"
# Use the following environment variables to show the environment name.
NEXT_PUBLIC_DEV_ENV_NAME="staging"
NEXT_PUBLIC_DEV_ENV_COLOR_SCHEME="teal"
# Configure demo mode (read only)
NEXT_PUBLIC_IS_DEMO="false"

DATABASE_URL="file:./dev.db"
# DATABASE
DATABASE_URL="postgres://${DOCKER_DATABASE_USERNAME}:${DOCKER_DATABASE_PASSWORD}@localhost:${DOCKER_DATABASE_PORT}/${DOCKER_DATABASE_NAME}"

# AUTH
AUTH_SECRET="Replace me with `openssl rand -base64 32` generated secret"

NEXT_PUBLIC_IS_DEMO="false"
# EMAILS
EMAIL_SERVER="smtp://username:password@0.0.0.0:1025"
EMAIL_FROM="Start UI <noreply@example.com>"

# LOGGER
LOGGER_LEVEL="info"
LOGGER_PRETTY="true"
56 changes: 0 additions & 56 deletions .env.validator.js

This file was deleted.

10 changes: 9 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,24 @@
"plugin:storybook/recommended"
],
"rules": {
"react/no-unescaped-entities": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_"
}
],
"sonarjs/no-duplicate-string": "off",
"sonarjs/cognitive-complexity": ["warn", 50]
"sonarjs/cognitive-complexity": ["warn", 50],
"sonarjs/prefer-immediate-return": "warn"
},
"overrides": [
{
"files": ["./src/**/*.*"],
"rules": {
"no-process-env": "error"
}
},
{
"files": [
"*.stories.tsx",
Expand Down
Binary file added .github/assets/tech-logos.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added .github/assets/thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ closes #<issue_id>
- [ ] I performed a self review of my code
- [ ] I ensured that everything is written in English
- [ ] I tested the feature or fix on my local environment
- [ ] I ran the `yarn storybook` command and everything is working
- [ ] I ran the `pnpm storybook` command and everything is working
- [ ] If applicable, I updated the translations for english and french files
(If you cannot update the french language, just let us know in the PR description)
- [ ] If applicable, I updated the README.md
Expand Down
37 changes: 22 additions & 15 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,51 @@
name: πŸš€ Start UI [web]

on:
push:
branches:
- master
pull_request:
- push
- pull_request

jobs:
build-and-test:
timeout-minutes: 30
name: Lint and Test
runs-on: ubuntu-latest

strategy:
matrix:
node: [16, 'lts/*']
node: [18, 20, 'lts/*']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-pnpm-store-${{ env.cache-name }}-
${{ runner.os }}-pnpm-store-
${{ runner.os }}-
- name: Install dependencies
run: yarn install
run: pnpm install

- name: Lint code and types
run: yarn lint

- name: Run components tests
run: yarn test:ci
run: pnpm lint
87 changes: 87 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Playwright Tests
on:
push:
branches: [main, master]
pull_request:
branches: [main, master, v2-going-full-stack]

jobs:
E2E:
timeout-minutes: 30
runs-on: ubuntu-latest
env:
NEXT_PUBLIC_BASE_URL: http://localhost:3000
NEXT_PUBLIC_DEV_ENV_NAME: tests
DATABASE_URL: postgres://startui:startui@localhost:5432/startui
NEXT_PUBLIC_IS_DEMO: false
AUTH_SECRET: Replace me with `openssl rand -base64 32` generated secret
EMAIL_SERVER: smtp://username:password@localhost:1025
EMAIL_FROM: Start UI <noreply@example.com>
services:
postgres:
image: postgres

env:
POSTGRES_PASSWORD: startui
POSTGRES_USER: startui
POSTGRES_DB: startui

options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: 18

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-${{ env.cache-name }}-
${{ runner.os }}-pnpm-store-
${{ runner.os }}-
- name: Install dependencies
run: pnpm install

- name: Install Playwright Browsers
run: pnpm playwright install --with-deps

- name: Migrate database
run: pnpm db:push

- name: Add default data into database
run: pnpm db:seed

- name: Run Playwright tests
run: pnpm e2e

- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
19 changes: 16 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,24 @@ yarn-error.log*
# vercel
.vercel

# cypress
/cypress/videos

# Build info
.build-info.json

# Prisma
prisma/dev.db
prisma/dev.db-journal

# Emails
.react-email

# playwright
/test-results/
/playwright-report/
/playwright/.cache/

# next-pwa recommandation
**/public/workbox-*.js*
**/public/sw.js*
**/public/worker-development.js*

certificates
30 changes: 10 additions & 20 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
image: node:lts

cache:
key:
files:
- pnpm-lock.yaml
paths:
- node_modules
- .yarn
- .pnpm-store

stages:
- build
- test

build:
stage: build
before_script:
- corepack enable
- corepack prepare pnpm@latest-8 --activate
- pnpm config set store-dir .pnpm-store
script:
- echo "Installing dependencies"
- yarn install
- pnpm install
- echo "Building application"
- yarn build

test:
image:
# Make sure to update this version number on version update
name: cypress/included:11.2.0
entrypoint: ['']
stage: test
script:
- yarn install
- yarn cypress install
- echo "Checking format code eslint"
- yarn eslint .
- echo "Checking types"
- yarn tsc --noEmit
- echo "Running tests"
- yarn test:ci --browser chrome
- pnpm build
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint-staged
pnpm lint-staged
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint
pnpm lint
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ public
*.mdx
.env*
!.env.validator.js
pnpm-lock.yaml
18 changes: 18 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Prettier configuration. Please avoid changing the current configuration.
// But if you do so, please run the `npm run pretty` command.
/** @type {import("prettier").Options} */
const config = {
endOfLine: 'lf',
semi: true,
singleQuote: true,
tabWidth: 2,
trailingComma: 'es5',
arrowParens: 'always',
importOrder: ['^react$', '^(?!^react$|^@/|^[./]).*', '^@/(.*)$', '^[./]'],
importOrderSeparation: true,
importOrderSortSpecifiers: true,
importOrderParserPlugins: ['jsx', 'typescript'],
plugins: ['@trivago/prettier-plugin-sort-imports'],
};

module.exports = config;
Loading

1 comment on commit 53264ff

@vercel
Copy link

@vercel vercel bot commented on 53264ff Dec 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.