Vention MachineCloud test by @jadiaheno

Vention.mp4

Prerequisites

How to launch

git clone https://github.com/jadiaheno/vention-machine-cloud-test.git
cd vention-machine-cloud-test
docker compose up -d

What's in it?

This is an album store. It shows you a list of albums that you can rate from 1 to 5, and can add to your cart. The album list was generated by leveraging the spotify provider from NextAuth.js, then inserting the albums from my liked songs in the database. You have here a snapshot of my musical taste!

How did it go?

T3

First of all, there is a bug in the drizzle-adapter shipping with the latest version of the T3. Luckily for me, it was fixed in a more recent version with no incompatibility.

Drizzle

It was my first experience with the drizzle ORM, and will not be the last. It supports joins and relations out of the box (unlike prisma). The syntax and helpers enabled me to write mid-complex queries (upserts, increments, etc...). I'm passing generated migrations sql files directly in the migration folder of the postgres database instead of migrating with the API.

tRPC

tRPC provides a fully-typed API client, and useful functions server-side (eg: input sanitization with zod).

NextAuth

I implemented guest sessions which is not supported by next-auth. I customized heavily the authOptions to be able to create guest sessions without JWT. In fact, the Credential Provider from NextAuth does not support database session management as a strategy, only JWT; but we found a work-around.

Misc

On my machine, i used bun as bundler, but their docker image has an issue with tRPC. I reverted to npm for the docker image. Next 14 only works with Node >= v18.17.0.

What was built

  • An application using React that will display a list of items that you can add to your cart
  • When you add an item to your cart it should be represented in the UI
  • You should be able to remove products from the cart
  • You must add the ability to rate products with a score from (1 to 5)
  • Provide instructions in the README to launch the application

Bonus points

  • Use TypeScript
  • Implement a backend and persist the state in a database
  • Have a single command to launch the whole application
  • Use the open-source project T3 stack as a template for your application