Skip to content

Backend Architecture

Jeffery edited this page Apr 18, 2025 · 4 revisions

We are using Payload CMS for the backend.

Google OAuth Authentication

  1. To create a Google OAuth App, you'll need to head over to Google Cloud Console.

  2. Create a new project or use an existing project.

  3. Navigate to APIs & Services -> Credentials -> + Create Credentials -> OAuth Client ID.

  4. You'll want to add the following Authorised JavaScript origins:

http://localhost:3000
https://your-website.fly.dev
  1. You'll want to add the following Authorised redirect URIs:
http://localhost:3000/api/auth/google/callback
https://your-website.fly.dev/api/auth/google/callback/
  1. Copy the Client ID and Client Secret.

JWT (JSON Web Token) Secret

In this project, we are using JWT (with jsonwebtoken) with authentication to pass user data and the Google access_token. JWT tokens require a secret which is defined in env.

To generate a JWT secret, you can run node -e "console.log(crypto.randomBytes(64).toString('hex'))" in your terminal to generate such. As shown in .env.example, the environment variable is named JWT_SECRET, so you can paste this key and value into your env file.

Clone this wiki locally