AiderJavaScriptAPI Design
REST API Design Rules — Aider (Javascript)
REST API Design best practices for Aider with Javascript. Enforced coding rules for AI assistants.
CONVENTIONS.md
# REST API Design Rules — Aider (Javascript)
# REST API Design Rules
When generating API endpoints, follow these conventions:
## URL Design
- Plural nouns for resources: `/users`, `/posts`, `/orders`
- Hierarchical: `/users/{id}/orders/{orderId}`
- Lowercase, kebab-case: `/blog-posts` not `/blogPosts`
- Versions in URL: `/api/v1/users`
- Actions as POST endpoints: `/users/{id}/activate`
## HTTP Methods
- GET: read (idempotent, cacheable)
- POST: create or action
- PUT: full replace
- PATCH: partial update
- DELETE: remove
## Status Codes
- 200 OK, 201 Created, 204 No Content
- 400 Bad Request (validation), 401 Unauthorized, 403 Forbidden, 404 Not Found
- 409 Conflict, 422 Unprocessable Entity
- 429 Too Many Requests, 500 Internal Server Error
## Request/Response
- JSON everywhere — consistent Content-Type: application/json
- camelCase field names in JSON
- Consistent error format: `{ error: { code, message, details } }`
- Pagination: `{ data: [], meta: { total, page, perPage, lastPage } }`
## Security
- Authenticate every non-public endpoint
- Rate limiting on all endpoints
- Request size limits
- Never return passwords or secrets in responsesHow to use with Aider
Create a `CONVENTIONS.md` file in your project root. Aider reads this and respects your conventions when generating changes.
#aider#javascript#api-design#ai-coding-rules
Related Rules
Python Aider Conventions
AiderPython
Aider AI coding conventions for Python: CONVENTIONS.md patterns for automated refactoring and clean Python code.
Code Style
python · aiderCopy Ready
Next.js Aider Conventions
AiderNext.js
Aider conventions for Next.js: file naming, route organization, and App Router conventions.
Architecture
nextjs · aiderCopy Ready
SQL Aider Conventions
AiderSQL
Aider conventions for SQL and database migrations: naming, formatting, and migration patterns.
Database
sql · aiderCopy Ready
Security Aider Conventions
Aidersecurity
Aider conventions for security: secure coding patterns, vulnerability prevention, and security review checklist.
Security
security · aiderCopy Ready