vue-ssr-server

Implement Express 5 API routes with MongoDB access and validation.

3|Updated Jan 14, 2023
One-click install
npx skills add https://github.com/e-xode/vue-ssr --skill vue-ssr-server
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vue-ssr-server
Source: https://github.com/e-xode/vue-ssr/tree/main/.claude/skills/vue-ssr-server
Command: npx skills add https://github.com/e-xode/vue-ssr --skill vue-ssr-server

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill solves the problem of consistently wiring Express 5 backend routes to MongoDB while enforcing authentication, authorization, rate limits, and safe request/error handling in the Vue SSR Starter Kit.

Core Features & Use Cases

  • Express 5 route-module setup (setupXRoute) with standardized error responses: Add a new endpoint by exporting a setup function and registering it in createApiRouter(db), using the required try/catch + console.error + i18n error key response shape.
  • MongoDB data access with injected singleton lifecycle and validation: Use mongoConnect/mongoClose with a shared client, validate ObjectIds via parseObjectId before any _id query, and apply parsePagination for list endpoints.
  • Production-grade security and abuse prevention per endpoint: Apply auth/admin middleware guards (requireAuth, requireAdmin, setMiddlewareDb) and mount production-only limiters (e.g., signup/auth/account/contact) to protect sensitive routes.

Use Case: You need to add a new admin-only endpoint that lists users with pagination; this Skill guides you to validate ids, query via helpers in dbHelpers.js, enforce requireAdmin(db), and return errors using i18n keys.

Quick Start

Add your new endpoint by creating a setupXRoute(app, db) module under src/api/, registering it inside createApiRouter(db) in router.js, validating inputs with dbHelpers (e.g., parseObjectId/parsePagination), and wrapping handler logic in the mandated try/catch that returns the correct i18n error keys.

Frequently Asked Questions about vue-ssr-server

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new Express 5 API route with MongoDB data access?

To add an Express 5 API route, create a setupXRoute module under src/api/, register it in createApiRouter(db), validate inputs with dbHelpers, and wrap handler logic in try/catch blocks returning i18n error keys.

How do I validate MongoDB ObjectId and pagination in Express endpoints?

Validate MongoDB ObjectId and pagination in Express endpoints by using the parseObjectId helper before any _id query and applying parsePagination for list endpoints to ensure safe database data access.

How do I apply authentication and rate limiting to Express API routes?

Apply authentication and rate limiting to Express API routes by using auth/admin middleware guards like requireAuth and requireAdmin, and mounting production-only limiters to protect sensitive endpoints from abuse.

What is the required error handling pattern for Express 5 backend APIs?

The required error handling pattern for Express 5 backend APIs is a standardized try/catch block that logs errors via console.error and returns appropriate HTTP responses using standardized i18n error keys.

Can I use a custom MongoDB connection with the Express route-module pattern?

You must use the injected mongoConnect singleton for MongoDB connection within the Express route-module pattern, ensuring a shared client lifecycle managed through the createApiRouter database injection.

Does this Express API approach work for admin-only guarded routes?

Yes, this Express API approach supports admin-only guarded routes by applying the requireAdmin middleware with the injected database instance to enforce authorization before reaching the endpoint handler.