ट्यूटोरियल

omnilude-tools को बनाने में इस्तेमाल हुए कुछ PRD दस्तावेज़

AAnonymous
10 मिनट पढ़ें

परिचय

omnilude-tools पर पिछली पोस्ट में मैंने बताया था कि उस प्रोजेक्ट की कई वास्तविक tools ठोस PRD दस्तावेज़ों से बनी थीं। इस पोस्ट में जो दस्तावेज़ साझा कर रहा हूँ, वह उनमें से एक है: Unix Timestamp Converter PRD.

यह दस्तावेज़ असली timestamp-converter tool बनाने के लिए पहले कोरियाई में लिखा गया था, और उसकी implementation के निशान आज भी src/app/[locale]/(tools)/developer/timestamp-converter/ पथ में मौजूद हैं। यानी यह कोई हल्का-फुल्का idea memo नहीं था। यह एक working document था जिसमें screen structure, state management, SEO, और test design एक साथ बंधे हुए थे।

इस पोस्ट में मैं तीन बातें खास तौर पर साफ़ करना चाहता हूँ।

  • यह दस्तावेज़ उन PRD में से एक है जिनका उपयोग पहले परिचित कराए गए omnilude-tools के वास्तविक tools बनाने में किया गया था।
  • यह prd-generator skill के अच्छे वास्तविक उपयोग का भी एक उदाहरण है।
  • मूल PRD कोरियाई में लिखा गया था, और इस पोस्ट में मैंने हर भाषा के पाठक के लिए पूरे दस्तावेज़ का अनुवाद उपलब्ध कराने पर ज़ोर दिया है।

यह टूल अब tools.omnilude.com/developer/timestamp-converter पर सीधे देखा जा सकता है।

संभव होता तो मैं इस PRD को बनाने में इस्तेमाल हुए prompt को भी साथ में साझा करना चाहता, लेकिन डिस्क स्पेस की सीमा के कारण मैंने session data हटा दिया था, इसलिए उसे यहाँ उपलब्ध नहीं करा पाने के लिए कृपया समझें।

मुख्य भाग

संक्षेप में कहूँ तो, इस दस्तावेज़ ने scope को इतना स्पष्ट कर दिया था कि implementer तुरंत काम शुरू कर सके।

  • क्या बनाना है: Unix timestamp और इंसान द्वारा पढ़ी जा सकने वाली तारीख़ के बीच दो-तरफ़ा conversion tool
  • कहाँ तक बनाना है: MVP, advanced features, timezone support, real-time current time, code snippets, calculator
  • कैसे बनाना है: file structure, Zustand state management, conversion utilities, SEO, tests, accessibility, performance requirements
  • कैसे validate करना है: unit tests, E2E tests, implementation checklist

जब दस्तावेज़ इस स्तर तक स्पष्ट हो, तो वास्तविक implementation काफी सरल हो जाती है। वास्तव में timestamp-converter page इसी तरह की structured guide पर बनाया गया था, और आज भी omnilude-tools में developer group के tool के रूप में मौजूद है।

यह दस्तावेज़ कोरियाई से अनुवादित है

इस पोस्ट का आधार एक कोरियाई PRD है। इसलिए हर भाषा में मैंने summary देने के बजाय पूरे दस्तावेज़ को पढ़ने योग्य रूप में अनुवाद करने को प्राथमिकता दी। PRD होने के बावजूद, मेरा मुख्य लक्ष्य technical context और वास्तविक implementation background को सुरक्षित रखना था।

PRD मूल पाठ

नीचे Unix Timestamp Converter PRD का सार्वजनिक पूर्ण पाठ दिया गया है।

PRD: Unix Timestamp Converter

मूल जानकारी

आइटममान
Tool IDtimestamp-converter
ग्रुपdeveloper
पथ/developer/timestamp-converter
प्राथमिकताP0 (अनिवार्य)
अनुमानित प्रयास1-2 दिन
स्थितिDraft

1. अवलोकन

1.1 उद्देश्य

ऐसा tool जो Unix timestamp और इंसान द्वारा पढ़ी जा सकने वाली तारीख़ के बीच दो-तरफ़ा conversion देता है।

1.2 लक्षित उपयोगकर्ता

  • Backend/Frontend developers
  • Data analysts
  • System administrators

