A modern web interface for the Insighta Labs+ Profile Intelligence System, built with React, TypeScript, and TailwindCSS.
- GitHub OAuth Authentication: Secure login using GitHub OAuth with PKCE
- Role-Based Access Control: Admin and Analyst roles with different permissions
- Profile Management: View, search, filter, and export profiles
- Natural Language Search: Query profiles using natural language
- Responsive Design: Works seamlessly on desktop, tablet, and mobile devices
- Real-time Data: Live connection to the backend API
- Frontend Framework: React 18 with TypeScript
- Build Tool: Vite
- Styling: TailwindCSS
- Routing: React Router v6
- HTTP Client: Axios with interceptors
- State Management: React Context API
- Icons: Lucide React
- Forms: React Hook Form with Zod validation
- Node.js 18+ and npm/yarn/pnpm
- Backend API running at
https://insightiabackend-production.up.railway.app - GitHub OAuth application configured in the backend
- Clone the repository:
git clone <repository-url>
cd Insighta_web_portal- Install dependencies:
npm install- Set up environment variables:
cp .env.example .envEdit .env and configure the backend URL:
VITE_BACKEND_URL=https://insightiabackend-production.up.railway.app
- Start the development server:
npm run devThe application will be available at http://localhost:3000
npm run buildThe optimized production build will be in the dist directory.
The application is designed to be deployed on platforms like Vercel, Netlify, or any static hosting service.
- Push your code to GitHub
- Import the repository in Vercel
- Configure the environment variable
VITE_BACKEND_URL - Deploy
VITE_BACKEND_URL: The URL of the backend API (default: https://insightiabackend-production.up.railway.app)
Insighta_web_portal/
βββ src/
β βββ components/
β β βββ ui/ # Reusable UI components
β β βββ Layout.tsx # Main layout with navigation
β βββ pages/ # Page components
β β βββ Login.tsx
β β βββ Dashboard.tsx
β β βββ ProfilesList.tsx
β β βββ ProfileDetail.tsx
β β βββ Search.tsx
β β βββ Account.tsx
β β βββ CreateProfile.tsx
β βββ contexts/
β β βββ AuthContext.tsx # Authentication state management
β βββ services/
β β βββ api.ts # API service layer
β βββ types/
β β βββ index.ts # TypeScript types
β βββ App.tsx # Main app with routing
β βββ main.tsx # Entry point
βββ public/ # Static assets
βββ package.json
- User clicks "Continue with GitHub"
- Application generates PKCE parameters (state, code_verifier, code_challenge)
- User is redirected to GitHub OAuth
- GitHub redirects back with authorization code
- Application exchanges code for access/refresh tokens
- Tokens are stored in localStorage
- JWT token is included in Authorization header for all API requests
- Automatic token refresh on 401 responses
The web portal communicates with the backend via REST API:
-
Auth Endpoints:
GET /auth/github- Initiate GitHub OAuthGET /auth/github/callback- OAuth callbackPOST /auth/refresh- Refresh access tokenPOST /auth/logout- Logout
-
Profile Endpoints:
GET /api/profiles- List profiles with filters/paginationGET /api/profiles/:id- Get single profileGET /api/profiles/search- Natural language searchPOST /api/profiles- Create profile (admin only)DELETE /api/profiles/:id- Delete profile (admin only)GET /api/profiles/export- Export to CSV
All API requests include:
Authorization: Bearer {access_token}headerX-API-Version: 1header
- JWT Authentication: Access tokens expire in 3 minutes
- Token Refresh: Automatic refresh using refresh tokens (5 min expiry)
- Role-Based Access: Admin users have full access, Analysts have read-only
- PKCE Flow: Secure OAuth with Proof Key for Code Exchange
- Protected Routes: All pages except login require authentication
- Create and delete profiles
- View and search all profiles
- Export profiles to CSV
- Access to admin endpoints
- View all profiles
- Search profiles with natural language
- Export profiles to CSV
- Cannot create or delete profiles
- GitHub OAuth authentication
- PKCE security flow
- Error handling
- Overview metrics (total profiles, gender distribution)
- Recent profiles
- Top countries
- Quick actions for admins
- Filter by gender, country, age group, age range
- Sort by various fields
- Pagination
- Export to CSV
- Create new profile (admin only)
- View complete profile information
- Delete profile (admin only)
- Navigation back to list
- Natural language search queries
- Parsed query display
- Search results with pagination
- User profile information
- Role and permissions display
- Last login timestamp
- Sign out
Reusable UI components built with TailwindCSS:
- Button (primary, secondary, danger, outline variants)
- Card (header, content, title)
- LoadingSpinner
- Form inputs
- Ensure backend URL is correct in
.env - Check that GitHub OAuth is configured in backend
- Clear localStorage and try logging in again
- Check browser console for error messages
- Verify backend is running and accessible
- Check network tab in browser dev tools
- Ensure Node.js version is 18+
- Delete
node_modulesand runnpm install - Clear Vite cache:
rm -rf node_modules/.vite
npm run dev- Start development servernpm run build- Build for productionnpm run preview- Preview production build
- Create page component in
src/pages/ - Add route in
src/App.tsx - Add navigation link in
src/components/Layout.tsx(if needed)
- Add TypeScript interface in
src/types/index.ts - Add API method in
src/services/api.ts - Use the method in your page components
This is part of the Insighta Labs+ platform. Please follow the existing code style and conventions.
ISC
- Backend API: https://insightiabackend-production.up.railway.app
- CLI Repository: [link to CLI repo]
- Backend Repository: [link to Backend repo]