This project is a collaborative effort between:
undertaken as part of our final team project for the Certificate of Advanced Studies in Advanced Frontend Engineering
at the University of Applied Sciences of Eastern Switzerland (OST)
.
This is a Next.js project bootstrapped with create-next-app
.
Next.js Documentation - learn about Next.js features and API.
You need to have a .env.local file in the root of the project with the following variables:
Variable | value |
---|---|
ZITADEL_CLIENT_ID | Secret. ask for the value to one of the maintainers |
ZITADEL_ISSUER | https://cas-fee-adv-ed1ide.zitadel.cloud |
MUMBLE_API_URL | https://mumble-api-prod-4cxdci3drq-oa.a.run.app |
ENVIRONMENT | local - development - production |
NEXTAUTH_SECRET | Secret. ask for the value to one of the maintainers |
NEXTAUTH_URL | http://localhost:3000 - https://cusconews.com - https://dev.cusconews.com |
TEST_USER_NAME | Secret. ask for the value to one of the maintainers |
TEST_USER_PASSWORD | Secret. ask for the value to one of the maintainers |
In case a new environment is needed (exp. staging), please add the domain of the same to the allowed domains
in the zitadel configuration (config/index.ts).
The environment variables undergo validation by Zod in config/env.ts. If you need to introduce new environment variables, append them to this file. Otherwise, no validation will be performed for those variables.
Additionally, don't forget to update the GitHub Actions files and include them in the variables and secrets on GitHub.
This project uses Zitadel. Make sure that you have an Organization in Zitadel and that you have the client id and the issuer url. The return URL must be configured in the Zitadel configuration. As an example, the return URL for the dev environment our configuration includes the following url:
https://main.dpejyjo5wbo0b.amplifyapp.com/api/auth/callback/zitadel
https://dev.cusconews.com/api/auth/callback/zitadel
http://localhost:3000
The Zitadel configuration is located in the app/api/auth/[...nextauth]/auth.ts
file.
First, run the development server:
npm run dev
Open http://localhost:3000 with your browser to see the result.
npm run build
Open http://localhost:3000 with your browser to see the result.
Run linter:
npm run lint
Check prettier format:
npm run format:check
Fix prettier format:
npm run format:fix
Run type checking:
npm run type-check
Run linter, prettier and type checking:
npm run code:fix
Tests are located in the /tests
directory. They come in two flavors: those within /auth
require a signed-in user, while the ones in the root test folder are login-independent. The authentication tests' setup is handled in /tests/auth/setup/index.ts
. Furthermore, we've set up a GitHub Action in .github\workflows\playwright.yml
to automatically run these tests whenever code is pushed to the main branch or a pull request is opened.
Run all playwright tests
npm run test
Open playwright's ui mode to run the tests there:
npm run test:ui
Our Project uses AWS Amplify for deployment. This allows us to deploy the whole application based on commits to main and production branches.
The Amplify configuration is located in the amplify.yml
file.
Make sure that you include all environment variables in the amplify console and also in the amplify.yml
file.
Amplify does not add the environment variables automatically to the build process. you need to do it manually (see amplify.yml
).
env | grep -e NEXTAUTH_URL -e NEXTAUTH_SECRET -e ZITADEL_CLIENT_ID -e ZITADEL_ISSUER -e MUMBLE_API_URL -e ENVIRONMENT >> .env
The dev deployment is triggered by a commit to the main branch. Directs commits or pull requests merged into the main branch will trigger a deployment to the dev environment.
The production deployment is triggered by a commit to the production branch. The strategy is to merge the main branch into the production branch accordingly.