Skip to content

Commit

Permalink
Full Stack Assessment Project v2 upgrade
Browse files Browse the repository at this point in the history
This is the proposed v2 update to the Full Stack Assessment Project. Main changes:

1. Use a monorepo approach based on `textbook/starter-kit/v2`, but stripped down with some parts removed to make it lighter and easier to navigate. These includes a much smaller `package.json` file with less available commands, no support for test coverage, plain `console.log` logging instead of morgan, no built-in support for helmet, and removed most of the deployment targets, keeping Netlify only.
2. Reorganized the assessment based on features instead of splitting it alongside frontend and backend. Week 1 is an MVP, Week 2 adds video embedding and the add/remove functionality, while Week 3 ends with ratings support
3. Optional features have been reorganized and expanded, one part code style improvements: linting, unit tests, e2e tests. The other part are better error handling. There are still a couple small optional product features as well.

Note that the scope of the mandatory part of the project mostly remains the exact same as before, but there are some new requirements:

1. Deployment is now mandatory, with most of its setup happening during Week 1. Deployment setup is toward Netlify and Supabase using the proposed updates to the deployment section in our curriculum: CodeYourFuture/curriculum#515
2. Data validation is now mandatory on the backend side for the "Add video" feature. (It is technically still optionali, but strongly recommended through the frontend)
3. Ratings now have to be persisted to the database through the API (this was theoretically already a requirement, however due to how the assessment was worded on the backend side it effectively became an optional feature accidentally)

The core repository also contains some predefined files for the frontend, backend and e2e tests to get the trainees a starting point, especially as we don't really teach them how this is done.
  • Loading branch information
sztupy committed Jan 26, 2024
1 parent ce4398f commit ed78f89
Show file tree
Hide file tree
Showing 78 changed files with 14,064 additions and 35,748 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
node_modules/
.env
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DATABASE_URL=postgres://cyf:password@localhost:5432/cyf
TEST_DATABASE_URL=postgres://cyf:password@localhost:5432/cyf_test
16 changes: 16 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"env": {
"browser": true,
"es6": true,
"node": true,
"commonjs": true,
"jest/globals": true
},
"extends": ["@codeyourfuture/standard", "prettier"],
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
},
"plugins": ["jest"],
"root": true
}
7 changes: 3 additions & 4 deletions .github/workflows/check-diff-size.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Test

on:
workflow_dispatch:
pull_request:

jobs:

check-diff:
name: Check diff size
runs-on: ubuntu-latest
Expand All @@ -20,12 +20,11 @@ jobs:
run: |
FILES_CHANGED=$(gh pr diff ${{github.event.pull_request.number}} --name-only | wc -l)
echo "Number of files changed in this PR: ${FILES_CHANGED}"
if [ $FILES_CHANGED -gt 10 ]
if [ $FILES_CHANGED -gt 20 ]
then
echo "The diff is too large. You've changed ${FILES_CHANGED} in this PR!"
exit 1
else
else
echo "The diff looks nice and small - good work! 😎"
exit 0
fi
20 changes: 20 additions & 0 deletions .github/workflows/enforce-linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: enforce-linting

run-name: Enforce lint passes on committed files

on:
workflow_dispatch:
#pull_request:

jobs:
run-linter:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20"
cache: "npm"
- run: npm install
- run: npm exec prettier -- --check .
- run: npm exec eslint .
14 changes: 14 additions & 0 deletions .github/workflows/reset-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Reset Server
run-name: Reset deployed application occasionally
on:
workflow_dispatch:
#schedule:
# - cron: "30 * * * *"

jobs:
pingServer:
runs-on: ubuntu-latest
steps:
- run: 'curl --request POST https://<your_project_name>.netlify.app/api/videos/reset -H "Content-Type: application/json" --data "{\"code\":\"$RESET_CODE\"}" || true'
env:
RESET_CODE: ${{ secrets.RESET_CODE }}
20 changes: 20 additions & 0 deletions .github/workflows/run-client-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: run-client-tests

run-name: Enforce tests pass on committed files

on:
workflow_dispatch:
#pull_request:

jobs:
run-client-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20"
cache: "npm"
- run: cp .env.example .env
- run: npm install
- run: npm run test:client
38 changes: 38 additions & 0 deletions .github/workflows/run-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: run-e2e

run-name: Enforce playwright end-to-end tests pass on committed files

on:
workflow_dispatch:
#pull_request:

jobs:
run-features:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: password
POSTGRES_USER: cyf
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20"
cache: "npm"
- run: cp .env.example .env
- run: npm install
- run: npx playwright install --with-deps
- run: npm run test:e2e
env:
NODE_ENV: test
TEST_DATABASE_URL: postgres://cyf:password@localhost:5432/cyf
36 changes: 36 additions & 0 deletions .github/workflows/run-server-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: run-server-tests

run-name: Enforce tests pass on committed files

on:
workflow_dispatch:
#pull_request:

jobs:
run-server-tests:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: password
POSTGRES_USER: cyf
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: "20"
cache: "npm"
- run: cp .env.example .env
- run: npm install
- run: npm run test:server
env:
TEST_DATABASE_URL: postgres://cyf:password@localhost:5432/cyf
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
e2e/blob-report/
e2e/playwright/.cache/
e2e/playwright-report/
e2e/test-results/
node_modules/
server/static/
.env
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.8.0
9 changes: 9 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"arrowParens": "always",
"bracketSpacing": true,
"endOfLine": "lf",
"semi": true,
"singleQuote": false,
"trailingComma": "es5",
"useTabs": true
}
97 changes: 0 additions & 97 deletions 100.md

This file was deleted.

29 changes: 0 additions & 29 deletions 199.md

This file was deleted.

Loading

0 comments on commit ed78f89

Please sign in to comment.