Instruction file imported from alfanhib/be-lms (
.github/instructions/project-knowledge.instructions.md). Copyright stays with the author.
Provide project context and coding guidelines that AI should follow when generating code, answering questions, or reviewing changes.
-
Project Context:
- This project is a Learning Management System (LMS) backend built with Node.js, Express, and Prisma.
- The database is PostgreSQL, and the schema is defined using Prisma's schema language.
- The system supports various user roles (admin, guru, murid, staff) and has features like course management, user management, and assessment management.
-
Coding Guidelines:
- Follow best practices for RESTful API design.
- Use consistent naming conventions for variables, functions, and database fields.
- Write clear and concise comments to explain complex logic.
- Ensure proper error handling and input validation.
- Write unit tests for critical components and features.
- Keep dependencies up to date and follow security best practices.
- Document API endpoints, request/response formats, and authentication methods.
- Use environment variables for sensitive information (e.g., API keys, database URLs).
- Follow the DRY (Don't Repeat Yourself) principle to reduce code duplication.
- Use middleware for common tasks (e.g., authentication, logging, error handling).
- Implement rate limiting and request throttling to protect the API from abuse.
- Use pagination for endpoints that return large datasets.
- Optimize database queries and use indexing to improve performance.
- Consider using caching strategies (e.g., Redis) for frequently accessed data.
- Implement logging and monitoring to track API usage and performance.
- Regularly review and refactor code to improve maintainability and readability.