mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-09 09:59:40 -06:00
- Introduce AGENTS.md for repository guidelines and project structure - Add core development principles in .cursor/rules/core-development.mdc - Establish project-specific context in .cursor/rules/project-context.mdc - Implement Cursor IDE configuration in .cursor/rules/cursor.json - Create specialized rules for controllers, services, DTOs, guards, routes, and integrations - Update .gitignore to exclude unnecessary files - Enhance CLAUDE.md with project overview and common development commands
2.3 KiB
2.3 KiB
Repository Guidelines
Project Structure & Module Organization
src/– TypeScript source. Key areas:api/controllers,api/routes,api/services,api/integrations/{channel,chatbot,event,storage},config,utils,exceptions.prisma/– Prisma schema and migrations. Provider folders:postgresql-migrations/,mysql-migrations/. UseDATABASE_PROVIDERto target the provider.dist/– Build output; do not edit.public/– Static assets.Docker*,docker-compose*.yaml– Local stack and deployment helpers.
Build, Test, and Development Commands
npm run build– Type-check (tsc) and bundle withtsuptodist/.npm run start– Run dev server viatsx src/main.ts.npm run dev:server– Watch mode for local development.npm run start:prod– Run compiled app fromdist/.npm run lint/npm run lint:check– Auto-fix and check linting.- Database (choose provider):
export DATABASE_PROVIDER=postgresql(ormysql), then:npm run db:generate– Generate Prisma client.npm run db:migrate:dev– Apply dev migrations and sync provider folder.npm run db:deploy– Apply migrations in non-dev environments.npm run db:studio– Open Prisma Studio.
- Docker:
docker-compose up -dto start local services.
Coding Style & Naming Conventions
- TypeScript, 2-space indent, single quotes, trailing commas, 120-char max (Prettier).
- Enforced by ESLint + Prettier; import order via
simple-import-sort. - File names follow
feature.kind.ts(e.g.,chat.router.ts,whatsapp.baileys.service.ts). - Classes: PascalCase; functions/variables: camelCase; constants: UPPER_SNAKE_CASE.
Testing Guidelines
- No formal suite yet. Place tests under
test/as*.test.ts. - Run
npm test(watchestest/all.test.tsif present). Prefer fast, isolated unit tests.
Commit & Pull Request Guidelines
- Conventional Commits enforced by commitlint. Use
npm run commit(Commitizen).- Examples:
feat(api): add message status,fix(route): handle 404 on send.
- Examples:
- PRs: include clear description, linked issues, migration impact (provider), local run steps, and screenshots/logs where relevant.
Security & Configuration
- Copy
.env.exampleto.env; never commit secrets. - Set
DATABASE_PROVIDERbefore DB commands; seeSECURITY.mdfor reporting vulnerabilities.