Jordi Olle Logo

/BLOG

Building with purpose 6.2: Retrieving the user from Clerk

Building with purpose 6.2: Retrieving the user from Clerk

Having the long-lived token copied somewhere nearby, it's now time to retrieve the user from Clerk, but to do so, we need to make a few adjustments. From our index.ts, we need to modify the dotenv import and use import "dotenv/config" instead. Make s...

Building with purpose 6.1: Getting the long live token

Building with purpose 6.1: Getting the long live token

Now that the user is created, we need to generate the long-lived token to continue with the backend and set aside the frontend for a while. To do this, we’ll go to our Clerk dashboard, select the Configure tab, and click on the JWT templates item. O...

Building with purpose 6: Setting up the frontend

Building with purpose 6: Setting up the frontend

Now we’re moving towards the frontend part because we want to get the long-lived token from Clerk in order to test the backend fully with it (because right now we can only see the "User not authenticated" message). Here we go! Adding React Router We’...

Building with purpose 5: Configuring Husky for commit linting

Building with purpose 5: Configuring Husky for commit linting

I’ve never used it, but I always wanted to, so here we go. I know it’s something that’s done at the beginning, but we’re not that far from it. For the moment, I just want to use Husky for commit lint because I like my commits well defined and not jus...

Building with Purpose 4: Adding the models and relations

Building with Purpose 4: Adding the models and relations

With the database set up, we can now add more models. Thinking about it, we can see three models right now: User (which we already have). Feedback. Town. model User { id Int @id @default(autoincrement()) email String ...

Building with Purpose 3: Using Prisma and PostgreSQL for the database part

Building with Purpose 3: Using Prisma and PostgreSQL for the database part

Now that we have the authentication implemented, we need to define the database. We first need to add the necessary dependencies. pnpm add @prisma/client prisma pg Create the database: psql -U postgres CREATE DATABASE yourdatabase; With Postgres r...

Building with Purpose 2: Adding authentication with Clerk

Building with Purpose 2: Adding authentication with Clerk

This part is going to be pretty close to the guide provided by Clerk, but we’ll add a few things to make it look different. I’m assuming you know how to create an account at Clerk, so we’ll skip that part. Once registered, it’ll ask you to create a n...

Building with Purpose 1.1: Making logs prettier with pino-pretty

Building with Purpose 1.1: Making logs prettier with pino-pretty

In the previous article, we saw these screenshot with the first logs of our backend server. They work but they don’t look great (I mean, they can look better). We’ll do this with pino-pretty. The default logging in fastify is made with pino,but we c...

Building with Purpose 1: Setting up the backend part

Building with Purpose 1: Setting up the backend part

All right, here we go, the backend journey starts! Setting up the project First and foremost, we create the folder, access it, and run pnpm init (unlike npm, this command doesn't require the -y flag and isn't interactive). Now we are going to use git...

Building with Purpose: A Developer's Quest for Balance in 2025

Building with Purpose: A Developer's Quest for Balance in 2025

Why this project? The end of 2024 and the beginning of 2025 have been heavily influenced by AI for me (and most of us developers). I don’t use it much at work, but at home, using Cursor, I found myself using it too much. I realized this when I though...