CLAUDE.md TemplatesCLAUDE.md Template
CLAUDE.md Template: Nuxt 4 + SingleStore DB + Clerk Auth + Drizzle ORM
Copyable CLAUDE.md template page for Nuxt 4 with SingleStore DB, Clerk Auth, and Drizzle ORM to scaffold a production-ready stack.
CLAUDE.md TemplateNuxt 4SingleStore DBClerk AuthDrizzle ORMClaude CodeNuxt 4 + Clerk + DrizzleSingleStore Nuxt templateclaude-md-template
Target User
Developers building Nuxt 4 apps with SingleStore DB, Clerk authentication, and Drizzle ORM.
Use Cases
- Starter CLAUDE.md template for Nuxt 4 with SingleStore, Clerk, and Drizzle
- Guidance for integrating SingleStore with Drizzle ORM and Clerk in Nuxt 4
- Security, testing, and deployment rules for production Nuxt apps
Markdown Template
CLAUDE.md Template: Nuxt 4 + SingleStore DB + Clerk Auth + Drizzle ORM
# CLAUDE.md
- Project role: You are Claude, a software engineer assistant that writes a starter CLAUDE.md template for a Nuxt 4 app with SingleStore DB, Clerk Auth, and Drizzle ORM.
- Architecture rules: Use a clean layered architecture with a dedicated data layer (Drizzle + SingleStore), a dedicated auth layer (Clerk), and a Nuxt 4 presentation layer. Keep server routes pure and stateless where possible. All secrets must come from environment variables.
- File structure rules: Follow the project structure described in the template. Do not add unrelated folders.
- Authentication rules: Integrate Clerk WebAuthn / Email magic links. Protect sensitive endpoints with Clerk middleware. Do not expose Clerk secret keys to the client.
- Database rules: Use Drizzle ORM for SQL schema targeting SingleStore dialect. Centralize DB config in env; provide migrations under drizzle/migrations.
- Validation rules: Validate inputs in server routes and forms; use zod schemas for runtime validation; reject invalid data at the boundary.
- Security rules: Enable CSRF protection, secure cookies, and Content Security Policy; disable inline scripts; rotate keys; never log secrets.
- Testing rules: Include unit tests for data access (Drizzle), integration tests for API routes (Clerk protected), and end-to-end tests for sign-in flows.
- Deployment rules: Configure environment-specific variables; ensure CI runs both unit and integration tests; enable serverless-friendly deployment in Nitro where supported.
- Things Claude must not do: Do not bypass auth checks, do not generate client secrets in code, do not access the database from client-side code, do not use deprecated Clerk APIs.Overview
A CLAUDE.md template is a copyable Claude Code instruction block that helps you scaffold a Nuxt 4 application integrated with SingleStore DB, Clerk authentication, and Drizzle ORM. This page is a copyable CLAUDE.md template page designed for the Nuxt 4 + SingleStore + Clerk + Drizzle stack.
Direct answer: Paste the CLAUDE.md block below into a CLAUDE.md file to generate a starter project configuration that follows the stack constraints and deployment guidelines.
When to Use This CLAUDE.md Template
- Starting a Nuxt 4 project with a fully wired SingleStore DB backend and Clerk authentication.
- Creating a strongly typed Drizzle ORM schema for the SingleStore dialect.
- Generating a production-ready configuration that includes security, testing, and deployment rules.
- Onboarding new engineers with a reproducible boilerplate for this stack.
Copyable CLAUDE.md Template
# CLAUDE.md
- Project role: You are Claude, a software engineer assistant that writes a starter CLAUDE.md template for a Nuxt 4 app with SingleStore DB, Clerk Auth, and Drizzle ORM.
- Architecture rules: Use a clean layered architecture with a dedicated data layer (Drizzle + SingleStore), a dedicated auth layer (Clerk), and a Nuxt 4 presentation layer. Keep server routes pure and stateless where possible. All secrets must come from environment variables.
- File structure rules: Follow the project structure described in the template. Do not add unrelated folders.
- Authentication rules: Integrate Clerk WebAuthn / Email magic links. Protect sensitive endpoints with Clerk middleware. Do not expose Clerk secret keys to the client.
- Database rules: Use Drizzle ORM for SQL schema targeting SingleStore dialect. Centralize DB config in env; provide migrations under drizzle/migrations.
- Validation rules: Validate inputs in server routes and forms; use zod schemas for runtime validation; reject invalid data at the boundary.
- Security rules: Enable CSRF protection, secure cookies, and Content Security Policy; disable inline scripts; rotate keys; never log secrets.
- Testing rules: Include unit tests for data access (Drizzle), integration tests for API routes (Clerk protected), and end-to-end tests for sign-in flows.
- Deployment rules: Configure environment-specific variables; ensure CI runs both unit and integration tests; enable serverless-friendly deployment in Nitro where supported.
- Things Claude must not do: Do not bypass auth checks, do not generate client secrets in code, do not access the database from client-side code, do not use deprecated Clerk APIs.
Recommended Project Structure
nuxt-app/
app/
components/
layouts/
pages/
composables/
plugins/
server/
api/
db/
drizzle/
migrations/
drizzle/
libs/
types/
Core Engineering Principles
- Explicit dependencies and isolation between the Nuxt frontend, Clerk auth, and Drizzle ORM data layer.
- Type-safe data access with Drizzle and TS across server and client boundaries.
- Declarative configuration with environment-driven behavior for all deployments.
- Defensive programming: validate, sanitize, and verify all inputs before persistence.
- Observability: structured logging, tracing, and metrics for production readiness.
Code Construction Rules
- Use Nuxt 4 + TypeScript across all files; avoid any dynamic evals in runtime code.
- Centralize DB connections in a single file (e.g., db/connection.ts) and reuse via DI.
- Prefer Drizzle ORM for type-safe queries; map models to SingleStore dialect.
- Use Clerk’s Nuxt module for authentication; protect pages with middleware.
- Environment variables must be loaded securely; never hardcode secrets.
Security and Production Rules
- Enable CSRF protection on state-changing endpoints.
- Use secure, httpOnly cookies for sessions; set SameSite appropriately.
- Validate JWTs and Clerk sessions on the server; do not trust client state alone.
- Regularly rotate keys and secret material; monitor for unauthorized access attempts.
- Limit data exposure on API responses; implement proper authorization checks for all endpoints.
Testing Checklist
- Unit tests for Drizzle models and utilities.
- Integration tests for database interactions with SingleStore and Drizzle.
- Authentication flow tests using Clerk mocks or test keys.
- End-to-end tests for sign-in, route protection, and data operations.
- CI: run unit, integration, and end-to-end tests on PRs.
Common Mistakes to Avoid
- Exposing Clerk secret keys in client code or public repos.
- Bypassing server-side authentication checks.
- Using non-typed SQL results without validation.
- Mixing client-side DB access with server-side logic.
- Neglecting migrations and drift between Drizzle models and SingleStore schema.
FAQ
- Q: What is included in this CLAUDE.md Template for Nuxt 4 + SingleStore + Clerk + Drizzle?
- A: A copyable Claude Code block that scaffolds authentication, data access, and Nuxt app wiring for this stack.
- Q: Which environments are supported by this template?
- A: Local development, staging, and production with environment-specific variables.
- Q: How do I extend the Drizzle models for additional entities?
- A: Add new Drizzle schema in drizzle/schema.ts and run migrations; update type-safe queries accordingly.
- Q: How to ensure secure authentication in Nuxt 4?
- A: Use Clerk's middleware, SSR-safe auth checks, and secure cookies; never rely on client-only checks.