Skip to content
Agentmart
Submit a tool

backend-context

Backend architecture, patterns and conventions for the Express.js 5 API.

Skill by davidleonmayor

IndexedApache-2.0★ 3
Write a review

Chalk Labs

Need help deploying backend-context?

Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.

Book a call

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/davidleonmayor-backend-context

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Backend architecture, patterns and conventions for the Express.js 5 API. Trigger: When working on backend code, API routes, controllers, or database.

Use cases: backend

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/backend-context

What's inside

Skill name
backend-context
Description
Backend architecture, patterns and conventions for the Express.js 5 API. Trigger: When working on backend code, API routes, controllers, or database.
License
Apache-2.0
Metadata
author: davidleonmayor · version: 1.0
Instructions
261 lines in SKILL.md · view on GitHub

Files (2)

  • SKILL.md
  • auth-context.md · references/

SKILL.md (first lines)

## Stack

| Technology | Version | Purpose |
|------------|---------|---------|
| Express.js | 5 | HTTP framework |
| TypeScript | 5 | Language |
| Prisma | 6 | ORM |
| MySQL | - | Database |
| Zod | 4 | Env validation |
| express-validator | 7 | Request validation |
| JWT (jsonwebtoken) | 9 | Authentication |
| Winston | 3 | Logging |
| Morgan | 1 | HTTP request logging |
| Multer | 2 | File uploads |
| Brevo | 3 | Transactional emails |
| Nodemailer | 7 | Email (fallback) |
| Jest + ts-jest | - | Testing |
| Supertest | 7 | HTTP testing |

**File Naming Example:**
- ✅ `sendAuthEmail.test.ts` (all tests with .test extencion)
- ✅ `createToken.ts` (common files use camel case)
- ✅ `auth.controller.ts` | `auth.route.ts` `auth.schema.ts` `auth.service.ts` (for each repositori spesification)
- ✅ `AuthMiddleware.ts` (Uper camel case for classes)
- ❌ `create-token.ts` (WRONG - do no separate be -)
- ❌ `sign-up-validation.spec.ts` | `sing-up-validation.ts`(WRONG )

## Scope Detection (ASK IF AMBIGUOUS)

| User Says | Action |
|-----------|--------|
| "a test", "one test", "new test", "add test" | Create ONE test() in existing spec |
| "comprehensive tests", "all tests", "test suite", "generate tests" | Create full suite |
| "create route", "create router" | Trigger `backend-router` skill and add it |
| "create schema", "add validation" | Trigger `backend-schema` skill and add it |

**Examples:**
- "Create a test for user sign-up" → ONE test only
- "Generate E2E tests for login page" → Full suite
- "Add a test to verify form validation" → ONE test to existing spec
- "create POST /login route” → ONE route 


## Directory Structure

```
backend/
├── prisma/                   # Database schema, migrations, seeds
│   ├── schema.prisma         # MySQL schema definition
│   ├── migrations/           # Prisma migration history
│   ├── seed.ts               # Database seeder
│   └── clear.ts              # Database cleanup script
├── src/
│   ├── index.ts              # Entry point — instantiates Server
│   ├── server.ts             # Server class (middlewares, routes, shutdown)
│   ├── config/               # App configuration (envs, prisma, logger, cors, email clients)
│   ├── routes/               # Route class definitions — mounted under /api/
│   ├── controllers/          # Request handlers for each domain
│   ├── auth/                 # Self-contained auth module (routes, controller, service, schema, tests)
│   ├── common/               # Shared code
│   │   ├── middleware/       # Auth, Role, validation, error handling, timeout
│   │   ├── schema/           # Global validation schemas
│   │   └── utils/            # Helpers (asyncHandler, createToken)
│   ├── email/                # Email templates (Brevo / Nodemailer)
│   ├── example/              # Reference module for new features
│   └── __test__/             # Integration / unit tests
├── logs/                     # Winston log output (gitignored)
├── docs/                     # Additional documentation
└── jest.config.js            # Jest + ts-jest config
```

## Architecture

The backend uses two architectural patterns:

**Repository pattern** — Self-contained modules under `src/` with own routes, controller, service, schema, and tests. Each repository owns its full vertical slice.

| Repository | Path | Description |
|------------|------|-------------|
| `auth` | `src/auth/` | Authentication, JWT, password flows — [details](references/auth-context.md) |

**Layered pattern** — Domains that share `src/routes/`, `src/controllers/` and `src/common/`. Currently used by the remaining modules while migrating to repository pattern.

| Domain | Routes | Controller |
|--------|--------|------------|
| projects | `src/routes/project.routes.ts` | `src/controllers/project.controller.ts` |
| events | `src/routes/event.routes.ts` | `src/controllers/event.controller.ts` |
| persons | `src/routes/person.routes.ts` | `src/controllers/person.controller.ts` |

**Request flow:**

```
Request → Middleware Chain → Route Class → Controller → Service → Prisma → MySQL
                                              ↓
                                         schema (express-validator)
```

**Layered responsibilities:**

| Layer | Responsibility | Location |
|-------|---------------|----------|
| Server | Bootstrap, middleware chain, graceful shutdown | `src/server.ts` |
| Routes | HTTP method + path + middleware stack per endpoint | `src/routes/`, `src/auth/auth.routes.ts` |
| Controller | Parse request, call service/prisma, format response | `src/controllers/`, `src/auth/auth.controller.ts` |
| Service | Business logic, reusable operations | `src/auth/auth.service.ts` |
| Schema | Request validation rules (express-validator) | `src/auth/auth.schema.ts`, `src/common/schema/` |
| Middleware | Cross-cutting: auth, roles, timeout, errors, logging | `src/common/middleware/` |
| Config | Singletons and env-validated settings | `src/config/` |

**Request lifecycle:**

1. `requestTimeout(30s)` wraps the request
2. Body parsers (`json`, `urlencoded`) with 10mb limit
3. CORS via `corsConfig`
4. Morgan HTTP logging
5. `Routes.init(app)` matches the endpoint
6. Route-level middleware chain (e.g. `authLimiter` → `validateSchema` → `authMiddleware` → controller)
7. Controller handles logic, returns response
8. Unmatched routes → `notFound` (404)

From davidleonmayor/proyecto-grado-unimayor, Apache-2.0.

Signals

Stars
3
Forks
0
Open issues
1
Last commit (this folder)
May 2, 2026 (6 months ago)

From GitHub (fetched Oct 24, 2026).

Details

Version
1.0
License
Apache-2.0
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from davidleonmayor

Done for you

Rather not set it up yourself?

Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.

See how we build AI agents →Read the case studies

Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.

launches shipped
50+
launches shipped
media placements
500+
media placements
founders on every account
2
founders on every account

Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block

Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.

Get backend-context running in your business

Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.

Goes to the Chalk Labs founders, not the newsletter. Privacy

Need help deploying backend-context?

CallGet help
Cite this page

backend-context skill. Agent Mart. https://agentmart.dev/skills/davidleonmayor-backend-context (last updated 2026-10-24)