diff --git a/ReadMe.md b/ReadMe.md index 785279b6..d9ea28ee 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1,16 +1,19 @@ -# ๐Ÿฝ๏ธ Restroly - Digital Menu & Restaurant Management Platform -
+# ๐Ÿฝ๏ธ Restroly +### Digital Menu & Restaurant Management Platform + [![MIT License](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](CONTRIBUTING.md) [![GSSOC](https://img.shields.io/badge/GSSOC-2026-blue.svg)](https://gssoc.girlscript.tech/) [![Java](https://img.shields.io/badge/Java-21-orange.svg)](#-prerequisites) [![React](https://img.shields.io/badge/React-18+-blue.svg)](#-prerequisites) +[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-14+-336791.svg)](#-prerequisites) +[![Gradle](https://img.shields.io/badge/Gradle-8.0+-02303A.svg)](#-prerequisites) **Empowering Indian Restaurants to Go Digital โ€” Simple, Fast & Powerful!** -[Features](#-features) โ€ข [Quick Start](#-quick-start) โ€ข [Docs](#-documentation) โ€ข [Contributing](#-contributing) โ€ข [Contact](#-contact--support) +[Features](#-features) โ€ข [Quick Start](#-quick-start) โ€ข [Architecture](#-architecture) โ€ข [API Docs](#-api-documentation) โ€ข [Contributing](#-contributing) โ€ข [Contact](#-contact--support)
@@ -23,8 +26,7 @@ - [Tech Stack](#-tech-stack) - [Prerequisites](#-prerequisites) - [Quick Start](#-quick-start) - - [Backend Setup](#backend-setup) - - [Frontend Setup](#frontend-setup) +- [Architecture](#-architecture) - [Project Structure](#-project-structure) - [API Documentation](#-api-documentation) - [Contributing](#-contributing) @@ -37,107 +39,108 @@ ## ๐ŸŽฏ About -**Restroly** is a comprehensive digital solution designed specifically for Indian restaurants. From street-side dhabas to fine dining establishments, Restroly helps restaurants create digital menus, accept payments, manage orders, and build their online presence with minimal effort. +**Restroly** is a comprehensive digital solution built specifically for Indian restaurants โ€” from street-side dhabas to fine dining establishments. It helps restaurants create digital menus, accept UPI payments, manage orders, and build an online presence with minimal effort and zero technical expertise required. ### Why Restroly? -| Challenge | Our Solution | -|-----------|--------------| -| ๐Ÿ‡ฎ๐Ÿ‡ณ Complex payment integration | Direct UPI payment links & QR codes | -| ๐Ÿ“ฑ Limited digital presence | Auto-generated restaurant websites with QR menus | -| ๐ŸŒ Language barriers | Multi-language menu support | -| ๐Ÿ“Š Manual order management | Centralized order dashboard | -| ๐Ÿ“ฆ Aggregator hassles | One-platform menu & order management | +| Pain Point | How Restroly Solves It | +|-----------|------------------------| +| ๐Ÿ‡ฎ๐Ÿ‡ณ Complex payment integration | Direct UPI links & QR codes โ€” GPay, PhonePe, Paytm, BHIM | +| ๐Ÿ“ฑ No digital presence | Auto-generated restaurant website with live QR menu | +| ๐ŸŒ Language barriers | Multi-language menu support (25+ languages โ€” roadmap) | +| ๐Ÿ“Š Manual order tracking | Centralized real-time order dashboard | +| ๐Ÿ“ฆ Aggregator dependency | Own your menu & orders โ€” no middleman | --- ## โœจ Features -### ๐Ÿ“ฑ Core Features - -- **๐Ÿ“ฑ QR Menu Generation** - Generate scannable QR codes for contactless menus -- **๐Ÿ“‚ Menu Management** - Organize items into categories with images and descriptions -- **๐Ÿ’ณ UPI Payment Integration** - Direct payment links supporting GPay, PhonePe, Paytm, and BHIM -- **๐ŸŒ Restaurant Website** - Auto-generated landing pages with live menus -- **๐Ÿ“Š Order Dashboard** - Centralized order management and tracking -- **๐Ÿ” Authentication** - Secure login for restaurant owners and admins -- **๐Ÿ“ˆ Analytics** - Track orders, revenue, and popular items -- **๐ŸŽจ Customizable Templates** - Different themes for Cafes, Dhabas, Fine Dining, etc. - -### ๐Ÿš€ Advanced Features (In Development) +### โœ… Available Now -- WhatsApp Business API integration for status updates -- AI-powered menu translation (25+ languages) -- Zomato & Swiggy aggregator sync -- Multi-branch management -- Inventory & stock management +| Feature | Description | +|---------|-------------| +| ๐Ÿ“ฑ QR Menu Generation | Scannable QR codes for contactless menu access | +| ๐Ÿ“‚ Menu Management | Categories, items, images, descriptions | +| ๐Ÿ’ณ UPI Payment Integration | GPay ยท PhonePe ยท Paytm ยท BHIM direct payment links | +| ๐ŸŒ Restaurant Website | Auto-generated landing page with live menu | +| ๐Ÿ“Š Order Dashboard | Centralized order management & tracking | +| ๐Ÿ” Authentication | Secure JWT-based login for owners & admins | +| ๐Ÿ“ˆ Analytics | Orders, revenue, and popular item tracking | +| ๐ŸŽจ Customizable Templates | Themes for Cafes, Dhabas, Fine Dining, and more | -### โœ… Feature Checklist +### ๐Ÿšง In Progress -| Area | Status | -|------|--------| -| QR menu generation | โœ… Available | -| Menu & category management | โœ… Available | -| Order dashboard | โœ… Available | -| UPI payment links | โœ… Available | -| Admin authentication | โœ… Available | -| Multi-branch support | ๐Ÿšง In progress | -| Real-time order updates | ๐Ÿšง Planned | -| Subscription tiers | ๐Ÿšง Planned | +| Feature | Status | +|---------|--------| +| Multi-branch support | Active development | +| Real-time order updates | Planned | +| Subscription tiers | Planned | -See [CONTRIBUTING.md](CONTRIBUTING.md) for branch naming (`feature/`, `fix/`, `docs/`), commit format, and PR workflow. +### ๐Ÿ”œ Roadmap -### ๐Ÿ—บ๏ธ Roadmap - -- **Near term:** empty-state UX polish, order realtime updates, README/onboarding improvements -- **Mid term:** subscription management, role-based access by plan -- **Long term:** aggregator sync, WhatsApp notifications, AI menu translation +| Timeline | Goals | +|----------|-------| +| **Near term** | Empty-state UX polish ยท real-time order updates ยท onboarding improvements | +| **Mid term** | Subscription management ยท role-based access by plan | +| **Long term** | Zomato & Swiggy aggregator sync ยท WhatsApp notifications ยท AI menu translation (25+ languages) | --- -## ๐Ÿ—๏ธ Tech Stack +## ๐Ÿ”ง Tech Stack ### Backend -- **Language**: Java 21 -- **Framework**: Spring Boot -- **Build Tool**: Gradle -- **Database**: PostgreSQL -- **Cache**: Redis (planned for some features; not required for local development) -- **API Documentation**: Swagger/OpenAPI +| Technology | Version | Role | +|-----------|---------|------| +| Java | 21 | Primary language | +| Spring Boot | Latest stable | Application framework | +| Gradle | 8.0+ | Build tool | +| PostgreSQL | 14+ | Primary database | +| Redis | Planned | Caching layer | +| Swagger / OpenAPI | โ€” | API documentation | ### Frontend -- **Framework**: React 18+ -- **Styling**: Tailwind CSS -- **Build Tool**: Vite -- **State Management**: Context API / Local State -- **HTTP Client**: Axios -- **Routing**: React Router v6+ - -### DevOps & Deployment -- **Containerization**: Docker & Docker Compose -- **Frontend Hosting**: Vercel / Netlify -- **Version Control**: Git +| Technology | Version | Role | +|-----------|---------|------| +| React | 18+ | UI framework | +| Tailwind CSS | โ€” | Utility-first styling | +| Vite | โ€” | Build tool & dev server | +| Axios | โ€” | HTTP client | +| React Router | v6+ | Client-side routing | +| Context API | โ€” | Global state management | + +### DevOps +| Tool | Purpose | +|------|---------| +| Docker & Docker Compose | Containerisation | +| Vercel / Netlify | Frontend hosting | +| Git | Version control | --- ## ๐Ÿ“‹ Prerequisites -### System Requirements +Install the following before you begin: -Before starting, ensure you have the following installed on your machine: +| Tool | Minimum Version | Download | +|------|----------------|---------| +| JDK | 21 | [Adoptium](https://adoptium.net/) | +| Gradle | 8.0 | [gradle.org](https://gradle.org/install/) | +| PostgreSQL | 14 | [postgresql.org](https://www.postgresql.org/download/) | +| Node.js | 18.0 | [nodejs.org](https://nodejs.org/) | +| npm | 9.0 | Bundled with Node.js | +| Git | Any | [git-scm.com](https://git-scm.com/) | -**For Backend (Java Development):** -```bash -- Java Development Kit (JDK) 21 or higher -- Gradle 8.0 or higher -- PostgreSQL 14 or higher -- Git -- IDE: IntelliJ IDEA (recommended) or Eclipse -- Maven/Gradle plugin for your IDE -``` +### Verify your setup -**For Frontend (Web Development):** ```bash + +java -version # expect 21+ +gradle --version # expect 8.0+ +node --version # expect 18+ +npm --version # expect 9+ +psql --version # expect 14+ +git --version + - Node.js 18.0 or higher - npm 9.0 or higher (comes with Node.js) - Git @@ -167,46 +170,51 @@ npm --version # Verify PostgreSQL (if installed locally) psql --version + ``` --- ## ๐Ÿš€ Quick Start -### Clone the Repository +### 1 ยท Clone the repository ```bash -# Clone the repository git clone https://github.com/rdodiya/RestroHub.git - -# Navigate to project directory cd RestroHub -# For GSSoC contributions, work from this branch +# GSSoC contributors โ€” always work from this branch git checkout gssoc_develop git pull origin gssoc_develop ``` -### Backend Setup +--- -#### 1. Database configuration +### 2 ยท Backend Setup -Create a PostgreSQL database named **`RestroHub_DB`** (must match the default JDBC URL; use quotes in SQL if you need mixed case): +#### Create the database *(one-time)* ```bash +# Option A createdb RestroHub_DB -# or: psql -U postgres -c 'CREATE DATABASE "RestroHub_DB";' + +# Option B +psql -U postgres -c 'CREATE DATABASE "RestroHub_DB";' ``` -Ensure the PostgreSQL user you use can connect to that database. By default the app expects username **`postgres`** with password **`postgres`**. Override with environment variables if your setup differs: +The app connects as `postgres` / `postgres` by default. Override with environment variables if needed: ```bash export DB_USERNAME=postgres export DB_PASSWORD=your_password -# Optional: full JDBC URL export SPRING_DATASOURCE_URL=jdbc:postgresql://localhost:5432/RestroHub_DB ``` + +> **Tip:** The active Spring profile is `dev`. Settings load from `application.properties` โ†’ `application-dev.properties`. Never commit secrets โ€” use environment variables for `DB_PASSWORD` and `JWT_SECRET`. + +#### Build & run + #### 2. Google OAuth Setup (Required for Login) **Get Google OAuth Client ID:** @@ -246,44 +254,43 @@ Most defaults are already in `RestroHub/src/main/resources/application.propertie #### 4. Build and run backend + ```bash -# Navigate to backend directory cd RestroHub -# If ./gradlew is not executable: chmod +x gradlew +chmod +x gradlew # first time on macOS/Linux only -# Ensure the Gradle wrapper JAR is present (commit includes RestroHub/gradle/wrapper/gradle-wrapper.jar). -# If it is missing, regenerate with: gradle wrapper --gradle-version 8.7 - -# Build the project -./gradlew clean build - -# Run the application -./gradlew bootRun +./gradlew clean build # compile & test +./gradlew bootRun # start the server ``` -The backend will be available at: -``` -http://localhost:8181/restroly/api/v1 -``` +Once you see `Started` in the terminal, the backend is live: -**Swagger API Documentation:** -``` -http://localhost:8181/restroly/swagger-ui.html -``` +| URL | What it does | +|-----|-------------| +| `http://localhost:8181/restroly/api/v1` | REST API base path | +| `http://localhost:8181/restroly/swagger-ui.html` | Interactive API docs | +| `http://localhost:8181/restroly/actuator/health` | Health check โ€” expect `{"status":"UP"}` | -### Frontend Setup +--- -#### 1. Install Dependencies +### 3 ยท Frontend Setup + +Open a **new terminal window**, then: ```bash -# Navigate to frontend directory cd RestroHub-FrontEnd -# Install dependencies -npm install +npm install # install dependencies (first time) +cp .env.example .env # create local env file ``` + +Edit `.env` and set: + +```env +# Spring Boot context path โ€” no trailing slash +VITE_API_BASE_URL=http://localhost:8181/restroly #### 2. Environment configuration - Google OAuth Create a `.env` file in `RestroHub-FrontEnd/` (see `.env.example`): @@ -298,33 +305,60 @@ VITE_GOOGLE_CLIENT_ID=your_google_oauth_client_id_here Optional: -```env + + VITE_NODE_ENV=development VITE_ENABLE_ANALYTICS=false ``` -#### 3. Run Development Server - ```bash -# Start development server npm run dev +# โ†’ http://localhost:3000 (Vite auto-picks the next free port if 3000 is busy) ``` -The frontend dev server uses port **3000** by default (see `RestroHub-FrontEnd/vite.config.js`). If that port is busy, Vite picks the next free port (for example **3001**). +--- -``` -http://localhost:3000 -``` +### โœ… Verify both services -### Verify Both Services Are Running +```bash +# Backend +curl http://localhost:8181/restroly/actuator/health +# โ†’ {"status":"UP"} -1. **Backend health (Spring Boot Actuator):** - ```bash - curl http://localhost:8181/restroly/actuator/health - ``` - Expect `{"status":"UP"}`. API routes live under `/restroly/api/v1` (and related paths); there is no `/api/v1/health` endpoint. +# Frontend โ€” open in browser +open http://localhost:3000 +``` + +--- -2. **Frontend:** Open the URL printed by Vite (usually `http://localhost:3000`). +## ๐Ÿ“ Architecture + +``` +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ CLIENT LAYER โ”‚ +โ”‚ React 18 + Vite โ”‚ Tailwind CSS โ”‚ React Router v6 โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ HTTP/REST ยท JSON ยท Axios + โ–ผ +โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” +โ”‚ SPRING BOOT API โ”‚ +โ”‚ Controllers โ”‚ JWT Auth โ”‚ Swagger / OpenAPI โ”‚ +โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ โ”‚ + โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” + โ”‚ Menu ยท Category โ”‚ โ”‚ Order ยท Payment ยท โ”‚ + โ”‚ Food Item Service โ”‚ โ”‚ Auth ยท User Service โ”‚ + โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ”‚ โ”‚ + โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ + โ–ผ + โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” + โ”‚ PostgreSQL 14+ โ”‚ + โ”‚ (Primary Database) โ”‚ + โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ +``` + +**Request flow:** Browser โ†’ React (Vite / CDN) โ†’ Spring Boot REST API โ†’ Service layer โ†’ PostgreSQL --- @@ -332,42 +366,40 @@ http://localhost:3000 ``` RestroHub/ -โ”œโ”€โ”€ RestroHub/ # Backend (Java/Spring Boot) -โ”‚ โ”œโ”€โ”€ src/ -โ”‚ โ”‚ โ”œโ”€โ”€ main/ -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ java/com/restroly/ -โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ controller/ # REST API endpoints -โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ service/ # Business logic -โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ repository/ # Database access -โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ model/ # Entity classes -โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ dto/ # Data Transfer Objects -โ”‚ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ config/ # Configuration classes -โ”‚ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ exception/ # Custom exceptions -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ resources/ -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ application.properties -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ application-dev.properties -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ application-prod.properties -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ logback-spring.xml -โ”‚ โ”‚ โ””โ”€โ”€ test/ -โ”‚ โ”œโ”€โ”€ build.gradle # Gradle build configuration -โ”‚ โ”œโ”€โ”€ settings.gradle -โ”‚ โ””โ”€โ”€ README.md โ”‚ -โ”œโ”€โ”€ RestroHub-FrontEnd/ # Frontend (React) +โ”œโ”€โ”€ RestroHub/ # โ— Backend โ€” Java / Spring Boot +โ”‚ โ”œโ”€โ”€ src/main/ +โ”‚ โ”‚ โ”œโ”€โ”€ java/com/restroly/ +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ controller/ # REST endpoints (thin layer) +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ service/ # Business logic +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ repository/ # JPA data access +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ model/ # Domain / entity classes +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ dto/ # Request & response DTOs +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ config/ # Spring configuration +โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ exception/ # Custom exceptions & handlers +โ”‚ โ”‚ โ””โ”€โ”€ resources/ +โ”‚ โ”‚ โ”œโ”€โ”€ application.properties +โ”‚ โ”‚ โ”œโ”€โ”€ application-dev.properties +โ”‚ โ”‚ โ”œโ”€โ”€ application-prod.properties +โ”‚ โ”‚ โ””โ”€โ”€ logback-spring.xml +โ”‚ โ”œโ”€โ”€ build.gradle +โ”‚ โ””โ”€โ”€ settings.gradle +โ”‚ +โ”œโ”€โ”€ RestroHub-FrontEnd/ # โ— Frontend โ€” React / Vite โ”‚ โ”œโ”€โ”€ src/ โ”‚ โ”‚ โ”œโ”€โ”€ components/ -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ admin/ # Admin dashboard components -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ customer/ # Customer-facing components -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ common/ # Reusable components +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ admin/ # Admin dashboard components +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ customer/ # Customer-facing components +โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ common/ # Shared / reusable components โ”‚ โ”‚ โ”œโ”€โ”€ pages/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ admin/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ customer/ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ public/ โ”‚ โ”‚ โ”œโ”€โ”€ services/ -โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ api.js # API client configuration -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ApiService.js # API service functions +โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ api.js # Axios instance & interceptors +โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ ApiService.js # Per-resource API functions โ”‚ โ”‚ โ”œโ”€โ”€ context/ -โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ SiteContext.jsx # Context for state management +โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ SiteContext.jsx # Global state (Context API) โ”‚ โ”‚ โ”œโ”€โ”€ styles/ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ global.css โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ landing.css @@ -378,349 +410,344 @@ RestroHub/ โ”‚ โ”œโ”€โ”€ package.json โ”‚ โ”œโ”€โ”€ vite.config.js โ”‚ โ”œโ”€โ”€ tailwind.config.js -โ”‚ โ”œโ”€โ”€ .env.example # Template for Vite env (copy to .env) -โ”‚ โ”œโ”€โ”€ .env # Local env (create from .env.example; not committed) -โ”‚ โ””โ”€โ”€ README.md +โ”‚ โ”œโ”€โ”€ .env.example # Copy this โ†’ .env +โ”‚ โ””โ”€โ”€ .env # โ† never commit this file โ”‚ -โ”œโ”€โ”€ ReadMe.md # Main project README (this file) +โ”œโ”€โ”€ CONTRIBUTING.md โ”œโ”€โ”€ LICENSE -โ””โ”€โ”€ CONTRIBUTING.md +โ””โ”€โ”€ READMe.md ``` --- ## ๐Ÿ“š API Documentation -### Running Swagger UI - -Once the backend is running, access the complete API documentation at: +Interactive docs are auto-generated by Swagger โ€” no extra setup required. ``` http://localhost:8181/restroly/swagger-ui.html ``` -### Key API Endpoints +### Endpoint Reference -#### Menu Management -- `GET /api/v1/menus` - Get all menus -- `POST /api/v1/menus` - Create new menu -- `PUT /api/v1/menus/{id}` - Update menu -- `DELETE /api/v1/menus/{id}` - Delete menu +#### Menus +| Method | Endpoint | Description | +|--------|----------|-------------| +| `GET` | `/secure/api/v1/menus` | List all menus | +| `POST` | `/secure/api/v1/menus` | Create a menu | +| `PUT` | `/secure/api/v1/menus/{id}` | Update a menu | +| `DELETE` | `/secure/api/v1/menus/{id}` | Delete a menu | #### Categories -- `GET /api/v1/categories` - Get all categories -- `POST /api/v1/categories` - Create category +| Method | Endpoint | Description | +|--------|----------|-------------| +| `GET` | `/api/v1/categories` | List all categories | +| `POST` | `/api/v1/categories` | Create a category | #### Food Items -- `GET /api/v1/foods` - Get all food items -- `POST /api/v1/foods` - Add food item -- `PUT /api/v1/foods/{id}` - Update food item -- `DELETE /api/v1/foods/{id}` - Delete food item +| Method | Endpoint | Description | +|--------|----------|-------------| +| `GET` | `/api/v1/foods` | List all food items | +| `POST` | `/api/v1/foods` | Add a food item | +| `PUT` | `/api/v1/foods/{id}` | Update a food item | +| `DELETE` | `/api/v1/foods/{id}` | Delete a food item | #### Orders -- `GET /api/v1/orders` - Get all orders -- `POST /api/v1/orders` - Place new order -- `GET /api/v1/orders/{id}` - Get order details +| Method | Endpoint | Description | +|--------|----------|-------------| +| `GET` | `/api/v1/orders` | List all orders | +| `POST` | `/api/v1/orders` | Place a new order | +| `GET` | `/api/v1/orders/{id}` | Get order details | + +> Full request/response schemas, auth headers, and error codes are documented in Swagger UI. --- ## ๐Ÿค Contributing -We love contributions from the community! Whether you're fixing bugs, adding features, or improving documentation, your help is valuable. +All contributions are welcome โ€” bug fixes, features, tests, and docs. -### ๐ŸŽฏ How to Contribute +### Branch naming -**1. Fork the Repository** -```bash -# Click the Fork button on GitHub ``` +feature/short-description # new feature +fix/short-description # bug fix +docs/short-description # documentation only +refactor/short-description # code cleanup, no behaviour change +test/short-description # adding or updating tests +``` + +> โš ๏ธ Always branch **from `gssoc_develop`**, never from `main`. + +### Contribution workflow -**2. Clone Your Fork** ```bash +# 1. Fork on GitHub, then clone your fork git clone https://github.com/YOUR_USERNAME/RestroHub.git cd RestroHub -``` -**3. Create a Feature Branch from gssoc_develop branch** -```bash -git checkout -b feature/your-feature-name gssoc_develop -# or for bug fixes: -git checkout -b fix/bug-name gssoc_develop -``` +# 2. Add the upstream remote +git remote add upstream https://github.com/rdodiya/RestroHub.git -**4. Make Your Changes** -- Write clean, well-commented code -- Follow the project's coding standards -- Test your changes thoroughly +# 3. Stay up to date +git fetch upstream +git checkout gssoc_develop +git merge upstream/gssoc_develop -**5. Build & Test Locally** +# 4. Create your branch +git checkout -b feature/your-feature-name -**For Backend:** -```bash -cd RestroHub -./gradlew clean build -./gradlew bootRun -# Test at: http://localhost:8181/restroly/swagger-ui.html -``` +# 5. Make changes & test locally +# Backend: +cd RestroHub && ./gradlew clean build && ./gradlew bootRun +# Frontend: +cd RestroHub-FrontEnd && npm install && npm run dev -**For Frontend:** -```bash -cd RestroHub-FrontEnd -npm install -npm run dev -# Test at: http://localhost:3000 (or the URL Vite prints) +# 6. Commit using Conventional Commits +git commit -m "feat(menu): add vegetarian filter to category list" + +# 7. Push and open a PR against gssoc_develop +git push origin feature/your-feature-name ``` -**6. Commit with Conventional Commits** -```bash -git commit -m "type(scope): description" +### Commit message format -# Examples: -git commit -m "feat(menu): add menu categories" -git commit -m "fix(api): resolve food item endpoint" -git commit -m "docs(readme): update setup instructions" ``` +type(scope): concise description in present tense -**Commit Types:** -- `feat:` - New feature -- `fix:` - Bug fix -- `docs:` - Documentation changes -- `style:` - Code style changes (formatting, semicolons, etc.) -- `refactor:` - Code refactoring without feature changes -- `test:` - Adding or updating tests -- `chore:` - Maintenance tasks, dependency updates +Types: + feat โ†’ new feature + fix โ†’ bug fix + docs โ†’ documentation only + style โ†’ formatting, no logic change + refactor โ†’ code change, no feature/fix + test โ†’ adding or updating tests + chore โ†’ maintenance, dependency updates -**7. Push to Your Fork** -```bash -git push origin feature/your-feature-name +Examples: + feat(orders): add real-time status polling + fix(auth): handle expired JWT tokens gracefully + docs(readme): add architecture diagram ``` -**8. Open a Pull Request** -- Go to the original repository -- Click "New Pull Request" -- Select your branch and provide a clear description -- Wait for review and feedback +### PR checklist -### ๐Ÿ“‹ Contribution Guidelines +Before opening your pull request, confirm: -- **Code Style**: Follow existing code patterns -- **Testing**: Test your changes locally before submitting -- **Documentation**: Update ReadMe.md if adding new features -- **Commit Messages**: Use clear, descriptive messages -- **PR Descriptions**: Explain what and why, not just what +- [ ] Branched from `gssoc_develop` +- [ ] `./gradlew build` passes with no errors +- [ ] `npm run build` passes with no errors +- [ ] Tested end-to-end locally +- [ ] No `.env` files or secrets committed +- [ ] README updated if a new feature was added +- [ ] PR title and description explain *what* and *why* -### ๐Ÿ” Areas Needing Contributions +### Code style -| Feature | Difficulty | Impact | -|---------|-----------|--------| -| Backend Api Changes as per requirements of Frontend | Low | High | -| Frontend Highly Responsive UI | Low | High | -| Frontend & Backend Integration | Low | High | -| WhatsApp Integration | Medium | High | -| UPI Payment Service | Medium | High | -| Menu Templates | Easy | Medium | -| Aggregator Sync | Hard | High | -| Analytics Dashboard | Medium | Medium | -| Multi-language Support | Easy | Medium | +**Java (Backend)** +- Standard naming: `camelCase` methods, `PascalCase` classes, `UPPER_SNAKE_CASE` constants +- Controllers stay thin โ€” all business logic goes in the service layer +- Use constructor injection; avoid field-level `@Autowired` +- Add Javadoc to every public service method ---- +**React (Frontend)** +- Functional components and hooks only โ€” no class components +- One component per file; filename must match the component name exactly +- Use `SiteContext` for shared state; avoid prop-drilling beyond 2 levels +- Prefer Tailwind utility classes over custom CSS -## ๐Ÿš€ Deployment (Not for Local) +### Open issues & good first contributions -### Docker Deployment +| Area | Difficulty | Impact | +|------|-----------|--------| +| Frontend โ†” Backend API integration | ๐ŸŸข Low | ๐Ÿ”ด High | +| Responsive UI improvements | ๐ŸŸข Low | ๐Ÿ”ด High | +| UPI Payment Service | ๐ŸŸก Medium | ๐Ÿ”ด High | +| WhatsApp Business API integration | ๐ŸŸก Medium | ๐Ÿ”ด High | +| Analytics Dashboard | ๐ŸŸก Medium | ๐ŸŸก Medium | +| Menu Templates (Cafe, Dhaba, Fine Dining) | ๐ŸŸข Easy | ๐ŸŸก Medium | +| Multi-language support | ๐ŸŸข Easy | ๐ŸŸก Medium | +| Aggregator Sync (Zomato / Swiggy) | ๐Ÿ”ด Hard | ๐Ÿ”ด High | -**1. Build Docker Images** -```bash -# Build the entire stack -docker-compose build -``` +--- -**2. Run with Docker Compose** -```bash -# Start all services -docker-compose up -d +## ๐Ÿš€ Deployment -# View logs -docker-compose logs -f +### Docker (all-in-one) -# Stop services -docker-compose down +```bash +docker-compose build # build images +docker-compose up -d # start all services +docker-compose logs -f # tail logs +docker-compose down # stop and remove containers ``` -### Frontend Deployment - -#### Option 0: Local (Recommended) -npm run dev - -#### Option 1: Vercel +### Frontend +**Vercel** ```bash -# Install Vercel CLI npm install -g vercel - -# Navigate to frontend cd RestroHub-FrontEnd - -# Deploy vercel --prod ``` -#### Option 2: Netlify - +**Netlify** ```bash -# Build the project npm run build - -# Deploy using Netlify CLI or upload the dist folder manually netlify deploy --prod --dir=dist ``` -### Backend Deployment - -#### Option 0: Embedded Tomcat - -For local development, use the embedded Tomcat server from Spring Boot (`./gradlew bootRun`). - -#### Option 1: Docker to Cloud (AWS, GCP, Azure) +### Backend +**Docker โ†’ Cloud (AWS / GCP / Azure)** ```bash -# Build JAR cd RestroHub ./gradlew build - -# Create Docker image and push to registry docker build -t your-registry/restrohub:latest . docker push your-registry/restrohub:latest ``` -#### Option 2: Traditional Server - +**Traditional server (Tomcat)** ```bash -# Build JAR ./gradlew build - -# Copy WAR to server -build/libs/restroly-0.0.1-SNAPSHOT-plain.war user@server:/opt/tomcat/webapps/restroly - -# Restart web server -systemctl restart tomcat +scp build/libs/restroly-0.0.1-SNAPSHOT-plain.war \ + user@server:/opt/tomcat/webapps/restroly +ssh user@server "systemctl restart tomcat" ``` --- ## ๐Ÿ”ง Troubleshooting -### Backend Issues +### Backend + +
+PostgreSQL connection refused -**Issue: PostgreSQL Connection Failed** -``` -Error: org.postgresql.util.PSQLException: Connection refused -``` -**Solution:** ```bash -# Check if PostgreSQL is running +# Test the connection psql -U postgres -c "SELECT version();" -# If not running, start PostgreSQL service -# On Windows: Services > PostgreSQL -# On macOS: brew services start postgresql -# On Linux: sudo systemctl start postgresql +# Start the service +sudo systemctl start postgresql # Linux +brew services start postgresql # macOS +# Windows: Start menu โ†’ Services โ†’ PostgreSQL โ†’ Start ``` +
+ +
+Port 8181 already in use -**Issue: Port 8181 Already in Use** ```bash -# Find process using port 8181 -lsof -i :8181 # macOS/Linux -netstat -ano | findstr :8181 # Windows +# macOS / Linux +lsof -i :8181 +kill -9 -# Kill process (get PID from above) -kill -9 # macOS/Linux -taskkill /PID /F # Windows +# Windows +netstat -ano | findstr :8181 +taskkill /PID /F ``` +
-### Frontend Issues +
+Gradle wrapper JAR missing + +```bash +gradle wrapper --gradle-version 8.7 +``` +
+ +
+Build fails โ€” Java version mismatch + +```bash +java -version # must be 21+ +# Download JDK 21 from https://adoptium.net/ if needed +``` +
+ + +### Frontend + +
+npm install fails -**Issue: Dependencies Installation Failed** ```bash -# Clear cache and reinstall rm -rf node_modules package-lock.json npm install ``` +
+ +
+API calls returning 404 -**Issue: API Calls Returning 404** ```bash -# Verify backend is running: +# Confirm backend is running curl http://localhost:8181/restroly/actuator/health -# Check .env: base URL should be the server + context path (not .../api/v1) +# Check .env โ€” base URL must NOT end with /api/v1 grep VITE_API_BASE_URL .env +# Correct: VITE_API_BASE_URL=http://localhost:8181/restroly +# Incorrect: VITE_API_BASE_URL=http://localhost:8181/restroly/api/v1 ``` +
+ +
+Port 3000 already in use -**Issue: Port 3000 Already in Use** ```bash -# Run on a different port (ensure CORS_ALLOWED_ORIGINS on the backend includes that origin) npm run dev -- --port 5173 +# Then add http://localhost:5173 to CORS_ALLOWED_ORIGINS in your backend config ``` +
-### General Issues - -**Issue: Git Clone Fails** -```bash -# Check git is installed -git --version - -# Verify SSH/HTTPS connection -git ls-remote https://github.com/rdodiya/RestroHub.git -``` ---- ## ๐Ÿ“„ License -This project is licensed under the **MIT License** - see the [LICENSE](LICENSE) file for details. +This project is licensed under the **MIT License** โ€” see [LICENSE](LICENSE) for details. -**You are free to:** -- โœ… Use commercially -- โœ… Modify the code -- โœ… Distribute the software -- โœ… Use privately +| Permission | | +|------------|--| +| โœ… Commercial use | โœ… Modification | +| โœ… Distribution | โœ… Private use | -**You must:** -- โœ… Include license and copyright notice +**Requirement:** Include the original license and copyright notice in any copy or substantial portion. --- ## ๐Ÿ“ž Contact & Support -### Project Owner -**Raj Dodiya** -- ๐Ÿ‘จโ€๐Ÿ’ป LinkedIn : [@rdodiya](https://www.linkedin.com/in/rdodiya/) -- ๐Ÿ™ GitHub: [@rdodiya](https://github.com/rdodiya) -- ๐Ÿ“ง Email: rdodiya2601@gmail.com -- ๐Ÿ’ฌ Twitter: [@RestroHub](https://x.com/rdodiya2001) +
+ +**Raj Dodiya** โ€” Project Owner -### Support Channels -- ๐Ÿ“ **Issue Tracker**: [GitHub Issues](https://github.com/rdodiya/RestroHub/issues) -- ๐Ÿ“ง **Email**: rdodiya2601@gmail.com +| | | +|--|--| +| ๐Ÿ™ GitHub | [@rdodiya](https://github.com/rdodiya) | +| ๐Ÿ’ผ LinkedIn | [@rdodiya](https://www.linkedin.com/in/rdodiya/) | +| ๐Ÿ“ง Email | rdodiya2601@gmail.com | +| ๐Ÿฆ Twitter / X | [@rdodiya2001](https://x.com/rdodiya2001) | +| ๐Ÿ“ Bug reports | [GitHub Issues](https://github.com/rdodiya/RestroHub/issues) | -### Reporting Issues +
-When reporting bugs, please include: -1. Description of the issue -2. Steps to reproduce -3. Expected vs actual behavior -4. Screenshots/error logs (if applicable) -5. Your environment (OS, Java version, Node version, etc.) +When filing a bug report, please include: +1. A clear description of the problem +2. Steps to reproduce it +3. Expected vs. actual behaviour +4. Error logs or screenshots +5. Your OS, Java version, and Node.js version --- ## ๐Ÿ™ Acknowledgments -- **Spring Boot Team** - For the amazing backend framework -- **React Team** - For the powerful frontend library -- **Tailwind CSS** - For beautiful styling -- **PostgreSQL Community** - For reliable database -- **All Contributors** - For making RestroHub better +- **Spring Boot Team** โ€” for the robust backend framework +- **React Team** โ€” for the powerful UI library +- **Tailwind CSS** โ€” for utility-first, beautiful styling +- **PostgreSQL Community** โ€” for a rock-solid open-source database +- **GSSoC Contributors** โ€” for making Restroly better every day --- @@ -728,6 +755,6 @@ When reporting bugs, please include: **Made with โค๏ธ for Indian Restaurants** -[โฌ† Back to top](#-restrohub---digital-menu--restaurant-management-platform) +[โฌ† Back to top](#-restroly)