$ show nktnet1/rt-stack
This repository is a modern, lightweight full-stack application template built with Turborepo. It consists of two main apps: a React single-page application (Vite + TanStack Router/Query/Form) for the frontend, and a Hono (Node.js) server providing an oRPC-based API with OpenAPI (Scalar) documentation. Authentication is handled by better-auth (email/password) with PostgreSQL via Drizzle ORM. The system supports CRUD operations for posts, includes dark/light theme toggling, and is fully containerized with Docker. The architecture follows a modular monorepo structure with shared packages for API contracts (oRPC), authentication, database schema and client, UI components (shadcn/ui), and reusable tooling configurations (ESLint, Prettier, Tailwind CSS, TypeScript). The codebase demonstrates strong engineering practices: environment variable validation with valibot, type-safe API contracts with oRPC, session-based auth with CORS, and a robust monorepo setup with Turborepo caching and dependency management.
The LLM identified 6 files worth highlighting for reuse:
Defines a valibot schema for validating and normalizing API path prefixes. Includes checks for safe path segments (no '.', '..', backslashes, or encoded separators) and ensures the path starts with '/'. Self-contained, reusable for any project requiring validated URL path parameters.
Provides a programmatic database schema push using Drizzle Kit's API. Checks for data loss before applying and exits with error if detected. Encapsulates the push logic in an async function, making it reusable in CI/CD pipelines or Docker containers without interactive CLI.
Defines a Drizzle ORM table for posts and exports a `CreatePostSchema` using `drizzle-valibot` with custom validation pipes (minLength for title and content). Demonstrates a clean pattern for generating insert schemas with domain-specific constraints. Extensible and portable to other entities.
Exports shared environment validation schemas for base path and web URL using valibot. Includes normalization, safety checks (against directory traversal), and strict URL parsing. The `parseWebServerAddress` function extracts host and port from a validated URL. Could be extracted into a package for any Vite/React project needing runtime environment validation.
Abstracts better-auth configuration into `getBaseOptions()` and `createAuth()` functions. The base options are shared between the server and the CLI schema generation (via `cli-config.ts`), avoiding duplication. Demonstrates a reusable pattern for setting up better-auth with Drizzle adapter and OpenAPI plugin while keeping secret management clean.
Defines an ESLint configuration that includes a `restrictEnvAccess` export, which prohibits direct use of `process.env` and encourages validation via valibot. This is a reusable linting pattern that can be applied across any project in the monorepo to enforce environment variable safety.