1.3 प्रतियोगी विश्लेषण

साइटफायदेकमियाँ
epochconverter.comकई formats, code snippetsपुराना UI
unixtimestamp.comसरल UIसीमित features
timestamp-converter.comसाफ़ designसीमित timezone support

2. Functional requirements

2.1 मुख्य features (MVP)

F1: Timestamp → Date conversion

Typescript
Input: Unix timestamp (seconds/milliseconds/microseconds का automatic detection)
Output: कई date formats

Automatic detection logic:

Typescript
function detectTimestampUnit(value: number): 'seconds' | 'milliseconds' | 'microseconds' {
  if (value < 1e12) return 'seconds';       // < 10 digits
  if (value < 1e15) return 'milliseconds';  // 13 digits
  return 'microseconds';                    // 16 digits
}

Output formats:

  • ISO 8601: 2026-01-29T13:45:30.000Z
  • RFC 2822: Wed, 29 Jan 2026 13:45:30 +0000
  • Local format: 29 जनवरी 2026, रात 10:45:30
  • Relative time: 5 मिनट पहले, 3 दिन बाद

F2: Date → Timestamp conversion

Typescript
Input: date string या date picker
Output: Unix timestamp (seconds, milliseconds)

Supported input formats:

  • ISO 8601 string
  • Date/time picker (DatePicker)
  • Natural language (optional): now, yesterday, next week

F3: Timezone support

Typescript
Default: browser का local timezone
Options: UTC और प्रमुख शहरों के timezone selection

मुख्य timezone सूची:

Typescript
const TIMEZONES = [
  { value: 'UTC', label: 'UTC' },
  { value: 'Asia/Seoul', label: 'सियोल (KST, UTC+9)' },
  { value: 'Asia/Tokyo', label: 'टोक्यो (JST, UTC+9)' },
  { value: 'America/New_York', label: 'न्यूयॉर्क (EST/EDT, UTC-5/-4)' },
  { value: 'America/Los_Angeles', label: 'लॉस एंजेलिस (PST/PDT, UTC-8/-7)' },
  { value: 'Europe/London', label: 'लंदन (GMT/BST, UTC+0/+1)' },
  // ... और जोड़ें
];

F4: वर्तमान समय का real-time display

Typescript
स्क्रीन के ऊपर वर्तमान Unix timestamp को real time में दिखाना, हर 1 सेकंड पर update

2.2 Advanced features

F5: Code snippet generation

चुने गए timestamp के लिए कई programming languages में code snippets उपलब्ध कराना।

Typescript
const CODE_SNIPPETS = {
  javascript: (ts: number) => `new Date(${ts * 1000})`,
  python: (ts: number) => `datetime.fromtimestamp(${ts})`,
  java: (ts: number) => `Instant.ofEpochSecond(${ts}L)`,
  go: (ts: number) => `time.Unix(${ts}, 0)`,
  php: (ts: number) => `date('Y-m-d H:i:s', ${ts})`,
  ruby: (ts: number) => `Time.at(${ts})`,
  csharp: (ts: number) => `DateTimeOffset.FromUnixTimeSeconds(${ts})`,
};

F6: Timestamp calculator

Typescript
Base time + दिन/घंटा/मिनट/सेकंड = result timestamp
उदाहरण: अभी + 7 दिन = अगले सप्ताह का timestamp

3. UI/UX design

3.1 Layout

