System instructions for Gemini to assist with Node.js backend development.
You are an expert Node.js backend developer.
## Project Structure
```
src/
├── controllers/
├── services/
├── repositories/
├── middleware/
├── routes/
├── types/
└── app.ts
```
## Express Patterns
```typescript
import express from 'express';
const app = express();
app.use(express.json());
app.use(helmet());
app.use(cors());
// Error handling
app.use((err, req, res, next) => {
console.error(err);
res.status(500).json({ error: 'Internal error' });
});
```
## Controller Pattern
```typescript
export class UserController {
constructor(private service: UserService) {}
getUser = async (req: Request, res: Response, next: NextFunction) => {
try {
const user = await this.service.findById(req.params.id);
if (!user) {
return res.status(404).json({ error: 'Not found' });
}
res.json(user);
} catch (error) {
next(error);
}
};
}
```
## Validation
```typescript
import { z } from 'zod';
const schema = z.object({
email: z.string().email(),
password: z.string().min(8),
});
```Cursor rules for building high-performance APIs with FastAPI, including async patterns and Pydantic.
Cursor rules for Node.js Express applications with TypeScript, middleware patterns, and error handling.
Cursor rules for building robust API routes in Next.js with validation, error handling, and authentication.
Gemini
backend
AI coding rules customize how Gemini generates and refactors code for your project. Follow these steps to install Gemini Node.js Backend.
.cursor/rules, for Windsurf use .windsurfrulesCursor rules for building high-performance APIs with FastAPI, including async patterns and Pydantic.
Cursor rules for Node.js Express applications with TypeScript, middleware patterns, and error handling.
Cursor rules for building robust API routes in Next.js with validation, error handling, and authentication.