Skip to content

Modern real-time chat application frontend built with React, Vite, and Tailwind CSS. Mobile-ready with Ionic and Capacitor integration.

Notifications You must be signed in to change notification settings

Peter-sour/Clavox.UI

Repository files navigation

Clavox Frontend πŸ’¬πŸŽ¨

React Vite TailwindCSS Ionic Capacitor

Frontend aplikasi chat real-time Clavox yang dibangun dengan React + Vite + Tailwind CSS. Terintegrasi dengan Ionic + Capacitor untuk deployment ke mobile app (Android/iOS).

Note: Ini adalah repository frontend. Backend API tersedia di Clavox Backend


✨ Fitur Frontend

  • 🎨 Modern UI/UX dengan Tailwind CSS
  • πŸ“± Responsive Design - Mobile First
  • ⚑ Fast Development dengan Vite Hot Reload
  • πŸ” Phone Authentication dengan OTP Input
  • πŸ’¬ Real-time Chat Interface
  • πŸ“± Mobile App Ready - Ionic + Capacitor
  • πŸŒ™ Dark Mode Support (Coming Soon)
  • πŸ”„ Socket.IO Integration untuk real-time messaging

πŸ“‚ Struktur Frontend

clavox-frontend/
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ index.html
β”‚   └── assets/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/           # Komponen UI
β”‚   β”‚   β”œβ”€β”€ Auth/
β”‚   β”‚   β”œβ”€β”€ Chat/
β”‚   β”‚   └── Common/
β”‚   β”œβ”€β”€ pages/               # Halaman utama
β”‚   β”‚   β”œβ”€β”€ Login.jsx
β”‚   β”‚   β”œβ”€β”€ Chat.jsx
β”‚   β”‚   └── Profile.jsx
β”‚   β”œβ”€β”€ hooks/               # Custom hooks
β”‚   β”œβ”€β”€ services/            # API & Socket services
β”‚   β”œβ”€β”€ utils/               # Helper functions
β”‚   β”œβ”€β”€ styles/              # Global styles
β”‚   β”œβ”€β”€ App.jsx
β”‚   └── main.jsx
β”œβ”€β”€ capacitor.config.ts      # Konfigurasi Capacitor
β”œβ”€β”€ ionic.config.json        # Konfigurasi Ionic
β”œβ”€β”€ tailwind.config.js       # Konfigurasi Tailwind
β”œβ”€β”€ vite.config.js          # Konfigurasi Vite
└── package.json

πŸš€ Quick Start

Prerequisites

  • Node.js (v16+)
  • npm atau yarn
  • Android Studio (untuk Android build)
  • Xcode (untuk iOS build - Mac only)

1. Clone Repository

git clone https://github.com/Peter-sour/clavox-frontend.git
cd clavox-frontend

2. Install Dependencies

# Core dependencies
npm install

# React Router
npm install react-router-dom

# Phone number input
npm install react-phone-number-input libphonenumber-js --legacy-peer-deps

# OTP input
npm install react-otp-input

# Ionic & Capacitor
npm install @ionic/react @ionic/react-router ionicons
npm install @capacitor/core
npm install --save-dev @capacitor/cli

# Socket.IO client
npm install socket.io-client

3. Environment Setup

Buat file .env di root project:

VITE_API_BASE_URL=http://localhost:5000
VITE_SOCKET_URL=http://localhost:5000

4. Development Server

npm run dev

Aplikasi akan berjalan di http://localhost:5173


πŸ“± Mobile Development

Setup Capacitor

# Inisialisasi Capacitor
npx cap init

# Build web assets
npm run build

# Sync dengan native platforms
npx cap sync

Add Mobile Platforms

# Add Android
npx cap add android

# Add iOS (Mac only)
npx cap add ios

Build & Run Mobile App

# Build untuk production
npm run build

# Sync assets ke native
npx cap sync

# Open di Android Studio
npx cap open android

# Open di Xcode (Mac only)  
npx cap open ios

πŸ§‘β€πŸ’» Available Scripts

npm run dev          # Development server
npm run build        # Production build
npm run preview      # Preview production build
npm run lint         # ESLint check
npm run lint:fix     # Fix ESLint issues

πŸ”§ Konfigurasi

Tailwind Config

// tailwind.config.js
module.exports = {
  content: [
    "./index.html",
    "./src/**/*.{js,ts,jsx,tsx}",
  ],
  theme: {
    extend: {
      colors: {
        primary: {
          50: '#eff6ff',
          500: '#3b82f6',
          600: '#2563eb',
        }
      }
    },
  },
  plugins: [],
}

Vite Config

// vite.config.js
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [react()],
  server: {
    port: 5173,
    host: true
  }
})

🌐 API Integration

Socket.IO Setup

// src/services/socket.js
import io from 'socket.io-client';

const socket = io(import.meta.env.VITE_SOCKET_URL);

export default socket;

API Service

// src/services/api.js
const API_BASE_URL = import.meta.env.VITE_API_BASE_URL;

export const apiService = {
  async sendOTP(phoneNumber) {
    // API call logic
  },
  
  async verifyOTP(phoneNumber, otp) {
    // API verification logic  
  }
};

πŸ“± Mobile Features

Push Notifications

npm install @capacitor/push-notifications

Native Device Access

npm install @capacitor/camera
npm install @capacitor/filesystem
npm install @capacitor/haptics

🎨 UI Components

Reusable Components

  • Button - Custom button dengan variants
  • Input - Input field dengan validation
  • Modal - Modal component
  • ChatBubble - Chat message bubble
  • PhoneInput - Phone number input
  • OTPInput - OTP verification input

πŸ“Œ Roadmap Frontend

  • Dark Mode Implementation
  • Push Notification UI
  • Chat Encryption Indicator
  • File Upload Interface
  • Voice Message Recording
  • Chat Export Feature
  • Multiple Theme Support
  • PWA Implementation

πŸ› Troubleshooting

Common Issues

  1. Build Error: Pastikan semua dependencies terinstall dengan benar
  2. Socket Connection: Periksa VITE_SOCKET_URL di file .env
  3. Mobile Build: Pastikan Android Studio/Xcode sudah terinstall
  4. Phone Input: Gunakan flag --legacy-peer-deps jika ada conflict

Debug Mode

# Enable debug untuk Socket.IO
localStorage.debug = 'socket.io-client:socket';

🀝 Contributing

  1. Fork repository ini
  2. Buat feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add some AmazingFeature')
  4. Push ke branch (git push origin feature/AmazingFeature)
  5. Buka Pull Request

πŸ“œ License

Distributed under the MIT License. See LICENSE for more information.


πŸ™ Acknowledgments


πŸ’‘ Support

Jika project ini membantu, jangan lupa beri ⭐ di repo ini!

Link Repository:


Made with ❀️ by Peter-sour

About

Modern real-time chat application frontend built with React, Vite, and Tailwind CSS. Mobile-ready with Ionic and Capacitor integration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published