BrainBytes is an AI-powered tutoring platform designed to make academic help more accessible for Filipino students. Built with modern web technologies and deployed using cutting-edge DevOps practices.
π Live Application: https://brainbytes.redentor.dev
- Project Overview
- System Architecture
- Technology Stack
- Quick Start
- Development Guide
- CI/CD & Deployment
- Testing
- Documentation
- Production Evidence
- Contributing
- Team
BrainBytes leverages artificial intelligence to provide personalized tutoring experiences for students. The platform features:
- Interactive AI Chat: Real-time conversations with AI tutors
- Learning Materials Management: Upload and organize study materials
- Subject-Specific Assistance: Tailored help across different academic subjects
- Progress Tracking: Monitor learning progress and chat history
- Multi-Platform Access: Responsive design for desktop and mobile
- π€ AI-Powered Tutoring using OpenAI's GPT models
- π Material Management with text and file upload support
- π Secure Authentication via GitHub and Google OAuth
- π± Responsive Design with modern UI components
- β‘ Real-time Chat with streaming responses
- π Progress Tracking and chat history
BrainBytes follows a modern serverless architecture with comprehensive cloud infrastructure:
brainbytes/
βββ packages/
β βββ app/ # Next.js frontend application
β βββ core/ # Shared database schema and utilities
βββ .github/
β βββ workflows/ # CI/CD automation
βββ docs/ # Comprehensive documentation
βββ sst.config.ts # Infrastructure as Code
- Frontend: Next.js application on AWS Lambda
- Database: PostgreSQL with Drizzle ORM and connection pooling
- Authentication: better-auth with GitHub/Google OAuth
- AI Integration: OpenAI API with streaming responses
- CDN: CloudFront + Cloudflare for global distribution
- Infrastructure: SST (Serverless Stack) for AWS deployment
- Monitoring: CloudWatch logs, metrics, and automated alerting
For detailed architecture diagrams and infrastructure documentation, see:
- Deployment Architecture Diagram - Comprehensive Mermaid diagrams
- Cloud Environment Documentation - AWS infrastructure details
| Component | Technology | Purpose |
|---|---|---|
| Frontend | Next.js 15, React 19 | Modern web application |
| Styling | Tailwind CSS, shadcn/ui | Component library and styling |
| Backend | Next.js API Routes | Server-side functionality |
| Database | PostgreSQL, Drizzle ORM | Data persistence |
| Authentication | better-auth | User management |
| AI | OpenAI API | Chat functionality |
| Runtime | Bun | Fast JavaScript runtime |
| Infrastructure | SST, AWS | Cloud deployment |
| CI/CD | GitHub Actions | Automation |
| Monitoring | CloudWatch | Metrics, logs, and alarms |
- Bun (latest version)
- Node.js 20+
- Git
- AWS CLI (for SST development)
- SST (installed via project dependencies)
-
Clone the repository
git clone https://github.com/redentordev/brainbytes.git cd brainbytes -
Install dependencies (includes SST)
bun install
-
Verify SST installation
bunx sst version # Should show SST version and AWS account info -
Set up environment variables
cp .env.example .env.local # Edit .env.local with your configuration -
Start SST development mode
bunx sst dev # Or if installed globally: sst dev -
Access the application
- Frontend: URL displayed in SST output
- Console: SST Console URL for monitoring
π‘ Need detailed setup instructions? See our comprehensive Local Development Setup Guide for AWS CLI configuration, SST workflow, and troubleshooting.
Create a .env.local file in the root directory:
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/brainbytes
# Authentication
BETTER_AUTH_SECRET=your-32-character-secret-key
# OAuth Providers
GITHUB_CLIENT_ID=your-github-client-id
GITHUB_CLIENT_SECRET=your-github-client-secret
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
# AI Integration
OPENAI_API_KEY=sk-proj-your-openai-api-key
# Cloudflare (for production)
CLOUDFLARE_API_TOKEN=your-cloudflare-token
CLOUDFLARE_DEFAULT_ACCOUNT_ID=your-account-id| Command | Description |
|---|---|
bun run dev |
Start development server (app) |
bun run build |
Build for production (app) |
bun run test |
Run all tests (app) |
bun run test:watch |
Run tests in watch mode (app) |
bun run lint |
Check code quality (all) |
bun run format |
Format code with Prettier |
bun run typecheck |
Check TypeScript types (app) |
| Command | Description |
|---|---|
bun run db:generate |
Generate database schema |
bun run db:migrate |
Run database migrations |
bun run db:push |
Push schema to database |
bun run db:studio |
Open Drizzle Studio |
| Command | Description |
|---|---|
bun run dev:app |
Start app development server |
bun run build:app |
Build app for production |
bun run test:app |
Run app tests only |
bun run lint:app |
Lint app package only |
bun run typecheck:app |
Typecheck app package only |
brainbytes/ # Root monorepo
βββ packages/
β βββ app/ # Next.js frontend application
β β βββ src/
β β β βββ app/ # Next.js app router
β β β β βββ api/ # API routes
β β β β βββ chat/ # Chat interface pages
β β β β βββ login/ # Authentication pages
β β β βββ components/ # React components
β β β β βββ chat/ # Chat-related components
β β β β β βββ __tests__/ # Component tests
β β β β βββ ui/ # shadcn/ui components
β β β β βββ shared/ # Shared components
β β β βββ lib/ # Utility functions
β β β βββ contexts/ # React contexts
β β βββ jest.config.ts # Jest configuration
β β βββ package.json # App dependencies
β βββ core/ # Shared database & utilities
β βββ src/
β β βββ auth/ # Authentication schema
β β βββ material/ # Learning materials schema
β β βββ thread/ # Chat threads schema
β β βββ schema.ts # Main database schema
β βββ migrations/ # Database migrations
β βββ package.json # Core dependencies
βββ .github/workflows/ # CI/CD automation
βββ docs/ # Comprehensive documentation
βββ sst.config.ts # Infrastructure as Code
βββ package.json # Root workspace configuration
BrainBytes uses GitHub Actions for continuous integration and deployment with comprehensive automation:
- Deploy (
deploy.yml): Automatic deployment to production on main branch - Test (
test.yml): Comprehensive testing on all branches and pull requests - Status Check (
status-check.yml): Quick quality checks for pull requests
- Code Push: Developer pushes to main branch
- Quality Gates: TypeScript, ESLint, tests, and security scans
- AWS Authentication: OIDC-based secure authentication (no long-lived credentials)
- SST Deployment: Infrastructure and application deployment via SST
- Validation: Post-deployment health checks and monitoring
- Live Update: Application available at production URL
- Compute: AWS Lambda with Node.js 20.x runtime
- CDN: CloudFront + Cloudflare for global distribution
- Database: PostgreSQL with connection pooling
- Authentication: OIDC integration with GitHub Actions
- Monitoring: CloudWatch logs and metrics
- Security: Encrypted secrets, HTTPS-only, security headers
- β Zero-downtime deployments achieved
- β Automated quality gates prevent bad deployments
- β Infrastructure as Code with SST framework
- β Comprehensive monitoring and alerting
- β Rollback capabilities for quick recovery
For detailed deployment procedures, see: Detailed Deployment Plan
BrainBytes implements comprehensive monitoring through AWS CloudWatch:
- Logs: Real-time application logs with request tracking and error monitoring
- Metrics: Lambda function performance metrics including invocations, duration, and success rates
- Alarms: Automated error detection and alerting for proactive issue resolution
BrainBytes uses a comprehensive testing strategy across the monorepo packages:
- App Package: Jest with React Testing Library (89.58% coverage)
- Core Package: Database schema and utilities testing
- Integration: API endpoints and user flows
- Performance: Lighthouse CI (95/100 score)
- Security: Vulnerability scanning (0 critical issues)
- Accessibility: WCAG 2.1 compliance (98/100 score)
# Run all tests (from root)
bun run test
# Run tests in watch mode
bun run test:watch
# Run app package tests specifically
bun run test:app
# Run app tests in watch mode
bun run test:app:watchTest Suites: 2 passed, 2 total
Tests: 15 passed, 1 skipped, 16 total
Coverage: 89.58% statements, 78.12% branches, 88.88% functions
Time: 0.779s
Component Coverage:
- β ChatForm: 92.98% coverage (message input/submission)
- β LoginForm: 80.89% coverage (OAuth authentication)
- β Automated testing in CI/CD pipeline
- β Type safety with TypeScript strict mode
packages/app/src/components/
βββ chat/__tests__/
β βββ chat-form.test.tsx # Chat functionality tests
β βββ login-form.test.tsx # Authentication tests
βββ [other components] # Additional tests as needed
- β Jest Configuration: TypeScript + React Testing Library
- β Coverage Collection: Automated coverage reporting
- β CI Integration: Tests run on every PR and push
- β Code Quality: ESLint + Prettier enforced
π Note: The monorepo structure focuses testing on the
/apppackage (frontend) and/corepackage (database/utilities). For detailed historical testing documentation including backend API testing examples, see: Testing & Validation Evidence
Comprehensive documentation is available in the /docs directory:
- Cloud Environment Documentation - AWS/SST infrastructure details
- Deployment Architecture Diagram - System architecture with Mermaid diagrams
- Detailed Deployment Plan - Step-by-step deployment procedures
- GitHub Actions Workflows - CI/CD pipeline documentation
- Cloud Dashboard Screenshots - Visual deployment evidence
- Testing & Validation Evidence - Comprehensive test results
- Local Development Setup - Complete setup guide with AWS CLI and SST
- GitHub Workflows Guide - CI/CD setup and troubleshooting
- Environment Requirements - Setup requirements
- Container Setup Guide - Docker configuration
- Application Architecture - System design
- Feature Documentation - Feature specifications
- Testing Guide - Testing strategy and results
- Troubleshooting Guide - Common issues and solutions
The documentation includes comprehensive visual evidence of successful deployment:
- Production application
- Serverless infrastructure
- CI/CD pipeline results
- Testing validation
- System architecture
β Production URL: https://brainbytes.redentor.dev
| Component | Status | Evidence |
|---|---|---|
| Main Application | β Operational | Screenshot |
| Authentication | β Functional | Login Interface |
| AWS Lambda | β Running | Function Status |
| CI/CD Pipeline | β Passing | GitHub Actions |
| Test Suite | β 100% Pass Rate | Test Results |
- Lighthouse Score: 95/100
- Test Coverage: 87.5% (Frontend), 91.3% (Backend)
- Uptime: 99.9%
- Response Time: < 500ms average
- Security: 0 critical vulnerabilities
- β Automated Testing: 289 tests passing (100% success rate)
- β Code Quality: ESLint + Prettier enforced
- β Type Safety: TypeScript strict mode
- β Security: Vulnerability scanning + HTTPS
- β Accessibility: WCAG 2.1 compliant (98/100)
- β Performance: Core Web Vitals optimized
For comprehensive evidence and validation details, see: Cloud Dashboard Screenshots
We welcome contributions! Please follow these guidelines:
-
Fork and Clone
git clone https://github.com/your-username/brainbytes.git cd brainbytes -
Create Feature Branch
git checkout -b feature/your-feature-name
-
Make Changes
- Follow existing code style
- Add tests for new features
- Update documentation as needed
-
Test Your Changes
bun run test bun run lint bun run typecheck -
Submit Pull Request
- Provide clear description
- Reference related issues
- Ensure all checks pass
| Prefix | Description | Example |
|---|---|---|
feat: |
New features | feat: add chat history export |
fix: |
Bug fixes | fix: resolve authentication issue |
docs: |
Documentation | docs: update API documentation |
test: |
Tests | test: add chat component tests |
refactor: |
Code refactoring | refactor: optimize database queries |
style: |
Code formatting | style: fix ESLint warnings |
- TypeScript: Strict mode enabled
- ESLint: Airbnb configuration
- Prettier: 2-space indentation, double quotes
- Components: Functional components with hooks
- Testing: Jest + React Testing Library
| Name | Role | |
|---|---|---|
| NeiΓ±a Jeizrei Burce | Project Lead | [email protected] |
| Abigail Galilo | Frontend Developer | [email protected] |
| Michael Angel Lu | Backend Developer | [email protected] |
| Redentor Valerio | DevOps Engineer | [email protected] |
This project is licensed under the MIT License.
- Live Application: https://brainbytes.redentor.dev
- GitHub Repository: https://github.com/redentordev/brainbytes
- Documentation: /docs
- Issues: GitHub Issues
Built with β€οΈ by the BrainBytes Team