┌─────────────────────────────────────────────────────────────┐
│  वर्तमान Unix timestamp: 1738150800 (real-time update) [कॉपी] │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌─────────────────────┐  ┌─────────────────────────────┐  │
│  │  Input              │  │  Result                     │  │
│  │                     │  │                             │  │
│  │  [Timestamp input]  │  │  ISO 8601: ...     [कॉपी]   │  │
│  │  या                 │  │  RFC 2822: ...     [कॉपी]   │  │
│  │  [Date/time picker] │  │  Local: ...        [कॉपी]   │  │
│  │                     │  │  Relative: ...     [कॉपी]   │  │
│  │  Timezone: [▼]      │  │                             │  │
│  │                     │  │  Timestamp (s): ...         │  │
│  │  [Convert] [Clear]  │  │  Timestamp (ms): ...        │  │
│  └─────────────────────┘  └─────────────────────────────┘  │
│                                                             │
├─────────────────────────────────────────────────────────────┤
│  Code snippets                                              │
│  ┌─────────────────────────────────────────────────────┐   │
│  │  [JS] [Python] [Java] [Go] [PHP] [Ruby] [C#]        │   │
│  │  ─────────────────────────────────────────────────  │   │
│  │  new Date(1738150800000)                   [कॉपी]   │   │
│  └─────────────────────────────────────────────────────┘   │
│                                                             │
└─────────────────────────────────────────────────────────────┘

3.2 Responsive design

Desktop (lg+):

  • 2-column layout (input | result)

Tablet/Mobile (< lg):

  • 1-column layout (input ऊपर, result नीचे)

3.3 Interactions

  1. Real-time conversion: input पर automatic conversion (300ms debounce)
  2. Copy feedback: copy button click पर toast notification
  3. Keyboard shortcuts: Enter से convert, Ctrl+C से result copy

4. Technical specification

4.1 File structure

src/app/[locale]/(tools)/developer/timestamp-converter/
├── page.tsx                              # Page entry + SEO
├── _store/
│   └── timestamp-store.ts                # Zustand state management
└── _components/
    ├── timestamp-page.tsx                # Main client component
    ├── current-time-display.tsx          # Current time display
    ├── timestamp-input.tsx               # Input section
    ├── conversion-result.tsx             # Result section
    └── code-snippets.tsx                 # Code snippets section

4.2 State management (Zustand)

Typescript
// _store/timestamp-store.ts
import { create } from 'zustand';

type InputMode = 'timestamp' | 'datetime';

interface TimestampState {
  // Input
  inputMode: InputMode;
  timestampInput: string;
  dateInput: Date | null;
  timezone: string;

  // Result
  result: ConversionResult | null;

  // Code snippets
  selectedLanguage: string;

  // Actions
  setInputMode: (mode: InputMode) => void;
  setTimestampInput: (value: string) => void;
  setDateInput: (date: Date | null) => void;
  setTimezone: (tz: string) => void;
  setSelectedLanguage: (lang: string) => void;
  convert: () => void;
  clear: () => void;
}

interface ConversionResult {
  timestampSeconds: number;
  timestampMillis: number;
  iso8601: string;
  rfc2822: string;
  localFormat: string;
  relative: string;
}

export const useTimestampStore = create<TimestampState>((set, get) => ({
  inputMode: 'timestamp',
  timestampInput: '',
  dateInput: null,
  timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
  result: null,
  selectedLanguage: 'javascript',

  setInputMode: (mode) => set({ inputMode: mode }),
  setTimestampInput: (value) => set({ timestampInput: value }),
  setDateInput: (date) => set({ dateInput: date }),
  setTimezone: (tz) => set({ timezone: tz }),
  setSelectedLanguage: (lang) => set({ selectedLanguage: lang }),

  convert: () => {
    const { inputMode, timestampInput, dateInput, timezone } = get();
    // Conversion logic
  },

  clear: () => set({
    timestampInput: '',
    dateInput: null,
    result: null,
  }),
}));

4.3 Core conversion logic

Typescript
// lib/timestamp-utils.ts
import { format, formatDistanceToNow } from 'date-fns';
import { formatInTimeZone } from 'date-fns-tz';
import { ko, en, ja } from 'date-fns/locale';

export function convertTimestamp(
  timestamp: number,
  timezone: string,
  locale: string
): ConversionResult {
  // Unit auto detection
  const unit = detectTimestampUnit(timestamp);
  const timestampMs = unit === 'seconds'
    ? timestamp * 1000
    : unit === 'microseconds'
      ? Math.floor(timestamp / 1000)
      : timestamp;

  const date = new Date(timestampMs);
  const localeObj = { ko, en, ja }[locale] || ko;

  return {
    timestampSeconds: Math.floor(timestampMs / 1000),
    timestampMillis: timestampMs,
    iso8601: date.toISOString(),
    rfc2822: format(date, 'EEE, dd MMM yyyy HH:mm:ss xx', { locale: localeObj }),
    localFormat: formatInTimeZone(date, timezone, 'PPpp', { locale: localeObj }),
    relative: formatDistanceToNow(date, { addSuffix: true, locale: localeObj }),
  };
}

export function dateToTimestamp(date: Date): { seconds: number; millis: number } {
  const millis = date.getTime();
  return {
    seconds: Math.floor(millis / 1000),
    millis,
  };
}

4.4 Dependencies

JSON
{
  "dependencies": {
    "date-fns": "^3.x",
    "date-fns-tz": "^3.x"
  }
}

ये dependencies पहले से project में installed हैं।

5. Multilingual support

5.1 Translation keys

JSON
// messages/hi/tools/developer/timestamp-converter.json
{
  "tools": {
    "developer": {
      "timestampConverter": "टाइमस्टैम्प कन्वर्टर",
      "timestampConverterDesc": "Unix timestamp और date के बीच दो-तरफ़ा conversion करता है",
      "timestamp": {
        "currentTime": "वर्तमान Unix timestamp",
        "inputTimestamp": "Timestamp input",
        "inputDatetime": "Date/time input",
        "timezone": "Timezone",
        "convert": "Convert",
        "clear": "Clear",
        "copy": "Copy",
        "copied": "Copied",
        "results": "Conversion results",
        "iso8601": "ISO 8601",
        "rfc2822": "RFC 2822",
        "localFormat": "Local format",
        "relative": "Relative time",
        "timestampSeconds": "Timestamp (seconds)",
        "timestampMillis": "Timestamp (milliseconds)",
        "codeSnippets": "Code snippets",
        "invalidTimestamp": "अमान्य timestamp",
        "autoDetected": "Auto detected: {unit}"
      }
    }
  }
}

6. SEO metadata

Typescript
// page.tsx
export async function generateMetadata({ params }: Props): Promise<Metadata> {
  const { locale } = await params;
  const t = await getTranslations({ locale });

  return generateSeoMetadata({
    locale,
    title: t('tools.developer.timestampConverter'),
    description: t('tools.developer.timestampConverterDesc'),
    path: '/developer/timestamp-converter',
    keywords: [
      'unix timestamp',
      'epoch converter',
      'timestamp conversion',
      'date conversion',
      'timestamp to date',
      'date to timestamp',
    ],
  });
}

7. Test cases

7.1 Unit tests

Typescript
describe('detectTimestampUnit', () => {
  it('should detect seconds', () => {
    expect(detectTimestampUnit(1738150800)).toBe('seconds');
  });

  it('should detect milliseconds', () => {
    expect(detectTimestampUnit(1738150800000)).toBe('milliseconds');
  });

  it('should detect microseconds', () => {
    expect(detectTimestampUnit(1738150800000000)).toBe('microseconds');
  });
});

describe('convertTimestamp', () => {
  it('should convert timestamp to ISO 8601', () => {
    const result = convertTimestamp(1738150800, 'UTC', 'en');
    expect(result.iso8601).toBe('2025-01-29T09:00:00.000Z');
  });
});

7.2 E2E tests

Typescript
test('timestamp conversion flow', async ({ page }) => {
  await page.goto('/hi/developer/timestamp-converter');

  // Timestamp input
  await page.fill('[data-testid="timestamp-input"]', '1738150800');

  // Result check
  await expect(page.locator('[data-testid="iso8601-result"]'))
    .toContainText('2025-01-29');

  // Copy button click
  await page.click('[data-testid="copy-iso8601"]');
  await expect(page.locator('.toast')).toContainText('Copied');
});

8. Accessibility requirements

  • सभी input fields के लिए उचित label
  • Copy button पर aria-label
  • Keyboard navigation support
  • Screen reader compatibility

9. Performance requirements

  • Input के बाद result display: < 100ms
  • Current time update: हर सेकंड सटीक
  • Bundle size increase: < 5KB (gzip)

10. Implementation checklist

  • File structure बनाना
  • Zustand store implement करना
  • Conversion utility functions implement करना
  • Main page component implement करना
  • Current time display component
  • Input section component
  • Result section component
  • Code snippets section component
  • 7 भाषाओं के translation keys जोड़ना
  • tools.ts में tool register करना
  • Responsive styling
  • Accessibility review
  • Tests लिखना