Cobracase

Cobracase is an online store for custom phone cases. Customers upload an image, place it on their phone, and order the case. It's a Next.js app with PostgreSQL through Drizzle ORM, Kinde for sign-in, and Stripe for payments.

What it does

Case configurator

Customers drag in an image, then move and resize it over a mockup of the phone. They pick the case color, the phone model, the material, and the finish, and see the result before they check out.

Checkout

Stripe Checkout takes card payments and collects a shipping address for Morocco or the US. A webhook listens for completed sessions, marks the order as paid, and saves the shipping and billing addresses.

Confirmation email

Once an order is paid, Resend sends a thank-you email built with React Email.

Admin dashboard

An admin account sees every paid order, can change each order's status, and tracks revenue for the last week and month against a goal.

What was hard

Cropping the design to the case

The customer positions the image on screen, but the order needs an image cut to the exact case area. The configurator redraws the image on a canvas at the position and size the customer chose, crops it to the case, and uploads the result as the final design.

Built with

Next.js
The App Router storefront, the case configurator, server actions, and the auth, upload and webhook routes
TypeScript
The language for the whole app
Tailwind CSS
Styling, on top of shadcn/ui components
shadcn/ui
Buttons, dialogs, dropdowns and the progress bars on the admin dashboard
Drizzle ORM
Schema and queries for configurations, orders, users and addresses
PostgreSQL
The database, hosted on Neon and reached through its serverless driver
Kinde
Sign-in before checkout, and the admin check on the dashboard
UploadThing
Stores the uploaded image and the cropped design
react-rnd
Drag and resize the image on top of the phone in the configurator
Stripe
Checkout sessions, and the webhook that marks an order as paid and saves its addresses
Resend
Sends the order confirmation email, written with React Email