Nibblr Architecture
System architecture and technical overview of the Nibblr platform
System Overview
Platform Type
Nibblr is a restaurant discovery and review platform that connects users with restaurants, enabling them to browse menus, read reviews, and rate their dining experiences.
Key Features
- • Restaurant listings and profiles
- • Menu management and browsing
- • User reviews and ratings
- • User and restaurant analytics
- • Restaurant owner management
Technology Stack
Backend
- • Supabase (PostgreSQL)
- • Row Level Security (RLS)
- • Real-time Subscriptions
- • RESTful API
Frontend
- • Next.js 14+ (App Router)
- • React 18+
- • TypeScript
- • Tailwind CSS
Services
- • Supabase Auth
- • Supabase Storage
- • Analytics Service
- • Database Client
Database Schema
users
| Field | Type | Description |
|---|---|---|
| id | UUID | Primary key, references auth.users |
| TEXT | User email address | |
| full_name | TEXT | User's full name |
| user_type | TEXT | Type: 'restaurant' or 'user' |
| onboarding_complete | BOOLEAN | Onboarding status flag |
| created_at | TIMESTAMP | Account creation timestamp |
restaurants
| Field | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| name | TEXT | Restaurant name |
| address | TEXT | Restaurant address |
| cuisine_type | TEXT | Type of cuisine |
| rating | NUMERIC | Average rating from reviews |
| user_id | UUID | Restaurant owner (FK to users) |
| image_url | TEXT | Profile image URL |
menus
| Field | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| restaurant_id | UUID | Foreign key to restaurants |
| name | TEXT | Menu item name |
| description | TEXT | Menu item description |
| price | NUMERIC | Item price |
| category | TEXT | Menu category |
restaurant_reviews
| Field | Type | Description |
|---|---|---|
| id | UUID | Primary key |
| restaurant_id | UUID | Foreign key to restaurants |
| menu_id | UUID | Optional: specific menu item review |
| user_id | UUID | Reviewer (FK to users) |
| rating | NUMERIC | Rating (typically 1-5) |
| comment | TEXT | Review comment/feedback |
System Architecture
Client Layer
Next.js Frontend
- • Analytics Dashboard
- • User Management
- • Restaurant Management
- • Data Visualization
Service Layer
Analytics Service
- • Data Aggregation
- • Statistics Calculation
- • Time-based Queries
- • Analytics API
Data Layer
Supabase PostgreSQL
- • Users Table
- • Restaurants Table
- • Menus Table
- • Reviews Table
API Calls
Integration Architecture
CREO Dashboard ↔ Nibblr Database
The CREO dashboard connects to a separate Nibblr Supabase database for analytics and data management. This separation allows for independent scaling and management of the two systems.
Connection Method
- • Separate Supabase client instance
- • Environment variables for connection
- • Read-only access for analytics
- • RESTful API through Supabase
Data Flow
- • Query Nibblr database for analytics
- • Aggregate statistics and metrics
- • Display in CREO dashboard
- • Real-time data updates
Key Components
lib/services/nibblr-analytics.ts
Service layer for fetching analytics data, user stats, restaurant stats, and usage metrics.
lib/supabase/nibblr-client.ts
Dedicated Supabase client instance configured to connect to the Nibblr database.
app/(dashboard)/nibblr/
Dashboard pages for analytics, user management, and restaurant management.