Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 66 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,72 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Supported Versions

Active full support: 1.9.7 (latest). Security maintenance (critical fixes only): 1.1.0. All versions < 1.1.0 are End of Security Support (EoSS). See `SECURITY.md` for the evolving support policy.
Active full support: 2.0.3 (latest). Security maintenance (critical fixes only): 1.1.0. All versions < 1.1.0 are End of Security Support (EoSS). See `SECURITY.md` for the evolving support policy.

## [2.0.3] - 2026-03-11

### Fixed

- **Cloudflare Pages Build Error** (`app/genres/[slug]/page.tsx`, `app/stories/[id]/page.tsx`): Fixed `Invalid prerender config` and `routes were not configured to run with the Edge Runtime` errors by explicitly exporting `runtime = 'edge'` and removing conflicting static configs.

## [2.0.2] - 2026-03-11

### Fixed

- **Supabase URL** (`lib/supabase/client.ts`, `lib/supabase/server.ts`): Replaced `dummy.supabase.co` fallback with actual project URL — fixes `ERR_NAME_NOT_RESOLVED` for all engagement/vote/comment queries.
- **TTS Endpoint 404** (`hooks/use-tts.ts`, `app/api/tts/generate/route.ts`, `app/api/tts/audio/route.ts`): Created local Next.js API routes for TTS generation via Sarvam API, replacing non-existent backend endpoints (`/api/v1/tts/generate` and `/api/v1/tts/audio`).
- **Hydration Mismatch** (`app/stories/[id]/page.tsx`): Changed page from `force-static` with `generateStaticParams` to `force-dynamic`, eliminating server/client rendering inconsistencies.
- **Hydration Warnings** (`app/layout.tsx`): Added `suppressHydrationWarning` to the `<body>` tag to prevent errors caused by the theme provider and external scripts modifying body attributes before Next.js hydrates.
- **Supabase SSR Client** (`lib/supabase/server.ts`, `lib/feedService.ts`, `lib/royalty-service.ts`): Refactored `createClient` to be asynchronous (`await cookies()`) and use `getAll()`/`setAll()` to comply with Next.js 15+ and the latest `@supabase/ssr` library requirements.
- **TTS Dropdown Clipping** (`components/book-view.tsx`): Removed `overflow-hidden` from the audio bar's root container so the speaker/language settings popups are no longer clipped when opened inside the story view.

## [2.0.1] - 2026-03-11

### Changed

- **Interactive Book Preview** (`components/book-view.tsx`): Complete rebuild — the story reader is now a page-flipping book with paragraph-aware pagination, keyboard navigation (←/→/Space), amber parchment color scheme, drop-cap on first paragraphs, running headers (title + author), page numbers, and chapter tabs.
- **Story Page Layout** (`app/stories/[id]/client.tsx`): Fixed element collisions — removed overlapping hero cover, added sticky header bar with back nav/genre/stats, centered title section, clean separation between book, TTS bar, and engagement sections.
- **Book Style Overrides** (`app/globals.css`): Added page-flip keyframe animations and scoped CSS resets to prevent comic global styles (uppercase headings, font-weight 600) from corrupting the book's serif typography.

## [2.0.0] - 2026-03-11

### Added

- **Clickable Gallery Cards** (`app/gallery/page.tsx`): Gallery story cards are now wrapped with `Link` components — clicking a card navigates to `/stories/{id}` with a smooth scale-up hover animation.
- **Story Engagement System** (`components/story-engagement.tsx`): New component on the story detail page with Reddit-style upvote/downvote, comment section (post + threaded display with avatars), and save/bookmark functionality.
- **Database Tables**: Created `story_comments`, `story_votes`, `saved_stories` tables with full RLS policies (public read, authenticated write, owner-based update/delete).
- **Analytics Warehouse**: Configured Supabase S3/Iceberg analytics warehouse (`analytics-groqtales`) with engagement summary view (`analytics.story_engagement_summary`).

