Rule set for bubjs as backend and react as front end
## Build & Development Commands
- **Start Development Server**: Use `bunx vite` to start the development server. The `--bun` flag ensures that Vite runs using Bun instead of Node.js. This command respects Vite's shebang line (`#!/usr/bin/env node`) by default.
- **Build for Production**: Run `bun build` to bundle your application for production. This command leverages Bun's native bundler, which is known for its speed and efficiency.
- **Install Dependencies**: Use `bun install` to install project dependencies. This command creates a `bun.lockb` file in the root directory, which is similar to `package-lock.json` but in a binary format.
## Testing Guidelines
- **Run Tests**: Use `bun test` to execute your test suite. Bun provides a Jest-style `expect()` API, making it easy to write and run tests. This command is designed to be fast and efficient, utilizing Bun's high-performance runtime.
- **Hot Reloading**: For rapid development, use `bun --hot run index.ts` to enable hot reloading. This allows you to see changes in real-time without restarting the server.
## Code Style & Guidelines
- **JSX Support**: Bun internally transpiles JSX syntax to vanilla JavaScript. It assumes React by default but respects custom JSX transforms defined in `tsconfig.json`.
- **TypeScript Configuration**: Ensure your `tsconfig.json` is properly configured to support TypeScript features. Bun works seamlessly with TypeScript, making it easy to integrate into your project.
- **Linting and Formatting**: Use tools like ESLint and Prettier to maintain consistent code style. These tools can be integrated into your development environment to automatically format and lint your code.
## Documentation Guidelines
- **Document JSX Components**: Bun provides special logging for JSX components to aid in debugging. Ensure that your JSX components are well-documented to make use of this feature.
- **Refer to Official Documentation**: For detailed configuration and advanced usage, refer to the official Bun and Vite documentation. This will help you understand the best practices and features available in these tools.
- **Maintain Clear Comments**: Write clear and concise comments in your code to explain complex logic and improve readability. This is especially important in a collaborative environment.
## Additional Guidelines
- **Consistent Naming Conventions**: Follow consistent naming conventions for variables, functions, and components. Use camelCase for variables and functions, and PascalCase for components.
- **Modular Code**: Break down your code into small, reusable modules. This makes your code easier to maintain and test.
- **Error Handling**: Implement robust error handling in your code. Use try-catch blocks where appropriate and provide meaningful error messages.
- **Security Best Practices**: Follow security best practices to protect your application from common vulnerabilities. This includes validating user input, using secure dependencies, and implementing authentication and authorization mechanisms.
- **Performance Optimization**: Optimize your code for performance. This includes minimizing the use of heavy computations, optimizing images and other assets, and using efficient algorithms.
- **Accessibility**: Ensure your application is accessible to all users, including those with disabilities. Follow accessibility guidelines and use tools to test the accessibility of your application.
By following these guidelines, you can ensure that your AI coding assistant provides consistent, high-quality code that is easy to maintain and understand.