Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
# initial_prompt.md ## AI Prompt for Web Application Development Workflow The stack and constraints: - Backend: Node.js v22, Express, TypeScript, Prisma (PostgreSQL 16), Zod, JWT, PM2, Jest, ts-jest - Frontend: Next.js (React 18 + TypeScript), TailwindCSS, Axios. - Auth: Google SSO + email/password, account migration from email โ Google SSO, JWT authorization, credential encryption - DB: PostgreSQL 16 in its own Docker container, Prisma ORM + Migrate - Containers: Docker and Docker Compose (separate app and DB containers), persistent DB volume - Scripts: start.sh waits for dependencies; shutdown.sh gracefully stops all containers - Validation/formatting: Zod for runtime validation; Prettier for code formatting - Process: Work in an existing Git repo; commit after each validated feature - Roles: First registered user โ ADMINISTRATOR; subsequent users โ INTERVIEWEE; third role โ INTERVIEWER. Admins can manage users/roles, and there must always be at least one ADMINISTRATOR. INTERVIEWER/INTERVIEWEE land on a welcome page. All pages include Logout. - UI/UX: High-contrast dark mode; professional palette (#a30502, #f78b04, #2b1718, #153a42, #027f93); clean, readable typography; responsive layout; smooth animations/transitions; WCAG 2.2 compliant - Secrets: Config files in /config; fallback to environment variables if missing - Logging: Application logs + separate audit logs for ADMINISTRATOR/INTERVIEWER actions - Resource/performance: Optimize container orchestration resources - Documentation: Automatic generation (see Documentation Strategy) - Observability: Add placeholders and TODO comments where Datadog monitoring will be integrated - i18n readiness: Design architecture to be internationalization-ready for future expansion - Use context7 mcp to consult latest documentation during implementation - Test goals: 100% test pass rate and target 100% coverage; when not achievable, create TODO markdown of deferred tests --- ## ๐ฏ Objective You are an expert AI web application developer and product manager. Generate a **comprehensive, production-ready implementation plan** for a modern full-stack TypeScript application with a Node.js + Express backend and a React 18 + Next.js frontend styled with TailwindCSS. The plan must include **tasks, subtasks, and atomic tasks**, addressing **dependencies, edge cases, tests, rollback strategies, and documentation updates**. The process should be **iterative**, **self-analyzing**, and **checkpoint-driven**, producing not just instructions but reflections and validations at each major phase. Actively perform self-analysis of your nature, choices, and reasoning as you plan and write. As you generate text (plans, designs, code, tests), refer to, interpret, and evolve your approach based on what you just wrote. This continuous meta-analysis must be explicit and actionable. --- ## ๐งฑ Core Tech Stack ### Frontend - **Framework:** Next.js (React 18 + TypeScript) - **Styling:** TailwindCSS - **API Layer:** Axios for HTTP communication - **Optional Tools:** Storybook for component documentation - **Bundler:** Built-in Next.js ### Backend - **Runtime:** Node.js 22+ (ESM, `"type": "module"`) - **Framework:** Express (TypeScript) - **ORM:** Prisma (PostgreSQL) - **Validation:** Zod (source of truth for OpenAPI) - **API Docs:** OpenAPI 3.1 โ Redoc / Swagger UI ### Monorepo - **Tooling:** Turborepo - **Structure:** - `apps/web` โ Next.js frontend - `apps/api` โ Express backend - `apps/docs` โ Docusaurus documentation site - `packages/ui`, `packages/shared` โ shared components and utilities --- ## โ๏ธ Database & Persistence - **DB:** PostgreSQL 16 - **ORM:** Prisma ORM with migrations - **Soft Deletes:** For user-generated content (`deleted_at`) - **Indexes:** Partial indexes and partitioning for large tables - **Pooling:** PgBouncer (local and prod) - **Constraints:** Always โฅ1 admin, transactional updates - **Tuning:** WAL, shared buffers, autovacuum, and query analysis (EXPLAIN/ANALYZE) --- ## ๐ Authentication & Authorization - **Flows:** Email/password and Google SSO - **Tokens:** Short-lived JWTs (5โ10m) + refresh cookies (HTTP-only, Secure, SameSite=Lax) - **Key Rotation:** JWKS endpoint with dual-key rotation - **Roles:** ADMINISTRATOR, INTERVIEWER, INTERVIEWEE - **Break-glass Recovery:** CLI-based superadmin - **Rate Limits:** /auth and /api endpoints with per-IP/user quotas - **CSRF:** Double-submit token pattern --- ## ๐งฐ API Design & Documentation - **Zod-to-OpenAPI:** Zod schemas define API contracts. - **Endpoints:** `/openapi.json` (machine-readable) + `/docs/api` (Redoc) - **Versioned Docs:** Snapshot docs per release tag. - **Docs CI/CD:** 1. Generate OpenAPI JSON 2. Run TypeDoc 3. Build Docusaurus 4. Publish versioned docs --- ## ๐งช Testing & Quality Gates - **Unit/Integration:** Jest (ESM config) - **E2E:** Playwright - **Mutation Testing:** Stryker - **Accessibility:** @axe-core/playwright (fails on WCAG 2.2 AA issues) - **Visual Regression:** Playwright snapshots - **Coverage Targets:** Global โฅ90%, critical modules 100% - **Deferred Tests:** Create TODO markdown for deferred/unimplemented tests --- ## ๐ฉบ Runtime, Health, and Observability - **Containers:** Single process per container - **Health Checks:** `/healthz`, `/readyz` (checks DB, JWKS, migrations) - **Metrics:** `/metrics` endpoint (Prometheus) - **Observability Hooks:** `traceSpan()`, `metricCounter()`, `logContext()` - **Secrets Management:** Cloud Secret Manager or Vault - **CORS/TLS:** Strict enforcement and cookie hardening - **TODO:** Add Datadog APM/trace TODO placeholders inline in code --- ## ๐งญ Workflow and Feature Development Loop Each feature must follow this loop before completion: 1. **Work Plan Creation** - Produce a high-level work plan broken down into: - Major tasks โ subtasks โ atomic tasks - Include for each task: - Acceptance criteria and objective success metrics - Quality gates (lint/typecheck/test/coverage thresholds) - Rollback triggers (explicit conditions to revert) 2. **UI/UX Planning and Approval** - Create UI/UX screenshot mockups for every page/feature BEFORE implementation. - **Element Identification**: Each visible element must have a clear element name or element ID in the screenshot for precise feedback and revisions. - **Multi-Step Workflows**: For features with multiple steps or states, provide a screenshot per step/state. - Support iterative refinement: accept feedback referencing element IDs/names and generate updated mockups. - Apply palette, dark mode, responsive layout, hierarchy, animations, and WCAG 2.2. - Do not proceed to implementation until UI/UX has been approved. 3. **Test Case Creation** - After approval, detail comprehensive frontend, backend, and E2E test cases. - Define pass criteria, coverage targets, test metrics. - Include security, accessibility, and performance tests where appropriate. - If tests cannot be fully implemented immediately, create a TODO markdown file listing deferred tests and rationales. 4. **Feature Development** - Backend: Express + TS + Prisma + Zod + JWT - Frontend: Next.js (React 18 + TS) + TailwindCSS + Axios + Vite - Implement with strict typing, runtime validation, secure API handling, error management. - use secure APIs and error handling. 5. **Testing & Rollback Plan** - Implement Jest, Playwright tests aiming for 100% coverage and pass. - If tests fail: - Fix iteratively until passing. - If persistent, ask to create a TODO markdown listing deferred tests and continue. - If app breaks after last working feature: - Use Git checkpoints or Git tags and impact assessment to rollback to stable state. - Refine the feature prompt and re-implement. 6. **Containerization & Optimization** - Use Docker multi-stage builds for app and database. - Apply resource and performance optimization strategies (CPU/memory limits in compose/yaml). - Provide start.sh that waits for all dependencies (DB Healthy), and shutdown.sh for graceful termination. - Use Docker Compose. 7. **Database Schema & Optimization** - Define schemas with Prisma, use migrations. - Follow PostgreSQL best practices: - Normalized schemas, indexed columns per query pattern. - Use appropriate data types and constraints, foreign keys, and soft deletes selectively. - Indexing strategies: B+ trees, GIN for JSONB, partial indexes. - Partition large tables by time or domain if applicable. - Ensure data durability with persistent volumes. 8. **Authentication & Role Migration** - Support email/password and Google SSO login. - Implement a migration workflow: - User initiates account migration. - Only complete if Google SSO auth succeeds. - If an existing SSO account exists, prompt merge. - Perform atomic migration, with rollback on error. - Log all steps and outcomes. - Enforce roles: - First user โ ADMINISTRATOR - Later users โ INTERVIEWEE, INTERVIEWER. - Admins manage users/roles via admin page, maintaining at least one admin. - Landing pages for interviewee/interviewer. 9. **Secrets, Configuration** - Config files stored in `/config`; fallback to environment variables if files missing. - Secure handling; no secrets baked into images. 10. **Logging & Audit** - Structured JSON logs with correlation/request IDs. - Application logs + audit logs for all moderator/admin actions. - Redact PII; configure log levels. 11. **Commit Strategy** - Commit after each feature/validation step. - Use conventional commits. - Tag releases at stable points. 12. **Documentation & Monitoring Placeholders** - Generate API docs (OpenAPI + Redocly or alternatives), TypeDoc, and Docusaurus docs site. - Automate docs updates via CI. - TODO placeholders for Datadog instrumentation in code: - APM trace setup - Metrics endpoints - Log enrichment - Placeholder health endpoints at `/healthz`, `/readyz`. 13. **Internationalization (i18n)** - Architecture prepared for multi-language support: - Configured locales in Next.js - Message catalogs; ICU formatting - Design for text expansion, RTL support - URL schemas for localized paths - Current only English; ready for future expansion. 14. **Deployment Configurations** - Local Docker Compose setup: - Multi-stage Dockerfiles for app and Postgres - Persistent Postgres volume - start.sh / shutdown.sh scripts - AWS: - ECR, Terraform templates - ECS Fargate / EKS options - Secrets: AWS Secrets Manager / Parameter Store - Monitoring placeholders (TODO for Datadog) - GCP: - Artifact Registry, Cloud Run / GKE - Cloud SQL for PostgreSQL - Azure: - ACR, Container Apps or AKS - Azure Database for PostgreSQL - Secrets via Key Vault - Multi-cloud considerations: - Standardize images, use environment-specific configs, IaC templates. 15. **Container Optimization & Security** - Use multi-stage Docker builds. - Run containers non-root. - Apply resource limits; health checks; update scanning. - Secrets injected at runtime securely. 16. **Security & JWT** - Short-lived tokens, refresh tokens. - Secure cookies, CSRF protections. - Rate limit login endpoints. - Maintain JWT key rotation strategy. --- ## ๐ง Self-Analysis Protocol After each major step, perform a brief reflective evaluation: - Identify 2โ3 **risks or weaknesses** in approach. - Compare **alternative strategies**. - Record **decision rationale** and potential downstream impact. - Maintain decision log for traceability. --- ## ๐ Rollback & Recovery - Use Git tags as stable checkpoints. - Conduct impact analysis before rollback. - Prefer partial rollback (component-level) before full revert. - Document causes, fixes, and revalidation notes. --- ## ๐งพ Definition of Done (DoD) - [ ] Lint & Typecheck clean - [ ] All tests pass - [ ] Coverage โฅ90% - [ ] Accessibility checks pass - [ ] Docs updated - [ ] Observability hooks added - [ ] Audit logs validated - [ ] Rollback strategy documented --- ## ๐ Documentation Strategy - Generate: - OpenAPI spec + Redocly site - TypeDoc code reference - Docusaurus guides/tutorials - CI Integration: - Auto-build on merge - Version docs per tag - Publish to `docs.example.com` --- ## ๐ Internationalization (i18n) - **Routing:** Next.js i18n routing - **Localization:** ICU format messages (`@formatjs`) - **RTL:** Tailwind config for RTL support - **Expansion:** Plan for additional locales and path schemas --- ## ๐ CI/CD & Deployment - **Pipeline:** GitHub Actions or GitLab CI - **Stages:** install โ build โ test โ docs โ deploy - **Environments:** staging (on PR merge) and production (on tag) - **Cloud Options:** AWS ECS/GKE/Cloud Run with IaC templates - **Secrets:** Managed by Secret Manager or Parameter Store - **Monitoring:** TODO placeholders for Datadog, Prometheus --- ## ๐งฉ Additional Guidelines - Follow **12-factor app** principles (no config files in repo) - Enforce **security linting** (`eslint-plugin-security`) - Use **feature flags** for incremental rollout - Apply **Renovate or Dependabot** for dependencies - Maintain **audit logs** with correlation IDs - **Never store secrets in images** --- ## ๐ Output Requirements The generated plan must include: 1. Phases & milestones (setup โ deployment) 2. Tasks, subtasks, atomic tasks with dependencies 3. Edge cases, rollback paths, and fallback strategies 4. Required files & configuration snippets 5. Commit checkpoints & changelog references 6. Cross-linked docs and self-analysis checkpoints --- ### Final Notes - All steps must have clear acceptance criteria. - Use iterative refinement: mockups, tests, configs. - Documentation and code must comply with latest standards. - Self-reflection and pattern recognition enhance decision quality. --- ### End of initial_prompt.md
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
Untitled
59 sec ago | 0.39 KB
Untitled
2 min ago | 0.60 KB
Untitled
5 min ago | 0.59 KB
Christmas Gift
52 min ago | 0.84 KB
December smells like money (Release)
CSS | 52 min ago | 0.82 KB
Untitled
3 hours ago | 7.33 KB
Portent: Something major about today, Dec 11....
6 hours ago | 0.66 KB
Portent: Something major about today, Dec 11....
6 hours ago | 0.66 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!