<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Amadeus</title>
    <description>The latest articles on DEV Community by Amadeus (@--amadeus--).</description>
    <link>https://dev.to/--amadeus--</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3897676%2F3679d53a-3d99-4498-807e-1548300c94c5.jpg</url>
      <title>DEV Community: Amadeus</title>
      <link>https://dev.to/--amadeus--</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/--amadeus--"/>
    <language>en</language>
    <item>
      <title>TechHub: System Documentation</title>
      <dc:creator>Amadeus</dc:creator>
      <pubDate>Sat, 25 Apr 2026 15:39:24 +0000</pubDate>
      <link>https://dev.to/--amadeus--/techhub-system-documentation-job</link>
      <guid>https://dev.to/--amadeus--/techhub-system-documentation-job</guid>
      <description>&lt;p&gt;TechHub is a professional tech news and bookmark management platform. This guide covers the architecture, API reference, and setup procedures for developers.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;System Overview 
TechHub is a full-stack web application built with Next.js 15 (App Router). It serves as a proxy for the Hacker News Firebase API and allows users to manage bookmarks in a local SQLite database using Prisma ORM.
1.1 Technology Stack 
Framework: Next.js (App Router) v16.x for SSR and routing.
Language: TypeScript v5.x for type safety across all layers.
Database: SQLite via Prisma ORM v5.x.
Validation: Zod v3.x for schema validation on all API endpoints.
Styling: TailwindCSS v4.x.
Runtime: Node.js 20+.
1.2 Architecture &amp;amp; External Dependencies 
The application follows a three-tier architecture within a single Next.js deployment:
Presentation Layer: React client components using fetch() to call internal API routes.
Application Layer: Next.js Route Handlers handling HTTP requests and Zod validation.
Data Layer: Prisma Client executing type-safe queries against prisma/dev.db.
External API Integration: The Hacker News Firebase REST API is called server-side via /api/news. No API key is required, and responses are cached for 5 minutes (300 seconds) using Next.js fetch revalidation.&lt;/li&gt;
&lt;li&gt;Database Schema 
2.1 Bookmark Model 
id: String (Primary Key, cuid).
title: String (Required article headline).
url: String (Required, must be unique per bookmark).
description/imageUrl/publishedAt/note: Optional fields for metadata and private user notes.
source: String (Origin, typically 'Hacker News').
categoryId: Foreign Key to Category (Nullable).
2.2 Category Model 
id: String (Primary Key, cuid).
name: String (Unique, required, 1–50 chars).
color: String (Required hex color string).
Relation: One Category has many Bookmarks. Deleting a category setscategoryId to NULL for all related bookmarks.&lt;/li&gt;
&lt;li&gt;API Reference 
3.1 News Proxy 
GET /api/news: Fetches and normalizes stories from Hacker News.
Params: type (top|new|best), limit (max 50).
3.2 Bookmarks 
GET /api/bookmarks: Returns an array of bookmarks; supports categoryId filtering.
POST /api/bookmarks: Creates a new bookmark using the BookmarkCreate schema.
PATCH /api/bookmarks/🆔 Updates existing bookmark notes or category.
DELETE /api/bookmarks/🆔 Removes a bookmark record.
3.3 Categories 
GET /api/categories: Returns all categories with a count of related bookmarks.
POST /api/categories: Creates a new category.
PUT /api/categories/🆔 Updates category details.
DELETE /api/categories/🆔 Deletes the category and unlinks associated bookmarks.&lt;/li&gt;
&lt;li&gt;Setup &amp;amp; Deployment 
4.1 Initial Setup 
npm install: Install Node.js dependencies.
cp .env.example .env: Create environment configuration.
npx prisma generate: Compile Prisma Client from the schema.
npx prisma db push: Create the SQLite database and tables.
npm run dev: Start the development server on port 3000.
4.2 Production Build 
npx prisma generate: Regenerate client for production.
npx prisma db push: Apply schema to the production database.
npm run build: Compile and optimize the application.
npm run start: Start the production server.
Note: The SQLite file (prisma/dev.db) is created automatically. 
For production, ensure this file is on a persistent volume.&lt;/li&gt;
&lt;li&gt;Security &amp;amp; Error Handling
Input Validation: All write operations are validated server-side using Zod.
SQL Injection: Mitigated via Prisma's parameterized queries.
Error Responses: Standardized JSON format containing a human-readable error message and field-level details.
400 Bad Request: Validation failed.
409 Conflict: Duplicate URL or Category Name.
500 Internal Server Error: Database or unexpected exceptions.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>api</category>
      <category>architecture</category>
      <category>documentation</category>
      <category>nextjs</category>
    </item>
  </channel>
</rss>
