Node.js Backend Service Taste

Node.js Backend Service Taste

Sets preferences for small, predictable TypeScript Node.js services: strict typing, schema validation, structured logging, graceful shutdown and lean Docker images.

Node.js Backend Service taste of a TypeScript engineer who wants small, predictable services

  • Write services in TypeScript with strict: true and native ES modules. Confidence: 0.90
  • Pin the Node.js version to an active LTS release in .nvmrc, engines and the Docker base image. Confidence: 0.90
  • Use Fastify or Hono for HTTP, with request and response schemas that also generate the OpenAPI document. Confidence: 0.75
  • Validate every incoming body, query and header at the edge and work only with typed data inside. Confidence: 0.95
  • Load configuration once at startup from environment variables, validate it with a schema and fail fast if anything is missing. Confidence: 0.90
  • Keep handlers thin: they parse input, call a service function and map the result to a response. Confidence: 0.85
  • Never block the event loop; move CPU-heavy work to worker threads or a separate job queue. Confidence: 0.90
  • Use async/await everywhere and treat any floating promise as a lint error. Confidence: 0.90
  • Log structured JSON with pino, include a request ID on every line and never log secrets or tokens. Confidence: 0.90
  • Return errors in one consistent JSON shape with a stable error code, and map unknown errors to 500 without leaking stack traces. Confidence: 0.85
  • Handle SIGTERM by closing the server, draining in-flight requests and closing database pools before exit. Confidence: 0.90
  • Crash on unhandledRejection and uncaughtException after logging, and let the orchestrator restart the process. Confidence: 0.80
  • Expose separate liveness and readiness endpoints; readiness checks real dependencies. Confidence: 0.85
  • Set timeouts on every outgoing HTTP and database call, and use AbortSignal to cancel them. Confidence: 0.85
  • Use a connection pool with a fixed maximum size for the database, tuned to the number of instances. Confidence: 0.80
  • Prefer the built-in fetch, node:test and node:crypto before adding a dependency. Confidence: 0.70
  • Test HTTP routes with in-process injection instead of starting a real port. Confidence: 0.75
  • Add OpenTelemetry tracing early so slow requests can be followed across services. Confidence: 0.75
  • Build a small production image with a multi-stage Dockerfile and run it as a non-root user. Confidence: 0.85
  • Keep package-lock.json committed and install with npm ci in CI and Docker builds. Confidence: 0.90

Public domain (CC0 1.0) · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 12,202 prompts

More by @OpenSourceBuffGuy

See all
Commercial Space Mission Architecture Expert prompt image

Commercial Space Mission Architecture Expert

Acts as a space mission architect that designs satellite or lunar missions with spacecraft systems, launch strategy, ground segment and a business case.

system-prompt, act-as, space, engineering, business-plan, financial-model, estimation, risk-management, compliance, for-engineers, for-founders, technical-spec, structured-output, xml-tags, expert-advice, planner, timeline, startup, long-form, advanced, business-strategy

Seven-Panel Product Editorial prompt image

Seven-Panel Product Editorial

Turns an attached product image into a seven-panel studio editorial: a hero shot plus macro, logo, scale, flat-lay, motion and silhouette views.

image-prompt, reference-image, multi-panel, product-photography, studio-lighting, macro, logo, editorial, 3d-render, luxury, branding, mockup, structured-output, nano-banana, for-designers, for-marketers, photorealistic, dramatic-lighting, motion-blur, silhouette, flat-lay

Indonesian School Nutrition Program Landing Page Mockup prompt image

Indonesian School Nutrition Program Landing Page Mockup

Draws a desktop landing-page mockup for an Indonesian school-meal programme, with a set navigation bar, hero photo, red statistics band and carousel dots.

image-prompt, gpt-image, ui-mockup, mockup, landing-pages, web-design, ui-ux, graphic-design, typography, text-rendering, widescreen, white-background, limited-palette, negative-space, for-designers, structured-output, government, nutrition, long-form

Reviews

Loading reviews…

Discussion

Loading comments…