Skip to content

Instantly share code, notes, and snippets.

@AntonioErdeljac
Last active November 21, 2025 17:07
Show Gist options
  • Select an option

  • Save AntonioErdeljac/742df57011c55c365841daca78f53c1f to your computer and use it in GitHub Desktop.

Select an option

Save AntonioErdeljac/742df57011c55c365841daca78f53c1f to your computer and use it in GitHub Desktop.
Funroad assets
const categories = [
{
name: "All",
slug: "all",
},
{
name: "Business & Money",
color: "#FFB347",
slug: "business-money",
subcategories: [
{ name: "Accounting", slug: "accounting" },
{
name: "Entrepreneurship",
slug: "entrepreneurship",
},
{ name: "Gigs & Side Projects", slug: "gigs-side-projects" },
{ name: "Investing", slug: "investing" },
{ name: "Management & Leadership", slug: "management-leadership" },
{
name: "Marketing & Sales",
slug: "marketing-sales",
},
{ name: "Networking, Careers & Jobs", slug: "networking-careers-jobs" },
{ name: "Personal Finance", slug: "personal-finance" },
{ name: "Real Estate", slug: "real-estate" },
],
},
{
name: "Software Development",
color: "#7EC8E3",
slug: "software-development",
subcategories: [
{ name: "Web Development", slug: "web-development" },
{ name: "Mobile Development", slug: "mobile-development" },
{ name: "Game Development", slug: "game-development" },
{ name: "Programming Languages", slug: "programming-languages" },
{ name: "DevOps", slug: "devops" },
],
},
{
name: "Writing & Publishing",
color: "#D8B5FF",
slug: "writing-publishing",
subcategories: [
{ name: "Fiction", slug: "fiction" },
{ name: "Non-Fiction", slug: "non-fiction" },
{ name: "Blogging", slug: "blogging" },
{ name: "Copywriting", slug: "copywriting" },
{ name: "Self-Publishing", slug: "self-publishing" },
],
},
{
name: "Other",
slug: "other",
},
{
name: "Education",
color: "#FFE066",
slug: "education",
subcategories: [
{ name: "Online Courses", slug: "online-courses" },
{ name: "Tutoring", slug: "tutoring" },
{ name: "Test Preparation", slug: "test-preparation" },
{ name: "Language Learning", slug: "language-learning" },
],
},
{
name: "Self Improvement",
color: "#96E6B3",
slug: "self-improvement",
subcategories: [
{ name: "Productivity", slug: "productivity" },
{ name: "Personal Development", slug: "personal-development" },
{ name: "Mindfulness", slug: "mindfulness" },
{ name: "Career Growth", slug: "career-growth" },
],
},
{
name: "Fitness & Health",
color: "#FF9AA2",
slug: "fitness-health",
subcategories: [
{ name: "Workout Plans", slug: "workout-plans" },
{ name: "Nutrition", slug: "nutrition" },
{ name: "Mental Health", slug: "mental-health" },
{ name: "Yoga", slug: "yoga" },
],
},
{
name: "Design",
color: "#B5B9FF",
slug: "design",
subcategories: [
{ name: "UI/UX", slug: "ui-ux" },
{ name: "Graphic Design", slug: "graphic-design" },
{ name: "3D Modeling", slug: "3d-modeling" },
{ name: "Typography", slug: "typography" },
],
},
{
name: "Drawing & Painting",
color: "#FFCAB0",
slug: "drawing-painting",
subcategories: [
{ name: "Watercolor", slug: "watercolor" },
{ name: "Acrylic", slug: "acrylic" },
{ name: "Oil", slug: "oil" },
{ name: "Pastel", slug: "pastel" },
{ name: "Charcoal", slug: "charcoal" },
],
},
{
name: "Music",
color: "#FFD700",
slug: "music",
subcategories: [
{ name: "Songwriting", slug: "songwriting" },
{ name: "Music Production", slug: "music-production" },
{ name: "Music Theory", slug: "music-theory" },
{ name: "Music History", slug: "music-history" },
],
},
{
name: "Photography",
color: "#FF6B6B",
slug: "photography",
subcategories: [
{ name: "Portrait", slug: "portrait" },
{ name: "Landscape", slug: "landscape" },
{ name: "Street Photography", slug: "street-photography" },
{ name: "Nature", slug: "nature" },
{ name: "Macro", slug: "macro" },
],
},
]
{
"name": "multitenant-ecommerce",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"generate:types": "payload generate:types",
"db:fresh": "payload migrate:fresh",
"db:seed": "bun run src/seed.ts"
},
"dependencies": {
"@hookform/resolvers": "^5.0.1",
"@payloadcms/db-mongodb": "3.34.0",
"@payloadcms/next": "3.34.0",
"@payloadcms/payload-cloud": "3.34.0",
"@payloadcms/plugin-multi-tenant": "3.34.0",
"@payloadcms/richtext-lexical": "3.34.0",
"@payloadcms/storage-vercel-blob": "3.34.0",
"@radix-ui/react-accordion": "^1.2.3",
"@radix-ui/react-alert-dialog": "^1.1.6",
"@radix-ui/react-aspect-ratio": "^1.1.2",
"@radix-ui/react-avatar": "^1.1.3",
"@radix-ui/react-checkbox": "^1.1.4",
"@radix-ui/react-collapsible": "^1.1.3",
"@radix-ui/react-context-menu": "^2.2.6",
"@radix-ui/react-dialog": "^1.1.6",
"@radix-ui/react-dropdown-menu": "^2.1.6",
"@radix-ui/react-hover-card": "^1.1.6",
"@radix-ui/react-label": "^2.1.2",
"@radix-ui/react-menubar": "^1.1.6",
"@radix-ui/react-navigation-menu": "^1.2.5",
"@radix-ui/react-popover": "^1.1.6",
"@radix-ui/react-progress": "^1.1.2",
"@radix-ui/react-radio-group": "^1.2.3",
"@radix-ui/react-scroll-area": "^1.2.3",
"@radix-ui/react-select": "^2.1.6",
"@radix-ui/react-separator": "^1.1.2",
"@radix-ui/react-slider": "^1.2.3",
"@radix-ui/react-slot": "^1.1.2",
"@radix-ui/react-switch": "^1.1.3",
"@radix-ui/react-tabs": "^1.1.3",
"@radix-ui/react-toggle": "^1.1.2",
"@radix-ui/react-toggle-group": "^1.1.2",
"@radix-ui/react-tooltip": "^1.1.8",
"@tanstack/react-query": "5.72.1",
"@trpc/client": "11.0.3",
"@trpc/server": "11.0.3",
"@trpc/tanstack-react-query": "11.0.3",
"class-variance-authority": "^0.7.1",
"client-only": "0.0.1",
"clsx": "^2.1.1",
"cmdk": "^1.1.1",
"date-fns": "^4.1.0",
"embla-carousel-react": "^8.6.0",
"graphql": "^16.8.1",
"input-otp": "^1.4.2",
"lucide-react": "^0.487.0",
"next": "15.2.4",
"next-themes": "^0.4.6",
"nuqs": "^2.4.1",
"payload": "^3.33.0",
"react": "^19.0.0",
"react-day-picker": "8.10.1",
"react-dom": "^19.0.0",
"react-hook-form": "^7.55.0",
"react-resizable-panels": "^2.1.7",
"recharts": "^2.15.2",
"server-only": "0.0.1",
"sonner": "^2.0.3",
"stripe": "^18.0.0",
"superjson": "^2.2.2",
"tailwind-merge": "^3.1.0",
"tw-animate-css": "^1.2.5",
"vaul": "^1.1.2",
"zod": "3.24.2",
"zustand": "^5.0.3"
},
"devDependencies": {
"typescript": "^5",
"@types/node": "^20",
"@types/react": "^19",
"@types/react-dom": "^19",
"@tailwindcss/postcss": "^4",
"tailwindcss": "^4",
"eslint": "^9",
"eslint-config-next": "15.2.4",
"@eslint/eslintrc": "^3"
}
}
@Ankit-2145
Copy link

