Skip to content

feat: refocus landing page and API docs on API product - #18

Merged
rekabytes merged 1 commit into
mainfrom
dev
Dec 26, 2025
Merged

feat: refocus landing page and API docs on API product#18
rekabytes merged 1 commit into
mainfrom
dev

Conversation

@rekabytes

@rekabytes rekabytes commented Dec 26, 2025

Copy link
Copy Markdown
Owner

Landing Page:

  • Update Hero with API-focused headline and documentation CTA
  • Update Features section with API capabilities (REST API, Halal Certified, etc)
  • Update Problem/Solution for developer pain points
  • Update How It Works with API integration steps
  • Update final CTA to promote API access

API Docs:

  • Replace curl examples with Get Your API Key banner
  • Add editable input field for Try it feature
  • Add demo API key support via NEXT_PUBLIC_DEMO_API_KEY
  • Add X-API-Key header to Try it requests
  • Clean up unused curl examples code

📝 Description

Brief description of what this PR does.

🔗 Related Issue

Fixes #(issue number)

🏷️ Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🧹 Code refactoring (no functional changes)
  • 🧪 Test update (adding or updating tests)

✅ Checklist

  • I have read the Contributing Guidelines
  • My branch is created from dev (not main)
  • I have run pnpm lint:fix
  • I have run pnpm typecheck
  • I have tested my changes locally
  • My code follows the project's coding standards
  • I have updated documentation (if applicable)

📸 Screenshots (if applicable)

Add screenshots to help explain your changes.

🧪 How to Test

Steps to test this PR:

  1. ...
  2. ...
  3. ...

📝 Additional Notes

Any additional information reviewers should know.

Summary by CodeRabbit

Release Notes

  • New Features

    • Demo API key support for interactive endpoint testing
    • Customizable per-endpoint try URLs within API documentation
    • Sign-in banner for API key access on documentation pages
  • Changes

    • Removed static cURL examples from API documentation
    • Landing page repositioned with API features, integration steps, and developer-focused messaging

✏️ Tip: You can customize this high-level summary in your review settings.

Landing Page:
- Update Hero with API-focused headline and documentation CTA
- Update Features section with API capabilities (REST API, Halal Certified, etc)
- Update Problem/Solution for developer pain points
- Update How It Works with API integration steps
- Update final CTA to promote API access

API Docs:
- Replace curl examples with Get Your API Key banner
- Add editable input field for Try it feature
- Add demo API key support via NEXT_PUBLIC_DEMO_API_KEY
- Add X-API-Key header to Try it requests
- Clean up unused curl examples code
@coderabbitai

coderabbitai Bot commented Dec 26, 2025

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This pull request transitions the frontend from a consumer nutrition-tracking application to a developer-focused API platform. Changes include enabling demo API key functionality for interactive "Try it" features in the API docs, reworking the API documentation UI, and rebranding all landing page components with API-centric messaging, icons, and navigation targets.

Changes

Cohort / File(s) Summary
API Documentation Try-It Feature
packages/kal-frontend/.env.example, packages/kal-frontend/src/app/api-docs/client.tsx, packages/kal-frontend/src/app/api-docs/page.tsx
Added NEXT_PUBLIC_DEMO_API_KEY environment variable. Introduced per-endpoint try URL state management with getDemoApiKey() function to fetch demo key from browser env. Modified tryEndpoint to include X-API-Key header when demo key available. Replaced static code block with input field and Run button bound to per-endpoint URL. Removed curlExamples prop and CurlExample type. Introduced "Get Your API Key" banner replacing cURL examples section with sign-in encouragement adapted for authentication state.
Landing Page Call-to-Action
packages/kal-frontend/src/components/landing/CTA.tsx
Updated heading, description, and button label/href to focus on API adoption. Changed primary CTA from "Search Foods Now" (href="/search") to "Get Started with the API" (href="/api-docs").
Landing Page Features
packages/kal-frontend/src/components/landing/Features.tsx
Swapped react-feather icons (BarChart2, Sliders, Smartphone, Unlock, etc.) to new set (Check, Code, Database, Globe, Lock, Zap). Updated all feature titles and descriptions from nutrition-tracking focus to API-centric benefits. Changed subtitle to reflect API integration messaging.
Landing Page Hero
packages/kal-frontend/src/components/landing/Hero.tsx
Replaced headline to "Malaysian Food Nutrition API"; updated stats to API-focused metrics ("100+ Malaysian Foods", "<50ms" response time). Changed primary CTA to link to /api-docs with "View API Documentation" label; secondary CTA now "Try Food Search" linking to /search.
Landing Page How-It-Works
packages/kal-frontend/src/components/landing/HowItWorks.tsx
Updated icons from Search/BarChart2/CheckCircle to Key/Code/Zap. Reframed three-step workflow from nutrition tracking ("Search"→"View"→"Track") to API integration ("Get Your API Key"→"Make API Calls"→"Build Your App"). Updated step descriptions to reflect developer-oriented actions.
Landing Page Problem-Solution
packages/kal-frontend/src/components/landing/ProblemSolution.tsx
Updated all problem/solution statement pairs from nutrition-tracking context to developer/API context (e.g., "Confusing nutrition labels" → "Scattered food data sources"). Changed section heading from "Calorie tracking shouldn't be complicated" to "Building a food app shouldn't be hard" with updated subtitle for developer audience.

Sequence Diagram(s)

sequenceDiagram
    participant User as User (Browser)
    participant UI as API Docs UI
    participant Client as client.tsx
    participant Env as Browser Env
    participant API as API Endpoint

    User->>UI: Click Run button for endpoint
    activate UI
    UI->>Client: tryEndpoint(endpointId, try URL)
    deactivate UI
    
    activate Client
    Client->>Env: getDemoApiKey()
    activate Env
    Env-->>Client: demo-api-key-value
    deactivate Env
    
    rect rgb(220, 240, 220)
    Note over Client,API: Prepare authenticated request
    Client->>Client: Build headers<br/>with X-API-Key
    end
    
    Client->>API: POST/GET with X-API-Key header
    activate API
    API-->>Client: response data
    deactivate API
    
    Client-->>UI: Display response
    deactivate Client
    
    UI->>UI: Render result in UI
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Hopping from snacks to REST calls divine,
Kal hops forward—a platform so fine!
Demo keys dance, endpoints align,
Developers feast on data so mine! 🍽️💻

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately captures the main objective: refocusing the landing page and API documentation on the API product rather than the food search/nutrition tracking feature.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/kal-frontend/src/app/api-docs/client.tsx (1)

393-396: Correct the API authentication requirement statement.

The message at line 396 is inaccurate. All endpoints require API key authentication via the X-API-Key header (enforced by validateApiKeyMiddleware in the backend). The current message stating "All endpoints are public and require no authentication" contradicts both the actual implementation and the banner below that prompts users to sign in for an API key.

Update line 396 to:

-All endpoints are public and require no authentication.
+All endpoints require authentication via a free API key. Sign in to get started.
🧹 Nitpick comments (2)
packages/kal-frontend/.env.example (1)

3-3: Document that the demo API key is publicly exposed.

Since NEXT_PUBLIC_DEMO_API_KEY uses the NEXT_PUBLIC_ prefix, it will be exposed in the browser bundle. Ensure this key has appropriate rate limits and consider adding a comment in the .env.example file to clarify that this is a public demo key.

💡 Suggested documentation addition
 # API
 NEXT_PUBLIC_API_URL=http://localhost:4000
+# Demo API key for "Try it" feature (publicly exposed in browser)
 NEXT_PUBLIC_DEMO_API_KEY=your-demo-api-key-for-try-it-feature
packages/kal-frontend/src/app/api-docs/client.tsx (1)

264-278: Consider adding URL validation for better UX.

The editable input field for "Try it" URLs has no validation. While this is acceptable for a developer tool, consider adding basic validation (e.g., checking if the URL starts with /api/) or showing a warning for potentially invalid URLs to improve the user experience.

💡 Example validation approach
 <input
   type="text"
   value={getTryUrl(endpoint.id, endpoint.example)}
   onChange={(e) => setTryUrl(endpoint.id, e.target.value)}
   className="flex-1 bg-[#0a0a0a] border border-[#262626] rounded-lg px-3 py-2 font-mono text-sm text-[#a3a3a3] focus:outline-none focus:border-[#10b981] transition-colors"
   placeholder={endpoint.example}
+  pattern="/api/.*"
+  title="URL must start with /api/"
 />
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8842793 and 7c3e51f.

