BhashaAI Frontend

The modern, bilingual (English & Gujarati) web interface for BhashaAI, built with Next.js 15, Tailwind CSS, and Shadcn UI.

πŸ— Architecture

The frontend follows a feature-first architecture, leveraging Next.js App Router and React Server Components.

graph TD
    User[User] --> Next[Next.js App Server]
    Next --> |Server Components| Pages[App Pages]
    Pages --> |Client Components| Components[Interactive UI]
    Components --> |React Query| API[API Service Layer]
    API --> |Axios| Backend[FastAPI Backend]

    subgraph "Client State"
        Context[Language Context]
        Theme[Theme Provider]
        Query[TanStack Query Cache]
    end

    Components --> Context
    Components --> Theme

Key Technologies

  • Framework: Next.js 15 (App Router)
  • Language: TypeScript
  • Styling: Tailwind CSS, Shadcn UI
  • State: React Query, Zustand
  • Animation: Framer Motion
  • Forms: React Hook Form, Zod

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • bun
  • Backend running (for full functionality)

Installation

  1. Clone the repository and enter the directory:

    cd bhasaai-frontend
  2. Install dependencies:

    npm install
    # or
    bun install
  3. Environment Setup: Copy .env.example to .env.local (create it if missing):

    # URL of the BhashaAI Backend API
    NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1
  4. Run the development server:

    bun run dev

    Visit http://localhost:3000

🐳 Docker Setup

You can run the frontend as a standalone container or as part of the full stack.

Build & Run Standalone

docker build -t bhasaai-frontend .
docker run -p 3000:3000 -e NEXT_PUBLIC_API_URL=http://host.docker.internal:8000/api/v1 bhasaai-frontend

Full Stack (Recommended)

Run from the project root using Docker Compose:

docker-compose up -d

πŸ“‚ Project Structure

src/
β”œβ”€β”€ app/                 # Next.js App Router Pages
β”‚   β”œβ”€β”€ (auth)/          # Authentication Routes
β”‚   β”œβ”€β”€ dashboard/       # Main Teacher Dashboard
β”‚   └── page.tsx         # Landing Page
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ ui/              # Shadcn UI Primitives
β”‚   β”œβ”€β”€ theme-customizer.tsx # Theme Settings
β”‚   └── ...
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ api.ts           # API Client
β”‚   β”œβ”€β”€ i18n.tsx         # Internationalization
β”‚   └── ...
β”œβ”€β”€ hooks/               # Custom React Hooks
└── locales/             # Translation JSONs (en, gu)

πŸ§ͺ Development

  • Linting: bun run lint
  • Building: bun run build