This skill should be used when working with the Plebeian Market codebase - a decentralized Nostr-based e-commerce marketplace...
This skill provides comprehensive guidance for developing features in the Plebeian Market application, a decentralized e-commerce marketplace built on the Nostr protocol. It ensures consistency with the established architecture, coding patterns, styling conventions, and Nostr integration approaches used throughout the codebase.
Use this skill when:
Refer to references/libraries.md for complete dependency list and versions.
Before implementing features, understand the project structure:
/src/routes/ - File-based routing (use $param for dynamic segments, _layout prefix for layouts)/src/components/ - React components (organized by feature or in ui/ for base components)/src/lib/stores/ - TanStack Store state management/src/queries/ - React Query hooks and query key factories/src/hooks/ - Custom React hooks for reusable logicRead references/architecture.md for detailed project structure and architectural patterns.
Follow these established patterns:
For detailed patterns and code examples, read references/patterns.md.
TanStack Router uses file-based routing:
// Example: routes/products.$productId.tsx
export const Route = createFileRoute('/products/$productId')({
component: ProductDetailComponent,
})
function ProductDetailComponent() {
const { productId } = Route.useParams()
const productQuery = useSuspenseQuery(productQueryOptions(productId))
return <div>{/* render product */}</div>
}
Key conventions:
products.$productId.tsxproducts.index.tsx_dashboard-layout.tsxbun run generate-routes after modifying route filesUse TanStack Store for:
Use React Query for:
Example store implementation:
// lib/stores/example.ts
export const exampleStore = new Store<ExampleState>({
data: [],
isLoading: false,
})
export const exampleActions = {
updateData: (newData) => {
exampleStore.setState({ data: newData })
},
}
// Component usage
const state = useStore(exampleStore)
Follow utility-first approach with Tailwind CSS v4:
cn() helper for conditional classescomponents/ui/Example component styling:
import { cn } from '@/lib/utils'
<div className={cn(
"flex flex-col gap-4 p-4",
"border border-zinc-800 rounded-lg",
"hover:shadow-lg transition-shadow"
)}>
{children}
</div>
Read references/styling.md for comprehensive styling patterns, color schemes, and component examples.
All data flows through NDK (Nostr Dev Kit):
Fetching data:
export const fetchProducts = async (limit: number = 500) => {
const ndk = ndkActions.getNDK()
const events = await ndk.fetchEvents({
kinds: [30402], // Product listing kind
limit,
})
return Array.from(events).sort((a, b) => (b.created_at || 0) - (a.created_at || 0))
}
Publishing events:
export const publishProduct = async (productData) => {
const ndk = ndkActions.getNDK()
const event = new NDKEvent(ndk)
event.kind = 30402
event.tags = [
['d', productData.id],
['title', productData.title],
['price', productData.price.toString(), 'sats'],
]
await event.publish()
return event
}
Data transformation: Use utility functions to extract data from Nostr events:
const title = getProductTitle(product)
const price = getProductPrice(product)
const images = getProductImages(product)
Read references/nostr-integration.md for complete Nostr patterns, event kinds, authentication, and NDK usage.
Plan the implementation:
Implement routes (if needed):
/src/routes/ following naming conventionsbun run generate-routes to update route treeCreate components:
Implement state management:
Integrate with Nostr:
Test the implementation:
bun run dev)Locate relevant files:
/src/routes//src/components//src/lib/stores//src/queries/Understand existing patterns:
Make changes:
Verify integration:
/src/routes/ (e.g., newpage.tsx)createFileRoutebun run generate-routes/src/queries/queryOptions()useSuspenseQuery() or useQuery() in components/src/lib/stores/useStore() hook in componentsFor detailed information, read the reference files:
references/architecture.md - Project structure, architectural patterns, data flowreferences/libraries.md - Complete list of libraries, versions, and usage notesreferences/patterns.md - React patterns, hooks, routing, state management, and Nostr integration patternsreferences/styling.md - Tailwind CSS usage, component styling, responsive design, themingreferences/nostr-integration.md - NDK usage, event kinds, data fetching/publishing, authenticationRun these commands during development:
bun run dev # Start development server
bun run generate-routes # Generate route tree
bun run build # Build for production
bun run format # Format code with Prettier
When implementing features: