PRD Template


name: template for detailed spec for a feature in the app. description: | A detailed specification for a feature in the app, including backend APIs, frontend screens, and user interactions. The specification should include a detailed description of the feature, its purpose, and its expected behavior. It'll be used in code generation to create the necessary backend and frontend code. This is the detailed implementation spec, different from be-specs.md or fe-specs.md which are high-level drafts.

IMPORTANT: Delete this section after completing the specification.

{{ NAME OF FEATURE }}

Overview

Constraints/Validations

Backend

Database Schema Updates

[Describe any database tables, columns, or relationships needed]

APIs

GET /api/{{ feature_name }}

operationId: list{{ feature_name_pascal_case }} description: Retrieves a list of items with optional filtering parameters:

response:

GET /api/{{ feature_name }}/{id}

operationId: get{{ feature_name_singular_pascal_case }} description: Retrieves a single item by ID parameters:

response:

POST /api/{{ feature_name }}

operationId: create{{ feature_name_singular_pascal_case }} description: Creates a new item payload:

response:

error_responses:

PUT /api/{{ feature_name }}/{id}

operationId: update{{ feature_name_singular_pascal_case }} description: Updates an existing item parameters:

response:

error_responses:

DELETE /api/{{ feature_name }}/{id}

operationId: delete{{ feature_name_singular_pascal_case }} description: Deletes an item parameters:

response:

error_responses:

Frontend

@type: CRUD | string basePath: /{{ feature_name }}

State Management

Screens

List

path: / description: The screen for listing all items

UI Components:

Behavior:

Create

path: /create description: The screen for creating a new item

UI Components:

Behavior:

Edit

path: /:id/edit description: The screen for editing an existing item

UI Components:

Behavior:

Detail

path: /:id description: The screen for viewing item details

UI Components:

Behavior:

Test Cases

Backend Test Cases

API Functionality Tests

  1. GET /api/{{ feature_name }}

    • Verify correct pagination with different page and limit parameters
    • Verify search functionality returns matching results
    • Test with empty database returns empty array
    • Test with unauthorized user returns 401
  2. GET /api/{{ feature_name }}/{id}

    • Test with valid ID returns correct item
    • Test with non-existent ID returns 404
    • Test with invalid ID format returns 400
    • Test with unauthorized user returns 401
  3. POST /api/{{ feature_name }}

    • Test with valid payload creates item correctly
    • Test with missing required fields returns validation error
    • Test with invalid data types returns validation error
    • Test size limits and other constraints
  4. PUT /api/{{ feature_name }}/{id}

    • Test with valid payload updates item correctly
    • Test with non-existent ID returns 404
    • Test with invalid payload returns validation error
    • Test partial updates work correctly
  5. DELETE /api/{{ feature_name }}/{id}

    • Test successful deletion removes item from database
    • Test with non-existent ID returns 404
    • Test with unauthorized user returns 401

Integration Tests

Frontend Test Cases

Component Tests

  1. List View

    • Verify data loads and displays correctly
    • Test pagination controls work
    • Test search functionality filters results
    • Test loading and error states display correctly
    • Verify sorting works correctly if implemented
  2. Create Form

    • Verify form validation for required fields
    • Test error message display for invalid inputs
    • Test submission with valid data creates item
    • Test cancel button works correctly
  3. Edit Form

    • Verify form loads with correct pre-filled data
    • Test validation works for field updates
    • Test submission with valid data updates item
    • Test cancellation doesn't change data
  4. Detail View

    • Verify all data displays correctly
    • Test loading and error states
    • Test navigation to edit screen works

User Flow Tests

Edge Case Tests