backend

Creates Astro server-side API routes and REST endpoints under src/pages.

Updated Mar 26, 2026
One-click install
npx skills add https://github.com/arborba100/command-hub --skill backend-arborba100
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: backend
Source: https://github.com/arborba100/command-hub/tree/main/.emdash/skills/backend
Command: npx skills add https://github.com/arborba100/command-hub --skill backend-arborba100

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building server-side API endpoints in an Astro SSR application requires knowing the correct file conventions, context object usage, and response patterns, and mistakes lead to broken routes or conflicts with the SPA catch-all page. ## Core Features & Use Cases - API Route Scaffolding: Generate .ts endpoint files in src/pages/api/ exporting typed HTTP method handlers (GET, POST, PUT, DELETE, ALL) that return standard Response objects. - Wix SDK Integration: Wire endpoints to @wix/data, @wix/members, @wix/ecom, and @wix/redirects for CMS queries, member data, and ecommerce operations. - Request Handling Patterns: Read JSON bodies, form data, query parameters, headers, and cookies, plus dynamic and catch-all route parameters. - Use Case: You need a CRUD API for a blog. Ask for posts endpoints and get src/pages/api/posts.ts and src/pages/api/posts/[id].ts backed by the Wix data items API with pagination and 404 handling. ## Quick Start Create a REST API endpoint at /api/products that lists items from the Wix products collection with limit and skip pagination.

Frequently Asked Questions about backend

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

FAQPage Schema
How do I create an API route in Astro?▼

Create a .ts file in src/pages/ that exports named functions for HTTP methods like GET or POST. Each function receives the Astro context object and must return a standard Response object, typically with a JSON content type header.

How to handle dynamic route parameters in Astro endpoints?▼

Use brackets in the filename, such as src/pages/api/users/[id].ts, and read values from the params object in the handler. For catch-all segments use [...path], which captures the remaining URL path as a string.

Can I use Wix SDK packages in Astro API routes?▼

Yes, Wix SDK packages like @wix/data, @wix/members, @wix/ecom, and @wix/redirects work directly in server-side Astro endpoints. Import them in your .ts route files and call their APIs inside the method handlers.

Why should API routes go in src/pages/api/ in Astro?▼

Placing endpoints under src/pages/api/ keeps them separate from the catch-all [...slug].astro page used for client-side routing. This prevents URL conflicts between your API endpoints and SPA routes.

Do I need to create auth endpoints like /api/auth/login in Astro?▼

No, the @wix/astro integration with auth enabled automatically provides login, logout, callback, and logout-callback routes. Recreating them would conflict with the built-in OAuth flow.