PromptBase
Upgrade
Close icon
General
Home
Marketplace
Create
Hire
Login
Chat
Sell
Explore

Prompt Details

Model
(claude-5-5-sonnet)
Token size
3,518
Example input
[APPLICATION_OBJECTIVE_AND_REQUIREMENTS]: Build a web app for managing online orders, customers, products, payments, and order status. [EXISTING_CODEBASE_OR_APPLICATION]: Existing React frontend + Node.js/Express backend with PostgreSQL. [FEATURES_USER_FLOWS_AND_BUSINESS_RULES]: Admin can manage products and orders. Customers can place orders, view order history, and track status. [SECURITY_PERFORMANCE_AND_OPERATIONAL_REQUIREMENTS]: JWT authentication, role-based authorization, input validation, secure payment handling, responsive UI. [DELIVERY_DEPLOYMENT_AND_TESTING_REQUIREMENTS]: Unit, API, integration, and E2E tests; Docker deployment with CI/CD.
Example output
# πŸ”Ž PHASE 1 β€” APPLICATION REQUIREMENT RECONSTRUCTION ### 🎯 Business Objective Build a production-oriented e-commerce order management system that allows customers to purchase products while administrators manage products, orders, and order fulfillment. ### πŸ‘₯ Users - Customer - Administrator ### πŸ”„ Primary Workflows **Customer:** 1. Register/login 2. Browse products 3. Add product to cart 4. Checkout 5. Complete payment 6. View order 7. Track order status 8. View order history **Administrator:** 1. Login 2. View dashboard 3. Create/update products 4. View orders 5. Update order status 6. Review payment/order information ### βœ… Functional Requirements - User authentication - Product browsing - Product management - Shopping cart - Checkout - Payment processing - Order creation - Order tracking - Order history - Admin order management ### βš™οΈ Non-Functional Requirements - Secure authentication - Server-side authorization - Responsive UI - Reliable payment handling - API validation - Database integrity - Automated testing - Production monitoring ### πŸ“Œ Assumptions - REST APIs are retained. - PostgreSQL remains the primary database. - Existing React/Node.js architecture is preserved. - Payment provider supports server-side payment verification. ### ❓ Unresolved Questions - Which payment gateway is being used? - Are refunds required? - Is inventory reservation required during checkout? - Are multiple currencies required? - Are guest checkouts supported? --- # 🧩 PHASE 2 β€” CODEBASE & ARCHITECTURE ANALYSIS Because the sample provides only the technology stack and not actual source files, code-specific conclusions cannot be made. ### πŸ—οΈ Known Architecture ```text React Frontend ↓ REST API ↓ Node.js / Express ↓ PostgreSQL ↓ Payment Gateway ``` ### πŸ” Evidence-Based Findings - React is responsible for the frontend. - Express/Node.js provides backend APIs. - PostgreSQL stores application data. - Payment processing depends on an external service. ### ⚠️ Cannot Yet Confirm - Actual project structure - Existing components - Existing routes - Authentication implementation - Database schema - Dependency versions - Current technical debt No files should be invented without inspecting the actual codebase. --- # 🎨 PHASE 3 β€” FRONTEND ENGINEERING ### πŸ–₯️ Suggested Page Structure ```text / β”œβ”€β”€ Product Listing β”œβ”€β”€ Product Details β”œβ”€β”€ Cart β”œβ”€β”€ Checkout β”œβ”€β”€ Order Confirmation β”œβ”€β”€ Order History β”œβ”€β”€ Order Details β”œβ”€β”€ Login └── Register /admin β”œβ”€β”€ Dashboard β”œβ”€β”€ Products β”œβ”€β”€ Orders └── Order Details ``` ### 🧱 Component Areas - Navigation - ProductCard - ProductGrid - CartSummary - CheckoutForm - OrderStatus - OrderTable - AdminDashboard - ErrorMessage - LoadingState - EmptyState ### πŸ”„ UI States Every important operation should support: - Loading - Success - Error - Empty - Retry where appropriate ### β™Ώ Accessibility - Keyboard navigation - Semantic HTML - Form labels - Accessible error messages - Adequate focus handling - Screen-reader-friendly status messages ### πŸ“± Responsive Behavior The interface should work across: - Mobile - Tablet - Desktop --- # βš™οΈ PHASE 4 β€” BACKEND ENGINEERING ### πŸ—οΈ Recommended Responsibility Separation ```text HTTP Route ↓ Controller ↓ Application Service ↓ Domain / Business Rules ↓ Repository / Data Access ↓ PostgreSQL ``` ### 🧠 Example Responsibilities **Controller** - Parse request - Call service - Return HTTP response **Service** - Execute business workflow - Validate business conditions - Coordinate database/payment operations **Repository** - Execute database queries - Handle persistence ### πŸ’³ Checkout Example ```text Checkout Request ↓ Validate Customer ↓ Validate Cart ↓ Validate Product Availability ↓ Calculate Order ↓ Create Payment Intent ↓ Confirm Payment ↓ Create/Finalize Order ↓ Return Order Result ``` Payment confirmation must not rely solely on frontend claims. --- # πŸ”Œ PHASE 5 β€” API ARCHITECTURE ### πŸ” Authentication ```text POST /api/auth/register POST /api/auth/login POST /api/auth/logout ``` ### πŸ›οΈ Products ```text GET /api/products GET /api/products/:id POST /api/products PATCH /api/products/:id DELETE /api/products/:id ``` ### πŸ›’ Cart ```text GET /api/cart POST /api/cart/items PATCH /api/cart/items/:id DELETE /api/cart/items/:id ``` ### πŸ“¦ Orders ```text POST /api/orders GET /api/orders GET /api/orders/:id PATCH /api/orders/:id/status ``` ### πŸ”’ Authorization Example: ```text Customer β†’ Read own orders Admin β†’ Read/manage orders Customer β†’ Cannot modify another customer's order ``` ### ⚠️ Important The backend must verify ownership. A request such as: ```text GET /api/orders/123 ``` must not automatically reveal order `123` merely because the user knows its ID. --- # πŸ—„οΈ PHASE 6 β€” DATABASE & DATA ARCHITECTURE ### πŸ“Š Core Entities ```text Users Products Orders OrderItems Payments ``` ### πŸ”— Relationships ```text User └── Orders └── OrderItems └── Product Order └── Payment ``` ### πŸ”‘ Important Constraints - Unique user email - Positive product price - Valid order status - Foreign-key relationships - Order item must reference a valid product - Payment must reference the appropriate order ### πŸš€ Index Considerations Potential indexes: - User email - Order user ID - Order creation date - Order status - Order item order ID Actual indexes should be confirmed against real query patterns. ### πŸ”„ Migration Safety Schema changes should follow: ```text Migration β†’ Test β†’ Backup/Recovery Strategy β†’ Deploy β†’ Validate β†’ Rollback Plan ``` --- # πŸ” PHASE 7 β€” AUTHENTICATION & AUTHORIZATION ### πŸ”‘ Authentication Authentication answers: **"Who are you?"** Example: ```text Email + Password ↓ Authentication ↓ Session / Token ``` ### πŸ›‘οΈ Authorization Authorization answers: **"What are you allowed to do?"** Example: | Action | Customer | Admin | |---|---|---| | View products | Yes | Yes | | Buy products | Yes | Yes | | View own orders | Yes | Yes | | View all orders | No | Yes | | Create products | No | Yes | | Delete products | No | Yes | | Change order status | No | Yes | Authorization must be enforced server-side. --- # πŸ›‘οΈ PHASE 8 β€” APPLICATION SECURITY | Risk | Evidence | Impact | Recommended Control | Priority | |---|---|---|---|---| | Broken access control | Orders contain user-owned data | High | Server-side ownership checks | Critical | | Injection | API accepts user input | High | Parameterized queries + validation | High | | XSS | User-controlled data may reach UI | Medium/High | Output encoding + safe rendering | High | | Credential theft | Authentication exists | High | Secure session/token handling | High | | Sensitive logging | Payment/auth data involved | High | Redact sensitive information | High | | CSRF | Depends on auth mechanism | Medium | Appropriate CSRF protection | Medium | | Dependency vulnerabilities | External packages | Medium/High | Dependency scanning | High | ### πŸ’³ Payment Security Do not store raw card information unless the architecture explicitly requires it and complies with applicable payment-security requirements. Prefer tokenized/payment-provider-hosted mechanisms. --- # πŸ› PHASE 9 β€” DEBUGGING & ROOT-CAUSE ANALYSIS ### Example Bug **Reported Problem:** Customer sees another customer's order. ### Expected Behavior ```text Customer A β†’ Can view Customer A orders only ``` ### Actual Behavior ```text Customer A β†’ Can access arbitrary order ID ``` ### Investigation ```text Request ↓ Authentication ↓ Order Endpoint ↓ Order ID lookup ↓ Missing ownership check ``` ### Root Cause The API identifies the order but does not verify that the authenticated user owns it. ### Fix Add server-side authorization: ```text authenticatedUser.id == order.userId ``` unless the requester has an authorized administrative role. ### Regression Test ```text Customer A requests Customer B's order β†’ HTTP 403 or appropriate not-found response β†’ No order data returned ``` --- # πŸ§ͺ PHASE 10 β€” TESTING ARCHITECTURE ### πŸ”¬ Unit Tests Test: - Price calculations - Order totals - Validation - Permission rules - Order-status transitions ### πŸ”Œ API Tests Test: - Authentication - Product APIs - Cart APIs - Order APIs - Unauthorized requests - Invalid payloads ### πŸ—„οΈ Integration Tests Test: ```text API β†’ Service β†’ Database ``` ### 🌐 E2E Tests Example: ```text Register β†’ Login β†’ Browse Product β†’ Add to Cart β†’ Checkout β†’ Payment β†’ Order Confirmation β†’ Order History ``` ### πŸ” Security Tests Test: - Unauthorized access - Cross-user order access - Admin-only endpoints - Invalid tokens - Malformed requests - Injection attempts - Rate limiting where applicable ### πŸ“Œ Requirement Mapping ```text Requirement ↓ Implementation ↓ Test ↓ Acceptance Criteria ``` --- # ⚑ PHASE 11 β€” PERFORMANCE & SCALABILITY ### πŸ” Potential Bottlenecks - Product listing queries - Large order-history queries - Payment-provider latency - Unoptimized database queries - Large frontend bundles ### πŸš€ Improvements Use where justified: - Pagination - Database indexes - Response caching - Lazy loading - Query optimization - Connection pooling - API request batching where useful ### ⚠️ Important No benchmark numbers should be claimed until actual measurements exist. --- # πŸ”„ PHASE 12 β€” INTEGRATION & FAILURE ENGINEERING ### πŸ’³ Payment Integration Possible failures: ```text Payment Success Payment Failed Payment Timeout Payment Status Unknown ``` ### ⚠️ Unknown Execution Status If the payment request times out, do not automatically assume: ```text Payment Failed ``` It could have succeeded remotely. Use payment-provider verification/webhooks where supported. ### πŸ” Retry Strategy Retries should be: - bounded - selective - preferably exponential backoff - safe for idempotent operations Do not blindly retry payment/order creation. ### πŸ†” Idempotency Checkout should support an idempotency mechanism where the payment/order provider supports it, preventing duplicate orders from repeated requests. --- # πŸ“Š PHASE 13 β€” OBSERVABILITY & RELIABILITY ### πŸ“ Structured Logs Useful events: ```text request_received authentication_failed authorization_failed order_created payment_failed payment_status_unknown order_status_changed ``` ### πŸ“ˆ Metrics Track: - API latency - Error rate - Checkout failures - Payment failures - Order creation rate - Database latency ### πŸ†” Request Correlation ```text Request ↓ Request ID ↓ Frontend ↓ API ↓ Backend ↓ Database / External API ``` This helps trace production failures. ### ❀️ Health Checks Example: ```text /health ``` Should provide appropriate application health information without exposing secrets. --- # πŸš€ PHASE 14 β€” DEPLOYMENT & PRODUCTION ARCHITECTURE ### 🌍 Environments ```text Development ↓ Staging ↓ Production ``` ### πŸ”„ CI/CD ```text Git Push ↓ Lint ↓ Unit Tests ↓ Integration Tests ↓ Build ↓ Security Checks ↓ Deploy Staging ↓ Validation ↓ Production ``` ### πŸ—„οΈ Database Deployment Avoid deploying destructive schema changes without: - Migration plan - Backup/recovery strategy - Compatibility assessment - Rollback strategy ### ↩️ Rollback Application rollback: ```text Current Version ↓ Previous Stable Version ``` Database rollback requires separate consideration because data migrations may not be safely reversible. --- # πŸ”§ PHASE 15 β€” IMPLEMENTATION & ENGINEERING ROADMAP ### πŸš‘ Quick Fixes **TASK-001** - Component: Authorization - Objective: Ensure users can access only permitted orders - Acceptance: Cross-user order access is blocked - Test: Authorization integration tests - Priority: Critical **TASK-002** - Component: API validation - Objective: Validate incoming request payloads - Acceptance: Invalid requests receive consistent validation errors - Test: API validation tests - Priority: High ### πŸš€ Feature Work **TASK-003** - Component: Checkout - Objective: Implement reliable checkout workflow - Dependencies: Cart + payment integration - Tests: Integration + E2E - Priority: High **TASK-004** - Component: Admin Orders - Objective: Allow authorized admins to manage order statuses - Dependencies: Authorization - Tests: API + E2E - Priority: High ### πŸ—οΈ Architecture Improvements **TASK-005** - Component: Backend service layer - Objective: Separate business logic from controllers - Acceptance: Controllers remain thin - Tests: Existing regression suite remains green - Priority: Medium ### πŸ›‘οΈ Production Hardening **TASK-006** - Component: Observability - Objective: Add structured logging and monitoring - Tests: Log/metric verification - Priority: Medium **TASK-007** - Component: CI/CD - Objective: Automate testing and deployment - Tests: Pipeline validation - Priority: Medium --- # πŸ† PHASE 16 β€” FINAL SENIOR WEB ENGINEERING REPORT ## 1. Executive Engineering Summary The application should use the existing React + Node.js/Express + PostgreSQL architecture rather than introducing unnecessary architectural complexity. The highest-priority engineering areas are: - Secure authorization - Reliable checkout/payment processing - Database integrity - API validation - Automated testing - Production observability No full rewrite is justified from the supplied information. --- ## 2. Requirements & User Flow ### Customer ```text Login ↓ Browse ↓ Cart ↓ Checkout ↓ Payment ↓ Order ↓ Tracking ``` ### Admin ```text Login ↓ Dashboard ↓ Products / Orders ↓ Management ↓ Status Updates ``` --- ## 3. Architecture Blueprint ```text β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ React Frontend β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ↓ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ REST API β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ↓ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Node.js / Express β”‚ β”‚ Controllers β”‚ β”‚ Services β”‚ β”‚ Business Logic β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ↓ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ PostgreSQL β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ ↓ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Payment Provider β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` --- ## 4. Frontend Engineering Plan - Component-based React architecture - Centralized API communication - Clear loading/error/empty states - Responsive layouts - Accessible forms - Protected admin routes - Server-backed authorization --- ## 5. Backend Engineering Plan - Thin controllers - Service-layer business logic - Validated inputs - Repository/data-access separation where useful - Consistent error handling - Transactional order operations - Secure external integration handling --- ## 6. API Contract Core API groups: ```text /auth /products /cart /orders /payments /admin ``` Important protected operations must verify: ```text Authentication + Authorization + Resource Ownership ``` --- ## 7. Database & Data Model Core model: ```text User β”œβ”€β”€ Orders β”‚ └── OrderItems β”‚ └── Product β”‚ └── Payments ``` Database constraints and indexes should be designed around actual query patterns and business rules. --- ## 8. Authentication & Authorization Authentication identifies the user. Authorization determines whether that user can perform the requested action. Admin permissions must be enforced on the backend, not merely hidden in the frontend. --- ## 9. Security Assessment The most important security priority is **broken access control**, particularly cross-user order access. Other important controls include: - Input validation - Secure authentication - Payment security - Dependency scanning - Secret management - Sensitive-log prevention - Appropriate CSRF protection - Rate limiting where appropriate --- ## 10. Testing Strategy Minimum production-oriented test layers: ```text Unit ↓ Integration ↓ API ↓ E2E ↓ Security ↓ Regression ``` Critical workflow: ```text Login β†’ Product β†’ Cart β†’ Checkout β†’ Payment β†’ Order ``` must have automated coverage. --- ## 11. Performance & Scalability Plan Prioritize evidence-driven optimization: 1. Database query performance 2. API latency 3. Product listing scalability 4. Checkout latency 5. Frontend bundle/rendering performance Use pagination, indexing, caching, and asynchronous processing only where justified. --- ## 12. Reliability & Integration Strategy External payment services must be treated as unreliable dependencies. The system should handle: - Timeout - Failure - Duplicate requests - Unknown payment status - Provider rate limits - Webhook delays Idempotency should protect against duplicate side effects. --- ## 13. Observability Plan Production monitoring should cover: - Request latency - API errors - Authentication failures - Authorization failures - Payment failures - Order failures - Database health - External-service failures Sensitive payment credentials and user secrets must not appear in logs. --- ## 14. Deployment Strategy ```text Development ↓ Automated Tests ↓ Staging ↓ Validation ↓ Production ↓ Monitoring ``` Database migrations must be coordinated with application deployment and rollback strategy. --- ## 15. Implementation Roadmap **Priority 1 - Security** - Authentication - Authorization - Resource ownership - Input validation **Priority 2 - Core Commerce** - Products - Cart - Checkout - Orders - Payments **Priority 3 - Testing** - Unit - API - Integration - E2E - Security **Priority 4 - Production** - CI/CD - Monitoring - Logging - Health checks - Rollback procedures **Priority 5 - Optimization** - Database optimization - Caching - Frontend optimization - Scalability improvements --- # 🏁 Final Senior Web Application Engineering Blueprint ### βœ… Confirmed Facts - React frontend - Node.js/Express backend - PostgreSQL database - REST API architecture - E-commerce order workflow - Customer and administrator roles - Payment integration requirement ### πŸ“Œ Assumptions - REST architecture should remain. - PostgreSQL remains the database. - Payment provider supports secure server-side verification. - Existing application behavior should be preserved. ### 🧠 Technical Decisions - Keep modular monolithic architecture. - Enforce authorization server-side. - Use transactional database operations for critical workflows. - Use idempotency for retryable side effects. - Add automated regression coverage. - Use evidence-driven performance optimization. ### ⚠️ Risks - Payment duplication - Broken access control - Database inconsistency - External payment failures - Insufficient test coverage - Sensitive data exposure ### ❓ Unresolved Questions - Which payment provider? - Exact existing code structure? - Current authentication mechanism? - Inventory requirements? - Refund requirements? - Guest checkout? - Expected traffic volume? ### 🎯 Acceptance Criteria The application is ready for production evaluation when: - Customers can securely authenticate. - Customers can only access authorized resources. - Administrators can perform privileged operations. - Orders cannot be duplicated through retryable requests. - Payment status is verified reliably. - Database relationships remain consistent. - Critical workflows have automated tests. - Security controls have been validated. - Production errors are observable. - Deployment and rollback procedures are documented and tested. **Overall Engineering Direction:** ```text Requirements ↓ Validated User Flows ↓ Existing Architecture Assessment ↓ Secure Frontend ↓ Validated APIs ↓ Reliable Backend ↓ Consistent Database ↓ Authentication + Authorization ↓ Security Testing ↓ Performance Validation ↓ Observability ↓ CI/CD ↓ Production ``` This sample demonstrates the expected senior-engineering behavior: **do not invent missing codebase evidence, separate assumptions from facts, preserve existing architecture, enforce authorization server-side, and connect every major requirement to implementation, testing, and production operation.**
Claude

Senior Web Application Engineer

Add to Cart
Instant accessInstant access
Usage rightsCommercial use
Money-back guaranteeMoney‑back
By purchasing this prompt, you agree to our terms of service
CLAUDE-5-5-SONNET
Tested icon
Guide icon
4 examples icon
Free credits icon
Building a serious web application requires more than generating frontend code. Architecture, APIs, database design, authentication, authorization, validation, security, testing, performance, integrations, deployment, and production reliability all have to work together. Senior Web Application Engineer acts as a senior-level engineering partner across the complete web-application lifecycleβ€”from requirements and architecture to implementation, debugging, testing, optimization, and production rea
...more
Added 1 week ago
Report
Browse Marketplace