A modern, type-safe review site built with React and TypeScript. This project fetches content from Strapi 5 using GraphQL for optimized data delivery.
react-strapi-graphql-site/
βββ backend/ # Strapi 5 headless CMS
β βββ config/
β β βββ admin.ts # Admin panel configuration
β β βββ api.ts # API configuration
β β βββ database.ts # Database connection settings
β β βββ middlewares.ts # Middleware configuration
β β βββ plugins.ts # Plugin configuration
β β βββ server.ts # Server configuration
β βββ src/
β β βββ api/
β β β βββ review/ # Review content type
β β β βββ content-types/
β β β β βββ review/schema.json
β β β βββ controllers/review.ts
β β β βββ routes/review.ts
β β β βββ services/review.ts
β β βββ admin/ # Admin panel customization
β β βββ extensions/ # Strapi extensions
β β βββ index.ts # Entry point
β βββ types/
β β βββ generated/ # Auto-generated TypeScript types
β βββ public/
β β βββ robots.txt
β β βββ uploads/ # Media uploads
β βββ database/
β β βββ migrations/ # Database migrations
β βββ package.json
β βββ tsconfig.json
β βββ .env # Environment variables
β
βββ frontend/ # React + TypeScript frontend
β βββ public/
β β βββ index.html
β β βββ manifest.json
β β βββ robots.txt
β βββ src/
β β βββ graphql/
β β β βββ queries.ts # Centralized GraphQL query definitions
β β βββ types/
β β β βββ review.ts # TypeScript interfaces for Review data
β β βββ pages/
β β β βββ Homepage.tsx # Review listing with content snippets
β β β βββ ReviewDetails.tsx # Full review view by documentId
β β βββ components/
β β β βββ SiteHeader.tsx # Reusable header component
β β βββ hooks/
β β β βββ useFetch.ts # Utility for standard REST fetching
β β βββ App.tsx # Root component
β β βββ index.tsx # Apollo Client and Provider configuration
β β βββ index.css # Global styles
β β βββ setupTests.ts # Test configuration
β βββ package.json
β βββ tsconfig.json
β βββ tailwind.config.js # Tailwind CSS configuration
β βββ postcss.config.js # PostCSS configuration
β βββ .env # Environment variables
β
βββ README.md
- Strapi 5 Document Service: Uses
documentIdfor stable, SEO-friendly routing. - Apollo Client Integration: Efficient data fetching with built-in caching.
- Type-Safe Schema: Full TypeScript support for Strapi's "Blocks" (JSON) content.
- GraphQL API: Requests only the fields required, reducing payload size.
- Frontend: React, TypeScript, React Router 6, Tailwind CSS
- API Client: Apollo Client (GraphQL)
- Backend: Strapi 5
- Content: Strapi Blocks (Rich Text)
- Ensure you have the GraphQL plugin installed in your Strapi directory:
npm install @strapi/plugin-graphql
- Run the develop server:
npm run develop
- Permissions: In the Strapi Admin, go to
Settings > Roles > Public. Enable find and findOne for the Review collection.
- Install dependencies:
npm install
- Start the development server:
npm start
The project interacts with the following Review schema:
| Field | Type | Description |
|---|---|---|
documentId |
ID! | The unique identifier for the document. |
title |
String! | Review title. |
rating |
Int! | Numeric score. |
body |
JSON! | Strapi Blocks rich text data. |
Data is fetched using the following query structure in src/graphql/queries.ts:
query GetReviews {
reviews {
documentId
title
rating
body
}
}npm start: Runs the app in development mode.npm run build: Optimizes the app for production.npm test: Launches the test runner.
Distributed under the MIT License.

