Start Here
Wake up. Hit snooze 4 times. Stare at your phone. Roll out of bed. Make coffee. Sit in traffic. Eight hours of unfulfilling work. Sit in traffic . . . again. Argue with your “significant” other. Walk the pet. Watch TV. Pass out. Repeat.
Get offended. Blame everyone but yourself. Tie your self-worth to radical ideologies. Accept everything at face value and question nothing. Expect free handouts for simply existing, no effort. Do what the authorities tell you. Go to school, get a job, retire at the ripe age of whatever it may be, no guarantees, with just the right amount of currency to survive until death.
Go through a painful experience. Find the light. Identify with it. Demonize anyone who questions that identity. Avoid the thought of any meaning, love, and consistent presence you had the potential of achieving in your life because that would require you to change.
What a life. A life I have lived multiple times, each one being shorter than the next. Many people say they enjoy this lifestyle, that they are fine living out the same day like an experimental TV drama. It seems like a peaceful existence, but one that I could never live. The thought of something more would eat me alive.
2025-03-19
Goals
- turn ai-chatbot template to Cloudflare nextjs app
- make ai-chatbot working locally
2025-03-18
Finally I am making a good progress. 🥳
Some of the things I have learned last couple of weeks
- Cursor isn't a good fit for me. I will stick with Code for now. 👨🏻💻
- I am bullish on Cloudflare and I am sticking with it.
- I would love to use D1 for my database, but Neon Postgres is a good alternative.
- Hopefully I will have something to show by the end of the month. 🤞
Goals
- Continue working with agents
- Trying to figure out how to integrate Agents to Next.js
- Connect to AI Agents using WebSockets
Works Done
pnpm create hono@latest
Links
- https://github.com/cloudflare/agents/blob/main/examples/cross-domain/src/client.tsx
- https://github.com/cloudflare/agents/blob/main/examples/cross-domain/src/server.ts
- https://github.com/cloudflare/agents/tree/main/examples/cross-domain ‼️
- https://developers.cloudflare.com/agents/api-reference/websockets/
- https://docs.partykit.io/tutorials/add-partykit-to-a-nextjs-app/
- https://github.com/partykit/partykit
- https://developers.cloudflare.com/workers/tutorials/live-cursors-with-nextjs-rpc-do/#1-create-a-nextjs-workers-project
- https://developers.cloudflare.com/workers/runtime-apis/bindings/service-bindings/rpc/
- https://github.com/vercel/ai-chatbot
2025-03-17
Goals
- Deepdive into Hono and Cloudflare Workers
- Watch https://www.youtube.com/watch?v=QP2ibznNr8Q
Works Done
pnpm create hono@latest
2025-03-16
Goals
- Continue working with agents-sdk.
- Next.js on Cloudflare Workers or Hono on Cloudflare Workers or React on Cloudflare Workers? Least painful option?
- Read about Cloudflare Durable Objects
Works Done
git clone https://github.com/exectx/next-live-cursors-do-rpc.git
cd next-live-cursors-do-rpc
pnpm install
pnpm dev
Links
- https://developers.cloudflare.com/reference-architecture/diagrams/serverless/fullstack-application/
- https://developers.cloudflare.com/durable-objects/get-started/tutorial/
- https://developers.cloudflare.com/workers/tutorials/live-cursors-with-nextjs-rpc-do/#1-create-a-nextjs-workers-project
2025-03-15
Goals
- Continue working with agents-sdk.
- Next.js on Cloudflare Workers or Hono on Cloudflare Workers or React on Cloudflare Workers? Least painful option?
Works Done
2025-03-14
Goals
- Chat AI working using Cloudflare Agents inside my app.
Works Done
pnpm add ai @ai-sdk/react @ai-sdk/openai zod
Links
- https://sdk.vercel.ai/docs/introduction
- https://sdk.vercel.ai/docs/getting-started/nextjs-app-router
2025-03-13
- Today, I will revisit Laravel
Lessons Learned
- Do NOT complicate things by adding unnecessary features or dependencies. e.g. I won't use Drizzle ORM for now.
- Even you won't even have to figure out how to run migration script on D1. Just run them in the console.
Goals
- GitHub OAuth Test
-
Auth.js Credentials Test with D1 Adapter -
Clerk for authentication
Works Done
npm create cloudflare@latest -- --template cloudflare/agents-starter
# create nextjs app on cloudflare workers
pnpm create cloudflare@latest cf-20250313 --framework=next --experimental
# create d1 database
npx wrangler d1 create cf-20250313-db
# ran migration script using drizzle studio on Cloudflare webpage
pnpm add next-auth@beta
npx auth secret
LInks
- https://developers.cloudflare.com/agents/
- https://developers.cloudflare.com/r2/api/workers/workers-api-usage/
- https://developers.cloudflare.com/developer-spotlight/tutorials/fullstack-authentication-with-next-js-and-cloudflare-d1/
- https://authjs.dev/getting-started/authentication/oauth?framework=next-js
- https://www.youtube.com/watch?v=XQbiMiNah0o
2025-03-12
- Starting getting the grasp of Cloudflare Workers, D1 and Drizzle ORM.
- Will continue to work on the SaaS AI Starterkit tomorrow.
Goal
-
I will have a running next.js application on cloud workers with authentication working using Auth.js with Dizzle orm and D1 - Set up Cloudflare worker with D1 bind and see if I can create, add, update, and delete tables and rows.
Todo
- Drizzle ORM
- Auth.js
- Cloudflare Workers
Works Done
pnpm create cloudflare@latest gxpsoftai-saas-ai-starterkit --framework=next --experimental
cd gxpsoftai-saas-ai-starterkit
cursor .
# create .cursor/rules/cloudflare.mdc and copy https://developers.cloudflare.com/workers/prompt.txt
# open up terminal window
pnpm add next-auth@beta
pnpm create cloudflare@latest gxpsoftai-test-01 --framework=next --experimental
cd gxpsoftai-test-01
pnpm add drizzle-orm
pnpm add -D drizzle-kit
pnpm create cloudflare@latest my-first-worker
cd my-first-worker
cursor .
# open up terminal window
pnpm dev
# go to http://localhost:3000 to see the website is running
# nextjs on Cloudflare Worders with Auth.js/Drizzle/D1 authentication
Links
- https://www.youtube.com/watch?v=-JnEuvPmt-Q
- https://developers.cloudflare.com/developer-spotlight/tutorials/fullstack-authentication-with-next-js-and-cloudflare-d1/
- https://pnpm.io/cli/add#tldr
- https://github.com/drizzle-team/drizzle-orm/tree/main/examples/cloudflare-d1
- https://developers.cloudflare.com/d1/get-started/
- https://developers.cloudflare.com/workers/prompt.txt
- https://orm.drizzle.team/docs/get-started/d1-new
- https://orm.drizzle.team/docs/guides/d1-http-with-drizzle-kit
- https://developers.cloudflare.com/workers/configuration/secrets/
- https://authjs.dev/getting-started/adapters/drizzle
2025-03-11
I think I had the most productive day of 2025 thanks to Dan Koe. Hopefully I can keep it going. Tomorrow, I will dig in deeper into Cloudflare Worker with D1.
Works Done
git clone https://github.com/nextjs/saas-starter my-saas-mvp
cd my-saas-mvp
cursor .
pnpm install
# Use the included setup script to create your .env file: .env info saved in "SAAS" Bitwarden
# this step can be skipped since we are copy/paste .env
pnpm db:setup
# Then, run the database migrations and seed the database with a default user and team:
# created new postgres instance with the correct port that's indicated in .env file
pnpm db:migrate
pnpm db:seed
# This will create the following user and team:
# User: test@test.com Password: admin123
pnpm dev
# Cloudflare section
pnpm add -D @opennextjs/cloudflare
# Add a Wrangler configuration file at the root level. wrangler.jsonc
{
"main": ".open-next/worker.js",
"name": "my-app",
"compatibility_date": "2024-09-23",
"compatibility_flags": [
"nodejs_compat"
],
"assets": {
"directory": ".open-next/assets",
"binding": "ASSETS"
}
}
# Update package.json insert below in "scripts" section
"build:worker": "opennextjs-cloudflare",
"dev:worker": "wrangler dev --port 8771",
"preview:worker": "npm run build:worker && npm run dev:worker",
"deploy:worker": "npm run build:worker && wrangler deploy"
# Add caching with Workers KV
npx wrangler@latest kv namespace create NEXT_CACHE_WORKERS_KV
{
"kv_namespaces": [
{
"binding": "NEXT_CACHE_WORKERS_KV",
"id": "<YOUR_NAMESPACE_ID>"
}
]
}
# Preview locally your application and create an OpenNext config file
pnpm preview:worker
# Deploy to Cloudflare Workers
pnpm deploy:worker
pnpm create cloudflare@latest gxpsoftai-test-01 --framework=next --experimental
cd gxpsoftai-test-01
pnpm add drizzle-orm
pnpm add -D drizzle-kit
Issues
- when deployed to Cloudflare, there were some errors while logging in or going to different pages. My guess is that Stripe settings need to be reconfigured in order for the "production" site to work properly.
Next Steps
- Research online postgres tools that work well with Cloudflare Workers
- Research on moving database to Cloudflare B1: My preferred option
- Merge Cloudflare AI sdk
- https://developers.cloudflare.com/developer-spotlight/tutorials/fullstack-authentication-with-next-js-and-cloudflare-d1/
Links Visited and Used
- https://github.com/nextjs/saas-starter
- https://developers.cloudflare.com/workers/frameworks/framework-guides/nextjs/
- https://github.com/nextjs/saas-starter?tab=readme-ov-file#going-to-production
- https://github.com/drizzle-team/drizzle-orm/tree/main/examples/neon-cloudflare
- https://github.com/neondatabase/serverless-cfworker-demo
- https://developers.cloudflare.com/workers/databases/connecting-to-databases/
Decisions
- Vercel or Cloudflare Worker?
- SaaS Postgres solution? https://orm.drizzle.team/docs/connect-neon