issues-layered-architecture

issues-layered-architecture is a cursor rule for Cursor from vepo/issues. It costs 532 tokens per session, scanned A, original, Apache-2.0.

A set of project rules for organizing backend code into endpoints, services, and repositories. An endpoint handles HTTP requests, a service contains business decisions, and a repository handles database access.

In plain words
What is it for?
Use it when adding or reviewing backend features to keep endpoints focused on requests, services focused on application logic, and repositories focused on persistence, security annotations, and API documentation.
Why use it?
It prevents HTTP code, business rules, and database queries from becoming mixed together. The one-way dependency structure makes responsibilities easier to locate and maintain.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/vepo/issues/issues-layered-architecture
Clone the repo
git clone --depth 1 https://github.com/vepo/issues

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for issues-layered-architecture

README.md
[![agentmods](https://agentmods.dev/badge/rules/vepo/issues/issues-layered-architecture.svg)](https://agentmods.dev/rules/vepo/issues/issues-layered-architecture)
Your own site
<a href="https://agentmods.dev/rules/vepo/issues/issues-layered-architecture"><img src="https://agentmods.dev/badge/rules/vepo/issues/issues-layered-architecture.svg" alt="Measured on agentmods" height="20"></a>
Per session 532 This file is loaded in full into every session.
When invoked 532 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00532 $0.00532
Opus 5 $0.00266 $0.00266
Sonnet 5 $0.00106 $0.00106
Haiku 4.5 $0.00053 $0.00053

Measured 4d ago against content hash b0907c2f9dcc, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

issues-layered-architecture scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/issues-layered-architecture.mdc · 61 lines

How it starts

The opening of the file, as written. The whole thing — 61 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Layered architecture

Follow ARCHITECTURE.md §6. Dependencies flow downward only:

*Endpoint  →  *Service (when needed)  →  *Repository  →  database

*Endpoint — HTTP boundary

  • One HTTP operation per class in {context}.{action} subpackage (e.g. ticket.create.CreateTicketEndpoint).
  • @ApplicationScoped + @Path; class-level @DenyAll, method-level @RolesAllowed.
  • @Operation(operationId = "...") + @Tag(name = "...") for OpenAPI codegen.
  • Map path/query/body to domain calls; return *Response records.
  • Must inject *Service — no business logic, no @Transactional in endpoints.

*Service — business logic

  • @ApplicationScoped; name XxxService.
  • Orchestrate repositories, apply domain rules, fire events.
  • Inject *Repository; never EntityManager directly.
  • Never depend on *Endpoint or JAX-RS types.

*Repository — persistence

  • One per entity; @ApplicationScoped; name XxxRepository.
  • EntityManager only here; queries and persistence only — no business rules or HTTP concerns.
  • Never inject *Service or *Endpoint.

When adding a feature

Complete development-process.mdc phases 1–4 before coding. Phase 5 (TDD), in order:

  1. Entity (if new table) + Flyway baseline change per issues-flyway.mdc.
  2. XxxRepository.
  3. XxxService for non-trivial logic.
  4. One *Endpoint class per HTTP operation under {context}.{action}/.
  5. Angular facade + component if user-facing; run npm run generate:api after API changes.

Violations — refactor toward layers

// ❌ Endpoint with audit logging inline
@POST
public TicketResponse create(CreateTicketRequest request) {
    ticketRepository.persist(ticket);
    historyRepository.persist(new TicketHistory(...));
}

// ✅ Endpoint delegates to service
@POST
public TicketResponse create(CreateTicketRequest request) {
    return ticketHistoryService.createTicket(request);
}

Read the full file on GitHub · 61 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 61 lines · 532 tokens per session scan A b0907c2f9dcc

Subscribe to this mod's changes

issues-layered-architecture is a cursor rule published in the GitHub repository vepo/issues (8 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 532 tokens to every session, about $0.0027 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.