SShortSingh.
Back to feed

Fastify TypeScript Part 13: Moving Users to PostgreSQL with a Repository

0
·4 views

This thirteenth part of the Fastify with TypeScript series replaces the in-memory user store, which loses data on every restart, with a PostgreSQL database. It shows how to start PostgreSQL quickly with Docker, then create a users table with a UUID primary key and a unique email column. A database plugin built on @fastify/postgres provides a connection pool that is closed on shutdown and includes an error listener so a dropped idle connection does not crash the API. Queries are written with parameterized placeholders to prevent SQL injection. The chapter also introduces a users repository that becomes the only layer aware of how users are stored.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Using exported audit logs as verifiable SOC 2 evidence for AI agent controls

Companies undergoing a SOC 2 examination will face questions about AI agents, including who can launch them, what they can access, and how risky actions are approved. Assessors need evidence rather than general claims that logs exist, and a log only qualifies if it is complete, accurate, and linked to a control the organization actually operates. The article recommends writing controls first and then identifying which log entries support each one, with examples mapped to 2017 Trust Services Criteria such as access restriction, monitoring, and change authorization. Assessors typically test three properties: completeness of the record, accuracy of entries, and integrity since export. Tamper-evident, hash-chained logs help by making deletions or edits detectable, though they do not by themselves prove accuracy. The author stresses that vendor logs do not confer certification or compliance, which remains the organization's own responsibility.

0
ProgrammingDEV Community ·

Mobilizon GraphQL API needs separate public and authenticated inventory tracks

Mobilizon serves a GraphQL API at /api with a browser playground at /graphiql, where public content is open to unauthenticated callers and other operations require authentication and authorization such as group membership. The article recommends two inventory tracks: one covering public federation and event discovery, and another covering authenticated group and account authority. A ZoomEye query run on 2026-11-25 returned 338 hosts for a Mobilizon title match, but the article stresses that this is not a count of installations or evidence of API exposure. It advises reviewing token flows, application identity, and per-resolver authorization, while avoiding enumeration of private groups or schema introspection to uncover protected details. The author notes that GraphQL behavior can change between releases, so reviews should rely on fresh endpoint and authorization tests rather than earlier counts.

0
ProgrammingDEV Community ·

Per-Ticket Cost Breakdown of AI Support Triage: Make vs n8n vs CustomGPT

A DEV Community article examines how to build automated customer support triage pipelines, weighing the trade-offs between low-code orchestration, self-hosted workflow engines, and turnkey RAG platforms. It describes a standard pipeline that ingests helpdesk webhooks, retrieves knowledge base context via embeddings, classifies tickets with an LLM into structured JSON, and routes results to the CRM. To benchmark costs, the author assumes roughly 1,000 prompt tokens and 150 output tokens per ticket, pricing direct AI backend usage with gpt-4o-mini and embeddings at about $0.000745 per ticket. The piece then compares how Make, n8n, and CustomGPT meter executions, starting with Make's credit-based model where most module actions consume one credit.

0
ProgrammingDEV Community ·

Saer CLI Infers the Design System a Frontend Codebase Actually Uses

A developer has built Saer, a command-line tool that scans an existing frontend codebase to infer the design system the code truly uses, rather than the one declared in configuration. The beta reconciles Tailwind config, CSS custom properties, and React components into one model covering colour, type, spacing, and components. Findings are separated by confidence: exact drift where a raw value bypasses a declared token, dead declarations, and experimental near-match and conflict findings with confidence scores. The author describes testing that caught errors such as misread nested CSS themes, which led to a structural CSS parser and a whole-report evidence rating. The tool also distinguishes between 'unknown' from insufficient repository evidence and 'unresolved' from limits of the tool itself. Scanning is local and deterministic, with no AI model running at scan time.