✅ [new Agent().compose] Error working Solution for Seeding the Database with Payload + Bun

Instead of running your seed script like this:

"scripts": {
 "db:seed": "bun run src/seed.ts"
}

🔁 Use this script in your package.json:

"scripts": {
  "db:seed": "payload run src/seed.ts"
}

Then run:

bun run db:seed

If that doesn't work due to environment or runtime differences, you can directly run the seed file using:

npx payload run src/seed.ts

💡 Why This Works

  • payload run uses Payload's internal CLI, which sets up the correct Node.js runtime, environment variables, and TypeScript support automatically.
  • Running bun run src/seed.ts directly fails because Bun does not yet fully support Node.js APIs like Agent().compose, which Payload internally uses (e.g., in safeFetch.js).
  • Using payload run ensures that seeding is done through a Node-compatible layer, even if you use Bun for development elsewhere in your project.

@RealSollyM
Copy link

So I installed tsx and dotenv as DevDependencies. Then added

import "dotenv/config";

at the beginning of my seed.ts

and changed my script to be

"db:seed": "tsx src/seed.ts"

It works well.

Payload didn't work for me either when doing the generate:types or db:refresh. I had to use

"generate:types": "bunx tsx ./node_modules/payload/bin.js generate:types",
"db:fresh": "bunx tsx ./node_modules/payload/bin.js migrate:refresh",

to work around that.

@udaychaudhary1903
Copy link

not loading seed instead of deleted all my node modules and see error everytime i run anything

@Ankit-2145
Copy link

✅ [new Agent().compose] Error working Solution for Seeding the Database with Payload + Bun

Instead of running your seed script like this:

"scripts": {
 "db:seed": "bun run src/seed.ts"
}

🔁 Use this script in your package.json:

"scripts": {
  "db:seed": "payload run src/seed.ts"
}

Then run:

bun run db:seed

If that doesn't work due to environment or runtime differences, you can directly run the seed file using:

npx payload run src/seed.ts

