CLAUDE.md TemplatesCLAUDE.md template

Angular Material + FastAPI + LlamaIndex CLAUDE.md Template for Claude Code (CLAUDE.md template)

CLAUDE.md template for Angular Material + FastAPI + LlamaIndex; a copyable Claude Code blueprint to scaffold a full stack app.

CLAUDE.md templateAngular MaterialFastAPILlamaIndexClaude Codesemantic searchfrontendbackendTypeScriptPythonFull Stacktemplates

Target User

Developers building a full stack app with Angular Material on the frontend, FastAPI on the backend, and LlamaIndex for semantic search.

Use Cases

  • Scaffold a full stack Angular Material plus FastAPI app with LlamaIndex integration
  • Provide a copyable Claude Code blueprint for rapid iteration
  • Enforce architecture constraints and security practices

Markdown Template

Angular Material + FastAPI + LlamaIndex CLAUDE.md Template for Claude Code (CLAUDE.md template)

# CLAUDE.md

Project role
- You are a full stack engineer who designs and implements an Angular Material frontend, a FastAPI backend, and a LlamaIndex powered search layer. You write Claude Code that is safe, maintainable, and production ready.

Architecture rules
- Monorepo with frontend and backend at project root
- Frontend built with Angular Material components; backend REST APIs consumed by frontend
- LlamaIndex index built in backend; index data stored in a local directory for dev and in object storage for prod
- Claude Code communicates over HTTPS; secrets not hardcoded

File structure rules
- Frontend: /frontend
  - src/app
  - src/environments
  - angular.json
  - tsconfig.json
  - package.json
- Backend: /backend
  - app/main.py
  - app/api/
  - app/models.py
  - requirements.txt
- LlamaIndex-specific
  - llama_index_config.json
  - data/llama_index/initial_data/

Authentication rules
- Use OAuth2 password flow with JWTs; access token short lived; refresh token stored in httpOnly cookie
- Backend validates tokens on protected endpoints

Database rules
- Development uses SQLite; production uses Postgres
- SQLAlchemy models to map to tables; Alembic migrations

Validation rules
- Pydantic models for request and response
- Input data sanitized; all endpoints reject invalid payloads with clear errors

Security rules
- HTTPS enforced; CORS configured for frontend domain
- CSRF protection for web UI; no secret exposure in code

Testing rules
- Unit tests for frontend components (Angular TestBed) and backend endpoints (pytest)
- Tests cover authentication, data validation, and search indexing

Deployment rules
- Dockerized monorepo with Dockerfile for frontend and backend
- docker-compose.yaml orchestrates frontend, backend, and a Postgres service
- CI runs tests and builds both services

Things Claude must not do
- Do not generate code that accesses local secrets or secrets in environment
- Do not create endpoints that allow arbitrary code execution
- Do not bypass authentication or ignore input validation
- Do not rely on deprecated libraries

Overview

CLAUDE.md template is a copyable Claude Code blueprint for rapidly wiring up an Angular Material frontend with a FastAPI backend and a LlamaIndex powered semantic search layer. This page delivers a stack specific CLAUDE.md template for Angular Material + FastAPI + LlamaIndex and provides a ready to paste instruction block for Claude Code.

When to Use This CLAUDE.md Template

  • You are building a production grade Angular Material UI paired with a FastAPI API backend
  • You plan to add semantic search over data with LlamaIndex
  • You want a repeatable Claude Code workflow to accelerate prototyping and onboarding

Copyable CLAUDE.md Template

# CLAUDE.md

Project role
- You are a full stack engineer who designs and implements an Angular Material frontend, a FastAPI backend, and a LlamaIndex powered search layer. You write Claude Code that is safe, maintainable, and production ready.

Architecture rules
- Monorepo with frontend and backend at project root
- Frontend built with Angular Material components; backend REST APIs consumed by frontend
- LlamaIndex index built in backend; index data stored in a local directory for dev and in object storage for prod
- Claude Code communicates over HTTPS; secrets not hardcoded

File structure rules
- Frontend: /frontend
  - src/app
  - src/environments
  - angular.json
  - tsconfig.json
  - package.json
- Backend: /backend
  - app/main.py
  - app/api/
  - app/models.py
  - requirements.txt
- LlamaIndex-specific
  - llama_index_config.json
  - data/llama_index/initial_data/

Authentication rules
- Use OAuth2 password flow with JWTs; access token short lived; refresh token stored in httpOnly cookie
- Backend validates tokens on protected endpoints

Database rules
- Development uses SQLite; production uses Postgres
- SQLAlchemy models to map to tables; Alembic migrations

Validation rules
- Pydantic models for request and response
- Input data sanitized; all endpoints reject invalid payloads with clear errors

Security rules
- HTTPS enforced; CORS configured for frontend domain
- CSRF protection for web UI; no secret exposure in code

Testing rules
- Unit tests for frontend components (Angular TestBed) and backend endpoints (pytest)
- Tests cover authentication, data validation, and search indexing

Deployment rules
- Dockerized monorepo with Dockerfile for frontend and backend
- docker-compose.yaml orchestrates frontend, backend, and a Postgres service
- CI runs tests and builds both services

Things Claude must not do
- Do not generate code that accesses local secrets or secrets in environment
- Do not create endpoints that allow arbitrary code execution
- Do not bypass authentication or ignore input validation
- Do not rely on deprecated libraries

Recommended Project Structure

angular-material-fastapi-llamaindex/
├── frontend/
│   ├── src/
│   │   ├── app/
│   │   │   ├── components/
│   │   │   └── pages/
│   │   └── index.html
│   ├── angular.json
│   └── package.json
├── backend/
│   ├── app/
│   │   ├── main.py
│   │   ├── api/
│   │   └── models.py
│   ├── requirements.txt
│   └── Dockerfile
├── llama_index_config.json
└── docker-compose.yaml

Core Engineering Principles

  • Maintainable and well typed code with clear boundaries between frontend and backend
  • Security by default with proper authentication and input validation
  • Testability across unit and integration tests
  • Performance conscious architecture for API latency and UI responsiveness

Code Construction Rules

  • Frontend uses Angular Material; components must be accessible; use reactive forms
  • Backend uses FastAPI; endpoints return strict Pydantic models
  • Use LlamaIndex for semantic search; index built in backend on startup
  • Claude Code should not access user secrets; pass them via environment or config

Security and Production Rules

  • Enforce HTTPS; configure HSTS
  • Use secure cookies for tokens; CSRF protection for UI
  • Audit logging and error handling; avoid leaking stack traces in prod

Testing Checklist

  • Frontend unit tests for components and services
  • Backend tests for API endpoints and data validation
  • End to end flow tests verify search results from UI to LlamaIndex

Common Mistakes to Avoid

  • Skipping input validation or using permissive schemas
  • Hardcoding secrets in code or config
  • Overloading frontend with non accessible components

FAQ

  1. Q1 Is this CLAUDE.md template suitable for production? A1 Yes with proper environment configuration secrets management and CI/CD
  2. Q2 Do I need a dedicated LlamaIndex instance? A2 Not necessarily you can run a local index and scale as needed
  3. Q3 Can I customize the stack? A3 Yes adapt frontend components backend endpoints and index configuration as needed
  4. Q4 How do I test semantic search? A4 Use unit tests for the index wrapper and integration tests for UI search results
  5. Q5 Where do I store runtime config? A5 Use environment variables or a config service never hardcode values
  6. Q6 How do I deploy? A6 Use Docker Compose in dev and Kubernetes or ECS in prod ensure TLS termination