npm create vite@latest: TypeScript + SWC optionsnpm create amplify@latest: Init in root (.) of projecttouch .env.local: Get this from Clerk and display as showin insample.envlocalfilenpm install @clerk/clerk-react: Installs the clerk deps for Vite- Follow this doc for install steps
- Install Tailwind, DaisyUI, and React Router:
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p
npm i -D daisyui@latest
npm install react-router-domThis is going to be an app where users can upload text with photos to create a timeline of events.
The landing page should speak on that.
- Create HomePage Route
- DaisyUI Nav, Hero, and Footer
This app needs a place to add milestones (text + images), and view them. Note that the only person that should be able to view them are the owner.
If this where an application where you simply needed to be signed in to see some protected data, then using the AWS Amplify
.authorization(allow => ([allow.authenticated()]))would be fine. But in this app, we wantownerauthorization. Amplify uses cognito to apply an owner using the format<sub>::<username>. Since we're not using Cognito, we have to manage that ourselves.
- Create the page✅
- Protect the Page with Clerk Auth✅
- Create the API to auth based on a simple Lambda function✅
- Enhance to the Lambda function to check the Authorization header which will contain the Clerk logic so I can manually verify the JWT
- Review how to add ownership by looking at my cdk starter repo
"Retrieve the session token from either __session cookie for a same origin request or from the Authorization header for cross origin requests."