📒 Files selected for processing (8)
  • packages/kal-frontend/.env.example
  • packages/kal-frontend/src/app/api-docs/client.tsx
  • packages/kal-frontend/src/app/api-docs/page.tsx
  • packages/kal-frontend/src/components/landing/CTA.tsx
  • packages/kal-frontend/src/components/landing/Features.tsx
  • packages/kal-frontend/src/components/landing/Hero.tsx
  • packages/kal-frontend/src/components/landing/HowItWorks.tsx
  • packages/kal-frontend/src/components/landing/ProblemSolution.tsx
💤 Files with no reviewable changes (1)
  • packages/kal-frontend/src/app/api-docs/page.tsx
🧰 Additional context used
🧬 Code graph analysis (3)
packages/kal-frontend/src/components/landing/ProblemSolution.tsx (2)
packages/kal-frontend/src/components/ui/Container.tsx (1)
  • Container (7-24)
packages/kal-frontend/src/components/ui/SectionHeading.tsx (1)
  • SectionHeading (8-26)
packages/kal-frontend/src/components/landing/CTA.tsx (1)
packages/kal-frontend/src/components/ui/Button.tsx (1)
  • Button (12-53)
packages/kal-frontend/src/components/landing/Hero.tsx (1)
packages/kal-frontend/src/components/ui/Button.tsx (1)
  • Button (12-53)
🔇 Additional comments (10)
packages/kal-frontend/src/components/landing/HowItWorks.tsx (1)

3-27: LGTM! Clean transition to API-focused workflow.

The updated steps clearly communicate the API integration process. The icon changes (Key, Code, Zap) are semantic and align well with the new messaging.

packages/kal-frontend/src/components/landing/Hero.tsx (2)

4-8: LGTM! Stats effectively communicate API value proposition.

The updated stats ("100+ Malaysian Foods", "Free API Access", "<50ms Response Time") clearly convey the API's capabilities and performance.


25-45: LGTM! CTA hierarchy properly guides users.

The primary CTA now routes to /api-docs for documentation, while the secondary CTA allows users to try the search interface. This creates a clear path for both API integration and casual exploration.

packages/kal-frontend/src/components/landing/Features.tsx (1)

8-39: LGTM! Feature set effectively targets API developers.

The updated features clearly communicate API capabilities (Fast REST API, Rich Food Data, Simple Integration, etc.) while highlighting unique value propositions like JAKIM halal certification. The icon choices are semantic and appropriate.

packages/kal-frontend/src/components/landing/ProblemSolution.tsx (1)

4-25: LGTM! Problem/solution framing resonates with developer audience.

The updated content effectively articulates developer pain points (scattered data sources, missing Malaysian-specific info, complex integrations) and presents the API as a clear solution (unified REST API, authentic Malaysian foods, simple JSON responses).

packages/kal-frontend/src/app/api-docs/client.tsx (4)

18-24: LGTM! Browser-only check is appropriate.

The getDemoApiKey function correctly checks for browser environment before accessing process.env. This prevents SSR/build-time issues.


151-167: LGTM! Per-endpoint URL management is well-structured.

The addition of tryUrls state and helper functions (getTryUrl, setTryUrl) enables users to customize the "Try it" URL for each endpoint independently. The use of the nullish coalescing operator (??) for fallback is appropriate.


169-192: LGTM! Conditional API key header is correctly implemented.

The tryEndpoint function properly includes the X-API-Key header only when a demo key is available. Error handling is appropriate for the "Try it" feature.


151-151: All callers have been properly updated. The single APIDocsClient usage in packages/kal-frontend/src/app/api-docs/page.tsx passes only the four expected props (isAuthenticated, userEmail, onSignIn, onSignOut) and does not reference the removed curlExamples prop. No remaining references to curlExamples exist in the codebase.

packages/kal-frontend/src/components/landing/CTA.tsx (1)

9-20: LGTM! Final CTA reinforces API-first positioning.

The updated CTA ("Ready to build?", "Get Started with the API") creates a clear call-to-action for developers and routes appropriately to /api-docs, maintaining consistency with the Hero section's primary CTA.

@rekabytes
rekabytes merged commit 5299c0e into main Dec 26, 2025
7 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jan 13, 2026
Merged
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant