yarnCreate a .env.local file in the root of the project and add the following variables:
POSTGRES_URL=postgres://postgres:postgres@localhost:5432/hack2
AUTH_SECRET=<ANY_RANDOM_STRING>
AUTH_GITHUB_ID=
AUTH_GITHUB_SECRET=
NEXT_PUBLIC_BASE_URL=http://localhost:3000本次考試不會評分 Github 登入的部分,但是如果懶得打帳號密碼,可以參考以下步驟:
-
Go to
Settingstab of your Github account -
Click
Developer settingson the left sidebar -
Click
OAuth Appson the left sidebar -
Click
New OAuth App -
Enter the following information:
Application name:Notion Clone(or any name you like)Homepage URL:http://localhost:3000Authorization callback URL:http://localhost:3000/api/auth/callback/github
-
Click
Register application -
Copy the
Client IDandClient Secretto your.env.localfile:AUTH_GITHUB_ID=<Client ID> AUTH_GITHUB_SECRET=<Client Secret>Note that in NextAuth v5, the prefix
AUTH_is required for the env variables.Note that you do not have to add those keys to
src/lib/env/private.tssince they are automatically handled by NextAuth.
- Start database
docker compose up -d- Run migrations
yarn migrateyarn devyarn playwright install chromium # Install Chromium (if not already installed)
yarn playwright install-deps chromium # Install Chromium dependencies (if not already installed)yarn test