### Fixed

- **`user_settings` 406 Error**: Added `service_role` bypass RLS policy to fix REST API queries failing due to missing authenticated session context.
- **Story Page Navigation**: Back button now points to `/gallery` instead of `/marketplace`.

## [1.9.9] - 2026-03-11

### Added

- **WalletConnect Integration** (`components/wallet-connect.tsx`): WalletConnect v2 is now fully functional — users can connect via the QR modal using any WalletConnect-compatible mobile or desktop wallet. Implements full signature-based authentication flow with backend token issuance.
- **Supabase Storage Buckets**: Created 4 storage buckets (`avatars`, `story-covers`, `comic-panels`, `nft-metadata`) with appropriate file size limits, MIME type restrictions, and Row Level Security policies (public read, authenticated upload, owner-based update/delete).
- **Footer Status Page Link** (`components/footer.tsx`): System health indicator in the footer now links to the public [UptimeRobot Status Page](https://stats.uptimerobot.com/PUi1I3YaBH) with hover effects and external link icon.
- **`@walletconnect/ethereum-provider`** dependency added to `package.json`.

### Fixed

- **Authentication Token Persistence** (`components/auth/sign-in-form.tsx`, `components/auth/sign-up-form.tsx`, `app/auth/callback/page.tsx`): **Critical fix** — all three authentication flows (email/password login, email signup, Google OAuth callback) now correctly persist `accessToken` and `refreshToken` to `localStorage` and dispatch `StorageEvent`. Previously, tokens returned from the backend were discarded, causing dashboard and profile pages to always show "Not Logged In".
- **Post-Login Redirect**: Sign-in form now redirects to `/dashboard` instead of `/` after successful authentication.

### Changed

- **README.md**: Updated project description, tech stack (Gemini AI, Alchemy, Supabase Storage, WalletConnect, Sarvam TTS), architecture diagram, Quick Start guide, and added uptime monitoring link.

## [1.9.8] - 2026-03-11

### Fixed

- **"System Offline" False Alarm** (`components/footer.tsx`, `hooks/use-system-health.ts`): The backend `/api/health` returns `status: 'operational'` but the footer and system health hook only accepted `'ok'` or `'healthy'`, causing the website to permanently display "System Offline" despite an operational backend. Now accepts `'operational'` and `'partial'` alongside existing values.
- **AI Endpoint 404** (`lib/api-client.ts`, `lib/gemini-service.ts`): Frontend AI calls (`processAI()` and `GeminiService.generateProse()`) sent `POST /api/v1/ai` but the backend only mounts sub-routes at `/api/v1/ai/generate` and `/api/v1/ai/analyze` — no root handler exists. Changed both callers to use `/api/v1/ai/generate`.
- **Repeated 401 Console Errors** (`lib/feeds-client.ts`): `fetchNotifications()` was calling the auth-required `/api/feeds/notifications/me` endpoint even when no access token was present in `localStorage`, producing repeated `401 Unauthorized` console errors. Added an early-return guard that skips the request when no token is available.

## [1.9.7] - 2026-03-10

Expand Down
19 changes: 12 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ You can contribute in several ways:
- **Reporting Bugs:** Use the `bug_report.md` template and provide detailed steps to reproduce.
- **Suggesting Features:** Use the `feature.md` template to propose new ideas.
- **Code Contributions:** Pick up issues labeled `good first issue`.
- **Web3/Blockchain:** Use the `web3_issue.md` template for Monad/NFT-related contributions.
- **Web3/Blockchain:** Use the `web3_issue.md` template for Ethereum/NFT-related contributions.
- **Security:** Use the `security.md` template for vulnerabilities.
- **Documentation:** Help improve the README, Wiki, or code comments.

Expand Down Expand Up @@ -129,8 +129,13 @@ To get started with development:
3. **Environment Variables:**
Copy `.env.example` to `.env.local` and fill in:
* `GROQ_API_KEY` – Groq AI key (required)
* `MONAD_RPC_URL` – Monad blockchain endpoint
* `UNSPLASH_API_KEY` – (Optional) for placeholder visuals
* `GEMINI_API_KEY` – Google Gemini AI key (required)
* `NEXT_PUBLIC_SUPABASE_URL` – Supabase project URL
* `NEXT_PUBLIC_SUPABASE_ANON_KEY` – Supabase anon key
* `SUPABASE_SERVICE_ROLE_KEY` – Supabase service role key
* `ALCHEMY_ETH_MAINNET_HTTP_URL` – Alchemy Ethereum RPC (for NFT minting)
* `SARVAM_API_KEY` – Sarvam AI TTS key (optional, for audiobook narration)
* `NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID` – WalletConnect project ID (optional)

4. **Run Development Server:**
```bash
Expand Down Expand Up @@ -174,10 +179,10 @@ GroqTales/
## Architecture Notes

- **Frontend:** Built with Next.js, React, TailwindCSS, and shadcn/ui for a modern, responsive UI.
- **Backend:** Node.js API routes handle authentication, story generation, and blockchain interactions.
- **Blockchain:** Monad SDK and Solidity smart contracts manage NFT minting and ownership.
- **AI:** Groq API powers story and comic generation.
- **Database:** MongoDB stores user data, stories, and metadata.
- **Backend:** Node.js + Express.js API handles authentication, story generation, TTS, and blockchain interactions.
- **Blockchain:** Ethereum Mainnet via Alchemy and Solidity smart contracts manage NFT minting and ownership.
- **AI:** Google Gemini (chairman model) + Groq LPU (narrow tasks) + Sarvam AI (TTS audiobook narration).
- **Database & Storage:** Supabase (PostgreSQL) with Row Level Security, Supabase Storage (avatars, story-covers, comic-panels, nft-metadata).
- **Testing:** Jest/React Testing Library for frontend; Hardhat/Foundry for smart contracts.

---
Expand Down
30 changes: 20 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,39 @@
# syntax=docker/dockerfile:1

ARG NODE_VERSION=22
FROM node:${NODE_VERSION}-bookworm as base
FROM node:${NODE_VERSION}-bookworm AS base

WORKDIR /usr/src/app

################################################################################
FROM base as deps
# Install dependencies
################################################################################
FROM base AS deps

RUN --mount=type=bind,source=package.json,target=package.json \
--mount=type=bind,source=package-lock.json,target=package-lock.json \
--mount=type=cache,target=/root/.npm \
npm ci

################################################################################
FROM deps as build
# Build the application
################################################################################
FROM deps AS build

ENV MONGODB_URI="mongodb://mongo:27017/groqtales"
ENV NEXT_PUBLIC_RPC_URL="http://anvil:8545"
# Build-time env vars (no secrets — those come from runtime)
ENV NEXT_TELEMETRY_DISABLED=1
ENV NEXT_IGNORE_TYPE_ERRORS=1
ENV NEXT_PUBLIC_BUILD_MODE=true

COPY . .
RUN npm run build

################################################################################
FROM base as final
# Production image
################################################################################
FROM base AS final

ENV NODE_ENV development
ENV MONGODB_URI="mongodb://mongo:27017/groqtales"
ENV NEXT_PUBLIC_RPC_URL="http://anvil:8545"
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1

USER node
Expand All @@ -42,7 +46,13 @@ COPY --chown=node:node --from=build /usr/src/app/server ./server
COPY --chown=node:node --from=build /usr/src/app/scripts ./scripts
COPY --chown=node:node --from=build /usr/src/app/next.config.js ./next.config.js

# Frontend (Next.js)
EXPOSE 3000
# Backend API (Express)
EXPOSE 3001

CMD npm start
# Health check — uses the lightweight liveness probe
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD curl -fs http://localhost:3001/healthz || exit 1

CMD ["npm", "start"]
Loading
Loading