Skip to content

rdwaynedehoedt/api_generator_frontendv1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ ΰΆ…ΰΆ΄ΰ·’ΰΆ½ΰΆœΰ·š AI - Sri Lankan AI API Platform

A modern, responsive SaaS platform providing AI-powered educational assistance specifically designed for Sri Lankan students. Built with Node.js backend and Next.js frontend.

✨ Features

🎯 For Developers

  • RESTful API with authentication via API keys
  • Firebase Authentication for user management
  • Gemini AI Integration for intelligent responses
  • Rate Limiting & Security with CORS protection
  • Professional Dashboard with usage analytics

πŸŽ“ For Students

  • Sinhala Language Support - Native language processing
  • O/L & A/L Syllabus - Sri Lankan curriculum focused
  • Educational AI Tutor - Mathematics, Physics, and more
  • Responsive Design - Works on mobile, tablet, desktop

πŸ—οΈ Architecture

apiplatform_ready/
β”œβ”€β”€ apiplatform_ready/          # Backend API Server (Node.js + Express)
β”‚   β”œβ”€β”€ server.js              # Main server file with security fixes
β”‚   β”œβ”€β”€ package.json           # Backend dependencies
β”‚   └── .env                   # Environment variables (create from .env_copy)
β”œβ”€β”€ frontend/                   # Frontend SaaS Dashboard (Next.js + TypeScript)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/               # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ components/        # Reusable UI components  
β”‚   β”‚   β”œβ”€β”€ contexts/          # React contexts (Auth)
β”‚   β”‚   β”œβ”€β”€ lib/               # Firebase config
β”‚   β”‚   └── services/          # API service layer
β”‚   β”œβ”€β”€ package.json           # Frontend dependencies
β”‚   └── .env.local             # Frontend environment vars (create from .env copy)
└── README.md                  # This file

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ and npm
  • Firebase project with Authentication enabled
  • Google Gemini API key

1. Backend Setup

cd apiplatform_ready
cp .env_copy .env
# Edit .env with your Firebase and Gemini credentials
npm install
npm start

Backend will run on http://localhost:3000

2. Frontend Setup

cd frontend
cp ".env copy" .env.local
# Edit .env.local with your Firebase config
npm install
npm run dev

Frontend will run on http://localhost:3001

πŸ”‘ Environment Variables

Backend (.env)

# Firebase Admin SDK
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_PRIVATE_KEY=your-private-key  
FIREBASE_CLIENT_EMAIL=your-client-email
FIREBASE_DATABASE_URL=your-database-url

# Gemini AI
GEMINI_API_KEY=your-gemini-api-key

# Server Config
PORT=3000
ALLOWED_ORIGINS=http://localhost:3001

Frontend (.env.local)

# Firebase Web SDK
NEXT_PUBLIC_FIREBASE_API_KEY=your-api-key
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your-domain
NEXT_PUBLIC_FIREBASE_PROJECT_ID=your-project-id

# Backend API
NEXT_PUBLIC_API_URL=https://endpoint.apilageai.lk

πŸ“– API Documentation

Authentication

curl -X POST https://endpoint.apilageai.lk/api/chat \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"message": "Hello, how are you?"}'

Response Format

{
  "success": true,
  "response": "Hello! I'm doing well, thank you for asking.",
  "credits_remaining": 45,
  "timestamp": "2025-09-18T10:30:00Z"
}

🎨 UI Features

Responsive Design

  • Desktop: Split-screen login with Sinhala marketing content
  • Mobile: Full-screen optimized with mobile logo
  • Tablet: Adaptive layout for all screen sizes

Dashboard Components

  • Navigation Bar - Clean SaaS-style header
  • Stats Cards - Credits and usage analytics
  • API Key Management - Copy/paste functionality
  • Quick Tester - Built-in API testing tool
  • Documentation - Complete API reference

🚦 Development

Scripts

# Backend
npm start          # Production server
npm run dev        # Development with nodemon

# Frontend  
npm run dev        # Development server with Turbopack
npm run build      # Production build
npm run start      # Production server

File Structure

  • Clean Architecture - Separated concerns with services, contexts, components
  • TypeScript - Full type safety across the frontend
  • Tailwind CSS - Modern utility-first styling
  • shadcn/ui - High-quality component library

πŸ”’ Security Features

  • βœ… Environment Variables - No hardcoded secrets
  • βœ… Firebase Admin SDK - Secure authentication
  • βœ… CORS Protection - Configurable allowed origins
  • βœ… API Rate Limiting - Prevent abuse
  • βœ… Input Validation - Sanitized requests

🌐 Deployment Ready

Choreo Deployment

The backend is containerized and ready for WSO2 Choreo deployment with:

  • Docker support (planned)
  • Environment variable management
  • Production logging
  • Health check endpoints

πŸ“± Mobile Support

Fully responsive design tested on:

  • iOS Safari - iPhone/iPad compatibility
  • Android Chrome - All Android devices
  • Desktop Browsers - Chrome, Firefox, Safari, Edge

🀝 Contributing

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push branch: git push origin feature/amazing-feature
  5. Open Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

  • Email: support@apilageai.lk
  • Documentation: Available in dashboard
  • GitHub Issues: Report bugs and request features

🎯 Roadmap

  • Docker containerization for Choreo
  • Advanced rate limiting
  • Analytics dashboard
  • Multi-language support expansion
  • Mobile app (React Native)

Built with ❀️ for Sri Lankan students and developers

πŸ‡±πŸ‡° ΰΆ…ΰΆ΄ΰ·’ΰΆ½ΰΆœΰ·š AI - ΰ·ΰ·Šβ€ΰΆ»ΰ·“ ΰΆ½ΰΆ‚ΰΆšΰ·ΰ·€ΰ·š ΰΆ…ΰΆ±ΰ·ΰΆœΰΆ­ΰΆΊ

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •