A full-stack web application for service reviews, inspired by TrustPilot.
- View and filter service listings
- Read reviews for services
- Submit reviews with ratings and optional images
- User authentication with email/password
- Admin panel for review moderation
- Framework: Next.js 14 with App Router
- Language: TypeScript
- UI Library: Material-UI (MUI)
- Authentication: Firebase Authentication
- Database: Firestore
- Storage: Firebase Storage
- Node.js 18+ and npm/yarn
- Firebase account
- Clone the repository:
git clone https://github.com/your-username/trust-pilot-project.git
cd trust-pilot-project- Install dependencies:
npm install
# or
yarn-
Set up Firebase:
- Create a new Firebase project at Firebase Console
- Enable Authentication with Email/Password provider
- Create a Firestore database
- Enable Storage
- Get your Firebase configuration from Project Settings > General > Your apps > Firebase SDK snippet > Config
-
Set up environment variables:
- Copy
.env.local.exampleto.env.local - Fill in your Firebase configuration values
- Copy
cp .env.local.example .env.local- Run the development server:
npm run dev
# or
yarn dev- Open http://localhost:3000 in your browser.
For Firestore:
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /users/{userId} {
allow read: if request.auth != null;
allow write: if request.auth != null && request.auth.uid == userId;
}
match /services/{serviceId} {
allow read: if true;
allow write: if request.auth != null && get(/databases/$(database)/documents/users/$(request.auth.uid)).data.role == 'admin';
}
match /reviews/{reviewId} {
allow read: if true;
allow create: if request.auth != null;
allow update, delete: if request.auth != null && get(/databases/$(database)/documents/users/$(request.auth.uid)).data.role == 'admin';
}
}
}
For Storage:
rules_version = '2';
service firebase.storage {
match /b/{bucket}/o {
match /reviews/{fileName} {
allow read: if true;
allow write: if request.auth != null && request.resource.size < 5 * 1024 * 1024 && request.resource.contentType.matches('image/.*');
}
}
}
After registering a user, manually update the user's role in Firestore to make them an admin:
- Go to Firestore in Firebase Console
- Find the user document in the
userscollection - Update the
rolefield to"admin"
/app: Next.js App Router pages and layout/components: Reusable UI components/lib: Firebase configuration and helper functions/types: TypeScript type definitions
This project is licensed under the MIT License - see the LICENSE file for details.
- Next.js
- Material-UI
- Firebase
- TrustPilot for inspiration