<h1 align="center">
<a href="https://prompts.chat">
> Guidelines for AI coding agents working on this project.
Loading actions...
<a href="https://prompts.chat">
TypeScript and ESLint rules that MUST be followed when creating, modifying, or reviewing any file under apps/frontend/, including .ts, .tsx, .js, and .jsx files. Also apply when discussing frontend linting, type safety, or ESLint configuration.
risks
Guidelines for AI coding agents working on this project.
prompts.chat is a social platform for AI prompts built with Next.js 16. It allows users to share, discover, and collect prompts from the community. The project is open source and can be self-hosted with customizable branding, themes, and authentication.
src/components/ui/)/
├── prisma/ # Database schema and migrations
│ ├── schema.prisma # Prisma schema definition
│ ├── migrations/ # Database migrations
│ └── seed.ts # Database seeding script
├── public/ # Static assets (logos, favicon)
├── messages/ # i18n translation files (en.json, es.json, etc.)
├── src/
│ ├── app/ # Next.js App Router pages
│ │ ├── (auth)/ # Auth pages (login, register)
│ │ ├── [username]/ # User profile pages
│ │ ├── admin/ # Admin dashboard
│ │ ├── api/ # API routes
│ │ ├── categories/ # Category pages
│ │ ├── prompts/ # Prompt CRUD pages
│ │ ├── feed/ # User feed
│ │ ├── discover/ # Discovery page
│ │ ├── settings/ # User settings
│ │ └── tags/ # Tag pages
│ ├── components/ # React components
│ │ ├── admin/ # Admin-specific components
│ │ ├── auth/ # Authentication components
│ │ ├── categories/ # Category components
│ │ ├── layout/ # Layout components (header, etc.)
│ │ ├── prompts/ # Prompt-related components
│ │ ├── providers/ # React context providers
│ │ ├── settings/ # Settings components
│ │ └── ui/ # shadcn/ui base components
│ ├── lib/ # Utility libraries
│ │ ├── ai/ # AI/OpenAI integration
│ │ ├── auth/ # NextAuth configuration
│ │ ├── config/ # Config type definitions
│ │ ├── i18n/ # Internationalization setup
│ │ ├── plugins/ # Plugin system (auth, storage)
│ │ ├── db.ts # Prisma client instance
│ │ └── utils.ts # Utility functions (cn)
│ └── i18n/ # i18n request handler
├── prompts.config.ts # Main application configuration
├── prompts.csv # Community prompts data source
└── package.json # Dependencies and scripts
# Development
npm run dev # Start development server (localhost:3000)
npm run build # Build for production (runs prisma generate first)
npm run start # Start production server
npm run lint # Run ESLint
# Database
npm run db:generate # Generate Prisma client
npm run db:migrate # Run database migrations
npm run db:push # Push schema changes to database
npm run db:studio # Open Prisma Studio
npm run db:seed # Seed database with initial data
# Type checking
npx tsc --noEmit # Check TypeScript types without emitting
# Translations
node scripts/check-translations.js # Check for missing translations across locales
anyinterface for object shapes, type for unions/intersectionscamelCase (e.g., getUserData, handleSubmit)PascalCase (e.g., PromptCard, AuthContent)UPPER_SNAKE_CASE for true constantskebab-case.tsx for components, camelCase.ts for utilities"use client" directive only when client interactivity is needednext-intl for all user-facing strings (never hardcode text)useTranslations() or getTranslations()// Client component example
"use client";
import { useTranslations } from "next-intl";
import { Button } from "@/components/ui/button";
interface MyComponentProps {
title: string;
onAction: () => void;
}
export function MyComponent({ title, onAction }: MyComponentProps) {
const t = useTranslations("namespace");
return (
<div className="space-y-4">
<h2 className="text-lg font-semibold">{title}</h2>
<Button onClick={onAction}>{t("actionLabel")}</Button>
</div>
);
}
sm:, md:, lg: breakpoints)cn() utility from @/lib/utils for conditional classes@/lib/dbselect or include for relationsThe main configuration file is prompts.config.ts:
Authentication and storage use a plugin architecture:
src/lib/plugins/auth/)credentials.ts - Email/password authenticationgithub.ts - GitHub OAuthgoogle.ts - Google OAuthazure.ts - Microsoft Entra IDsrc/lib/plugins/storage/)url.ts - URL-based media (default)s3.ts - AWS S3 storagemessages/{locale}.jsonprompts.config.ts i18n.locales arraymessages/src/components/layout/header.tsx| File | Purpose |
|---|---|
prompts.config.ts | Main app configuration |
prisma/schema.prisma | Database schema |
src/lib/auth/index.ts | NextAuth configuration |
src/lib/db.ts | Prisma client singleton |
src/app/layout.tsx | Root layout with providers |
src/components/ui/ | Base UI components (shadcn) |
npm run lint before committingsrc/components/ui/prompts.config.ts structure.env)node_modules/ or generated filesRequired in .env:
DATABASE_URL= # PostgreSQL connection string
AUTH_SECRET= # NextAuth secret key
Optional OAuth (if using those providers):
AUTH_GITHUB_ID=
AUTH_GITHUB_SECRET=
AUTH_GOOGLE_ID=
AUTH_GOOGLE_SECRET=
AUTH_AZURE_AD_CLIENT_ID=
AUTH_AZURE_AD_CLIENT_SECRET=
AUTH_AZURE_AD_ISSUER=
Optional features:
OPENAI_API_KEY= # For AI-powered semantic search
Currently no automated tests. When implementing:
__tests__/ directoriessrc/app/{route}/page.tsxmessages/*.jsonsrc/components/{category}/ foldersrc/app/api/{route}/route.tsprisma/schema.prismanpm run db:migrate to create migration