-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
215 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
CHANGES="$(git status --no-untracked-files --porcelain)" | ||
|
||
if [ ! -z "$CHANGES" ]; then | ||
echo 'Please commit all changes before proceeding:' | ||
echo "$CHANGES" | ||
exit 1 | ||
fi | ||
|
||
if [[ $# -lt 1 ]] || [[ $# -gt 2 ]]; then | ||
echo 'Usage ./bin/cyf.sh <branch> [remote]' | ||
exit 1 | ||
fi | ||
|
||
BRANCH="$1" | ||
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
REMOTE="${2:-}" | ||
ROOT="$HERE/.." | ||
|
||
git branch -D "$BRANCH" || echo "No branch $BRANCH" | ||
git checkout -b "$BRANCH" | ||
|
||
mv "$HERE/files/PULL_REQUEST_TEMPLATE.md" "$ROOT/.github/" | ||
mv "$HERE/files/README.md" "$ROOT" | ||
mv "$HERE/files/render.yaml" "$ROOT" | ||
mv "$HERE/files/user-story.md" "$ROOT/.github/ISSUE_TEMPLATE/" | ||
|
||
rm "$ROOT/.github/workflows/keepalive.yml" | ||
rm "$ROOT/.github/CODE_OF_CONDUCT.md" | ||
rm "$ROOT/.github/CONTRIBUTING.md" | ||
rm "$HERE/cyf.sh" | ||
|
||
git add "$ROOT" | ||
git commit --message 'Remove unneeded files' | ||
|
||
if [[ ! -z "$REMOTE" ]]; then | ||
git push --force "$REMOTE" "$BRANCH:main" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
## Naming Rules | ||
|
||
Name your PR like this: ISSUENUMBER-TITLE-YOURNAME | ||
|
||
## Description | ||
|
||
Write a summary of your change. Explain why you have made it. | ||
|
||
## Related to | ||
|
||
Make sure you include the issue number with a hash sign # so Github can link this PR to the right issue, like this: | ||
|
||
Fixes #1 | ||
|
||
## Checklist: | ||
|
||
- [ ] My code follows the style guidelines of this project | ||
- [ ] I have carefully reviewed my own code | ||
- [ ] I have commented my code | ||
- [ ] I have updated any documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# Starter Kit v2 | ||
|
||
[![Deploy to Render](https://render.com/images/deploy-to-render-button.svg)](https://render.com/deploy) | ||
|
||
- [x] [Node] LTS support (verified working on 20.x LTS release) | ||
- [x] [Express] server | ||
- [x] [Postgres] database with [`pg`][node-postgres] | ||
- [x] Logging with [Winston] and [Morgan] | ||
- [x] [React] client with [Vite] | ||
- [x] Client-side routing with [React Router] | ||
- [x] Linting with [ESLint] and [Prettier] | ||
- [x] Unit and integration testing with [Vitest] and [Jest] (with [SuperTest] and [TestContainers]) | ||
- [x] E2E testing with [Playwright] | ||
- [x] Dev mode (watch modes for client and server, proxy to avoid CORS issues) | ||
- [x] Production build (single deployment artifact) | ||
- [x] [GitHub Actions] pipeline | ||
- [x] [Google App Engine], [Heroku], [Render] or [Vercel] deployment | ||
- [x] [Docker] build | ||
|
||
## Setup | ||
|
||
> **Note** if you have _any problems_ setting up the starter kit, see the [wiki] and, if still not solved, post to | ||
> [`#cyf-full-stack-starter-kit` in Slack][2]. | ||
Pick one member of the team to own the repository and pipeline. That person should do the following: | ||
|
||
1. Click the "Use this template" button above (see [GitHub's docs][1]) to create your team repository and name it something appropriate for your project. | ||
- Your repo should say _"generated from"_, **not** _"forked from"_, _"CodeYourFuture/cyf-final-project-starter-kit"_ at the top | ||
2. In your repo, click the "Deploy to Render" button at the top of the README and log in using GitHub when prompted. | ||
3. Fill in a service group name for your application and then click "Apply". | ||
4. Once it has deployed successfully, click the "managed resources" link to view the application details. | ||
|
||
Whenever you commit to main (or e.g. merge a [pull request]) it will get automatically deployed! | ||
|
||
You should now make sure all of the project team are [collaborators] on the repository. | ||
|
||
## Scripts | ||
|
||
Various scripts are provided in the package file, but many are helpers for other scripts; here are the ones you'll | ||
commonly use: | ||
|
||
- `dev`: starts the frontend and backend in dev mode, with file watching (note that the backend runs on port 3100, and the frontend is proxied to it). | ||
- `e2e`: builds and starts the app in production mode and runs the Playwright tests against it. | ||
- `e2e:dev`: builds and starts the app in dev mode and runs the Playwright tests against it. | ||
- `lint`: runs ESLint and Prettier against all the relevant files in the project. | ||
- `serve`: builds and starts the app in production mode locally. | ||
- `ship`: runs `lint`, then `test`, then `e2e`; ideal before a `git push`. | ||
- `test`: runs the unit and integration tests. | ||
- `test:cover`: runs the tests and outputs coverage data. | ||
|
||
### Security | ||
|
||
If the project handles **any kind of** Personally Identifiable Information (PII) then make sure the following | ||
principles are followed: | ||
|
||
- Only collect **strictly necessary** PII; | ||
- Access to PII should be as restricted as possible; | ||
- Access to PII should only be possible after authentication. Authentication **must be done** via GitHub. **Ad hoc | ||
authentication solutions are not allowed**; | ||
- Admins must be able to control who has access to the platform and at which levels using only GitHub groups; | ||
- There must be an audit mechanism in place. It is required by law to know who accessed what and when; | ||
- Code must be reviewed by senior developers before being pushed to production; | ||
- APIs must be secure. Make sure we are not handling security on the frontend. | ||
|
||
[1]: https://docs.github.com/en/free-pro-team@latest/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template#creating-a-repository-from-a-template | ||
[2]: https://codeyourfuture.slack.com/archives/C021ATWS9A5 | ||
[collaborators]: https://help.github.com/en/articles/inviting-collaborators-to-a-personal-repository | ||
[Docker]: https://www.docker.com | ||
[ESLint]: https://eslint.org/ | ||
[Express]: https://expressjs.com/ | ||
[GitHub Actions]: https://github.com/features/actions | ||
[Google App Engine]: https://cloud.google.com/appengine/?hl=en | ||
[Heroku]: https://www.heroku.com/ | ||
[Jest]: https://jestjs.io/ | ||
[Morgan]: https://github.com/expressjs/morgan | ||
[Node]: https://nodejs.org/en/ | ||
[node-postgres]: https://node-postgres.com/ | ||
[node-test]: https://nodejs.org/api/test.html | ||
[Playwright]: https://playwright.dev/ | ||
[Postgres]: https://www.postgresql.org/ | ||
[Prettier]: https://prettier.io/ | ||
[pull request]: https://help.github.com/en/articles/about-pull-requests | ||
[React]: https://reactjs.org/ | ||
[React Router]: https://reactrouter.com/en/main | ||
[Render]: https://render.com/ | ||
[SuperTest]: https://github.com/visionmedia/supertest | ||
[TestContainers]: https://testcontainers.com/ | ||
[Vercel]: https://vercel.com/ | ||
[Vite]: https://vitejs.dev/ | ||
[Vitest]: https://vitest.dev/ | ||
[wiki]: https://github.com/textbook/starter-kit/wiki | ||
[Winston]: https://github.com/winstonjs/winston |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
services: | ||
- type: web | ||
plan: free | ||
name: starter-kit | ||
region: frankfurt | ||
env: node | ||
buildCommand: npm ci --include dev; npm run build; npm prune --omit dev | ||
startCommand: npm start | ||
healthCheckPath: /healthz | ||
envVars: | ||
- key: DATABASE_URL | ||
fromDatabase: | ||
name: psql | ||
property: connectionString | ||
- key: LOG_LEVEL | ||
value: info | ||
- key: NODE_ENV | ||
value: production | ||
|
||
databases: | ||
- name: psql | ||
region: frankfurt | ||
databaseName: cyf | ||
plan: free | ||
ipAllowList: [] # only allow internal connections |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
name: "👥 User story" | ||
about: Create a new user story | ||
title: "" | ||
labels: enhancement | ||
assignees: "" | ||
--- | ||
|
||
## Story | ||
|
||
- **As a** ............. | ||
|
||
- **I Want** ............. | ||
|
||
- **So That** ............. | ||
|
||
## Acceptance Criteria | ||
|
||
1. Given ............. | ||
- When ............. | ||
- Then ............. | ||
2. Given ............. | ||
- When ............. | ||
- Then ............. | ||
|
||
## Implementation Notes | ||
|
||
1. | ||
2. | ||
|
||
## Checklist: | ||
|
||
- [ ] I have defined the user story | ||
- [ ] I have defined some acceptance criteria | ||
- [ ] I have included any implementation notes | ||
- [ ] I have included all relevant links |