Duplicate env.example
and .env.test.example
and rename to .env
and .env.test
We are going to use firebase to create the credentials for us. We can use Google cloud console directly but we will need to configure extra stuff.
How to create credentials in firebase
Part 1:
- Go to firebase. Create a new account then click on add project.
- Give a name for your app then you can leave everything as default and click next.
- Go to the authentication tab in the sidebar. Click get started. Click on Google sign in and enable it. Now simply click on save.
- If you click on edit again and open the Web SDK configuration accordion. You can see the credentials we need. I am showing my credentials for the demo but you shouldn’t show your credentials.
- Now add the credentials to your
.env
file.
Part 2:
- Stop and start your dev server
yarn dev
- Click on "Sign in with Google" in the app
- You'll get an error screen. Now copy the link at which is at the bottom of the error and paste the link into a new tab. Scroll down and you will be able to see redirect URI’s.
- Now click on ADD URI and add this:
http://localhost:3000/api/auth/callback/google
- Then click on save. If you try logging in. You can now log in.
run docker-compose up -d
You haven't installed docker and docker-compose on your system?
You'll only need these commands when using docker-compose:
# start running containers
docker-compose up -d
# shut-down running containers
docker-compose down
# list running containers
docker-compose ps
yarn test
Optionally, you can add a name pattern of the file name:
yarn test User
Check test coverage:
yarn test:coverage
- open file
./coverage/lcov-report/index.html
We're using PlanetScale for our database. It uses a MySql database, however PlanetScale doesn't support foreign key constraints and we enabled this on the Prisma level instead of having it at the DB level.
This means there's one thing we need to consider now:
We now always need to add an @@index([...])
if we add a foreign key (otherwise certain queries would run slower).
- find a detailed explaination in this video: https://youtu.be/iaHt5_hg44c?t=757