💡 Why This Works

  • payload run uses Payload's internal CLI, which sets up the correct Node.js runtime, environment variables, and TypeScript support automatically.
  • Running bun run src/seed.ts directly fails because Bun does not yet fully support Node.js APIs like Agent().compose, which Payload internally uses (e.g., in safeFetch.js).
  • Using payload run ensures that seeding is done through a Node-compatible layer, even if you use Bun for development elsewhere in your project.

Try using this approach if you are using bun

@Ankit-2145
Copy link

This is built using nextjs 15 which is used to develop web apps that run in the browser, so you cannot add it to google play store, you need to deploy it to server like VPS, vercel, cloudflare etc.

@wuqiang2001
Copy link

payload.config.ts add
import { Categories } from './collections/Categories'
collections: [Users, Media, Categories],

but playload.types.ts cannot found collection Categories, why? what can I do?

@wuqiang2001
Copy link

bun run generate:types
$ payload generate:types

node:internal/process/promises:394
triggerUncaughtException(err, true /* fromPromise */);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/wuqiang/workspace/multitenant-ecommerce/src/collections/Users' imported from /home/wuqiang/workspace/multitenant-ecommerce/src/payload.config.ts
at finalizeResolution (node:internal/modules/esm/resolve:275:11)
at moduleResolve (node:internal/modules/esm/resolve:860:10)
at defaultResolve (node:internal/modules/esm/resolve:984:11)
at nextResolve (node:internal/modules/esm/hooks:748:28)
at resolve (file:///home/wuqiang/workspace/multitenant-ecommerce/node_modules/tsx/dist/esm/index.mjs?1756900476312:2:5346)
at nextResolve (node:internal/modules/esm/hooks:748:28)
at Hooks.resolve (node:internal/modules/esm/hooks:240:30)
at handleMessage (node:internal/modules/esm/worker:199:24)
at Immediate.checkForMessages (node:internal/modules/esm/worker:141:28)
at process.processImmediate (node:internal/timers:485:21) {
code: 'ERR_MODULE_NOT_FOUND',
url: 'file:///home/wuqiang/workspace/multitenant-ecommerce/src/collections/Users'
}

Node.js v22.15.0
error: script "generate:types" exited with code 1

@hoangtrung1002
Copy link

Anyone have the issue about send request create product but tenant is null.
When login the user's website and move to admin page via dashboard

image image image

@gurvirsinghdev
Copy link

bun run generate:types $ payload generate:types

node:internal/process/promises:394 triggerUncaughtException(err, true /* fromPromise */); ^ Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/wuqiang/workspace/multitenant-ecommerce/src/collections/Users' imported from /home/wuqiang/workspace/multitenant-ecommerce/src/payload.config.ts at finalizeResolution (node:internal/modules/esm/resolve:275:11) at moduleResolve (node:internal/modules/esm/resolve:860:10) at defaultResolve (node:internal/modules/esm/resolve:984:11) at nextResolve (node:internal/modules/esm/hooks:748:28) at resolve (file:///home/wuqiang/workspace/multitenant-ecommerce/node_modules/tsx/dist/esm/index.mjs?1756900476312:2:5346) at nextResolve (node:internal/modules/esm/hooks:748:28) at Hooks.resolve (node:internal/modules/esm/hooks:240:30) at handleMessage (node:internal/modules/esm/worker:199:24) at Immediate.checkForMessages (node:internal/modules/esm/worker:141:28) at process.processImmediate (node:internal/timers:485:21) { code: 'ERR_MODULE_NOT_FOUND', url: 'file:///home/wuqiang/workspace/multitenant-ecommerce/src/collections/Users' }

Node.js v22.15.0 error: script "generate:types" exited with code 1

You can fix this issue by setting the type property in the package.json.

"type": "module"

@Shruti270903
Copy link

Error: Transform failed with 1 error:
C:\Users\Sanga\OneDrive\Desktop\multivendor\multitenant\src\seed.ts:190:0: ERROR: Top-level await is currently not supported with the "cjs" output format
at failureErrorWithLog (C:\Users\Sanga\OneDrive\Desktop\multivendor\multitenant\node_modules\esbuild\lib\main.js:1467:15)
at C:\Users\Sanga\OneDrive\Desktop\multivendor\multitenant\node_modules\esbuild\lib\main.js:736:50
at responseCallbacks. (C:\Users\Sanga\OneDrive\Desktop\multivendor\multitenant\node_modules\esbuild\lib\main.js:603:9)
at handleIncomingPacket (C:\Users\Sanga\OneDrive\Desktop\multivendor\multitenant\node_modules\esbuild\lib\main.js:658:12)
at Socket.readFromStdout (C:\Users\Sanga\OneDrive\Desktop\multivendor\multitenant\node_modules\esbuild\lib\main.js:581:7)
at Socket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5)
at Pipe.onStreamRead (node:internal/stream_base_commons:189:23) {
name: 'TransformError'
}
seeding is not complete, please help...

@Ankit-2145
Copy link

Have you added "type": module in package json?

@Shruti270903
Copy link

Have you added "type": module in package json?

Yes, I added it

@Ankit-2145
Copy link

can you please specify when this error is coming...
Like after what code you wrote or where are you currently on the project tutorial
it would be more helpful to find the error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment