nodejs-express-server
aj-geddes/useful-ai-prompts
Build production-ready Express.js servers with routing, middleware, authentication, and database integration.
What is nodejs-express-server?
Create robust REST APIs and server applications using Express.js with proper middleware chains, authentication mechanisms, and database connections. Use this skill when building Node.js backends, implementing request/response handling, managing cross-cutting concerns, or connecting to databases.
- Set up Express.js applications with middleware and routing
- Implement authentication and authorization with JWT
- Create RESTful routes with CRUD operations
- Integrate databases like PostgreSQL with Sequelize
- Build middleware chains for cross-cutting concerns
- Handle errors and implement logging
How to install nodejs-express-server
npx skills add https://github.com/aj-geddes/useful-ai-prompts --skill nodejs-express-server- Node.js installed
- npm or yarn package manager
How to use nodejs-express-server
- 1.Install the skill using the provided npx command
- 2.Review the Quick Start example to understand basic Express setup
- 3.Choose relevant reference guides from the references/ directory based on your needs
- 4.Implement middleware chains for your cross-cutting concerns
- 5.Set up routes and CRUD operations for your API endpoints
- 6.Configure authentication (JWT) for protected routes
- 7.Integrate your database using the provided PostgreSQL/Sequelize guide
- 8.Implement error handling middleware
Use cases
- Building REST APIs with Node.js
- Implementing server-side request/response handling
- Creating authentication systems for web applications
- Connecting Node.js applications to PostgreSQL databases
- Setting up middleware for logging, validation, and error handling
- Backend developers
- Full-stack developers
- API developers
- Node.js developers
nodejs-express-server FAQ
Use this skill when building REST APIs, implementing server-side logic, creating middleware chains, managing authentication, or connecting to databases in Node.js applications.
The skill includes detailed guidance for PostgreSQL with Sequelize. You can adapt the patterns for other databases.
The skill provides a reference guide for JWT-based authentication, including token generation, validation, and protecting routes.
Implement dedicated error handling middleware that catches errors, logs them appropriately, and returns consistent error responses without exposing stack traces in production.
Use async/await for async operations instead of callbacks to avoid callback hell and improve code readability.
Full instructions (SKILL.md)
Source of truth, from aj-geddes/useful-ai-prompts.
name: nodejs-express-server description: > Build production-ready Express.js servers with middleware, authentication, routing, and database integration. Use when creating REST APIs, managing requests/responses, implementing middleware chains, and handling server logic.
Node.js Express Server
Table of Contents
Overview
Create robust Express.js applications with proper routing, middleware chains, authentication mechanisms, and database integration following industry best practices.
When to Use
- Building REST APIs with Node.js
- Implementing server-side request handling
- Creating middleware chains for cross-cutting concerns
- Managing authentication and authorization
- Connecting to databases from Node.js
- Implementing error handling and logging
Quick Start
Minimal working example:
const express = require("express");
const app = express();
const PORT = process.env.PORT || 3000;
// Middleware
app.use(express.json());
app.use(express.urlencoded({ extended: true }));
// Routes
app.get("/health", (req, res) => {
res.json({ status: "OK", timestamp: new Date().toISOString() });
});
// Error handling
app.use((err, req, res, next) => {
console.error(err.stack);
res.status(err.status || 500).json({
error: err.message,
requestId: req.id,
});
});
app.listen(PORT, () => {
console.log(`Server running on port ${PORT}`);
});
Reference Guides
Detailed implementations in the references/ directory:
| Guide | Contents |
|---|---|
| Basic Express Setup | Basic Express Setup |
| Middleware Chain Implementation | Middleware Chain Implementation |
| Database Integration (PostgreSQL with Sequelize) | Database Integration (PostgreSQL with Sequelize) |
| Authentication with JWT | Authentication with JWT |
| RESTful Routes with CRUD Operations | RESTful Routes with CRUD Operations |
| Error Handling Middleware | Error Handling Middleware |
| Environment Configuration | Environment Configuration |
Best Practices
✅ DO
- Use middleware for cross-cutting concerns
- Implement proper error handling
- Validate input data before processing
- Use async/await for async operations
- Implement authentication on protected routes
- Use environment variables for configuration
- Add logging and monitoring
- Use HTTPS in production
- Implement rate limiting
- Keep route handlers focused and small
❌ DON'T
- Handle errors silently
- Store sensitive data in code
- Use synchronous operations in routes
- Forget to validate user input
- Implement authentication in route handlers
- Use callback hell (use promises/async-await)
- Expose stack traces in production
- Trust client-side validation only
Related skills
More from aj-geddes/useful-ai-prompts and the wider catalog.

penetration-testing
>

responsive-web-design
>

rest-api-design
Design RESTful APIs following best practices for resource modeling, HTTP methods, status codes, and versioning.

technical-specification
>

user-guide-creation
>

user-story-writing
>