Skip to content

InovacodeDev/pedagog.ia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

51 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸŽ“ Pedagog.IA

Status Next.js Supabase TypeScript

O Sistema Operacional Cognitivo para Professores

Pedagog.IA transforma fotos de provas em notas no diΓ‘rio de classe, automaticamente. CorreΓ§Γ£o em segundos, privacidade blindada, e planejamento baseado na BNCC.


✨ Features

  • πŸ“Έ Scan-to-Grade: Fotografe a prova, receba a nota corrigida pela IA
  • πŸ”’ Privacy Shield: Dados de alunos criptografados com pgcrypto (LGPD compliant)
  • ⚑ Async-First: Processamento em background via Supabase Edge Functions
  • πŸ”„ Real-time Updates: NotificaΓ§Γ΅es instantΓ’neas via Supabase Realtime
  • πŸ“± PWA Ready: Funciona offline para escolas com Wi-Fi instΓ‘vel
  • 🎯 BNCC Planning: (Roadmap) GeraΓ§Γ£o de provas baseada na Base Nacional Comum Curricular

πŸ›  Tech Stack

Layer Technology
Frontend Next.js 15 (App Router), React 19, Tailwind CSS
UI Components Shadcn/UI, Radix UI
Backend Supabase (PostgreSQL, Auth, Storage, Realtime)
Compute Supabase Edge Functions (Deno)
AI OpenAI GPT-4 Vision / Anthropic Claude (Mock for MVP)
State TanStack Query, Zustand
Validation Zod
Testing Vitest, React Testing Library

πŸš€ Quick Start

Prerequisites

  • Node.js 22+ (LTS)
  • pnpm 9+
  • Docker (for local Supabase)
  • Supabase CLI (install: npm i -g supabase)

Installation

# 1. Clone the repository
git clone https://github.com/your-org/pedagog_ai.git
cd pedagog_ai

# 2. Install dependencies
pnpm install

# 3. Copy environment variables
cp .env.example .env.local
# Edit .env.local with your Supabase credentials

# 4. Start local Supabase (Docker required)
npx supabase start

# 5. Run database migrations
npx supabase db reset

# 6. (Optional) Seed test data
psql -h localhost -p 54322 -U postgres -d postgres -f supabase/seed.sql

# 7. Start the development server (Runs on port 9901)
pnpm dev

Open http://localhost:9901 πŸŽ‰

πŸ”‘ Environment Variables

Create a .env.local file with the following keys:

# App
NEXT_PUBLIC_APP_URL=http://localhost:9901

# Supabase
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key

# Stripe
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...

# Web Push (VAPID Keys)
# Generate with: npx web-push generate-vapid-keys
NEXT_PUBLIC_VAPID_PUBLIC_KEY=your_public_key
VAPID_PRIVATE_KEY=your_private_key
VAPID_SUBJECT=mailto:support@pedagog.ia

# Auth
NEXTAUTH_SECRET=your_generated_secret # Generate with: openssl rand -base64 32
NEXTAUTH_URL=http://localhost:9901

πŸ’³ Stripe Webhook Setup

To test Stripe webhooks locally:

  1. Install Stripe CLI
  2. Login: stripe login
  3. Listen to events forwarding to port 9901:
stripe listen --forward-to localhost:9901/api/webhooks/stripe
  1. Copy the whsec_... secret to your .env.local as STRIPE_WEBHOOK_SECRET.

πŸ“ Project Structure

pedagog_ai/
β”œβ”€β”€ app/                      # Next.js App Router
β”‚   β”œβ”€β”€ (auth)/              # Public auth pages
β”‚   β”œβ”€β”€ (dashboard)/         # Protected dashboard routes
β”‚   β”œβ”€β”€ globals.css          # Design system CSS variables
β”‚   └── layout.tsx           # Root layout with fonts
β”œβ”€β”€ components/              # React components
β”‚   β”œβ”€β”€ ui/                  # Shadcn/UI components
β”‚   └── landing/             # Landing page sections
β”œβ”€β”€ hooks/                   # Custom React hooks
β”‚   └── use-job-monitor.ts   # Real-time job status hook
β”œβ”€β”€ lib/                     # Utilities
β”‚   β”œβ”€β”€ supabase/            # Supabase clients
β”‚   └── utils.ts             # Helper functions
β”œβ”€β”€ server/                  # Server-side logic
β”‚   └── actions/             # Server Actions
β”‚       β”œβ”€β”€ exams.ts         # Exam upload logic
β”‚       └── students.ts      # Student CRUD (encrypted)
β”œβ”€β”€ supabase/
β”‚   β”œβ”€β”€ functions/           # Edge Functions (Deno)
β”‚   β”‚   └── process-job/     # Async job processor
β”‚   β”œβ”€β”€ migrations/          # Database schema
β”‚   └── seed.sql             # Test data
β”œβ”€β”€ types/                   # TypeScript definitions
β”‚   └── database.ts          # Supabase types
└── docs/                    # Documentation
    β”œβ”€β”€ tdd.md               # Technical Design Doc
    β”œβ”€β”€ ui_ux.md             # Design System Spec
    └── SETUP.md             # Detailed setup guide

πŸ” Security & Privacy

Encryption at Rest

Student names are never stored in plain text. We use PostgreSQL's pgcrypto extension:

  1. Client sends plain text name to Server Action
  2. Server Action calls RPC create_secure_student
  3. Database encrypts with pgp_sym_encrypt before storage
  4. Decryption only happens server-side via get_students_decrypted RPC

Row Level Security (RLS)

All tables have RLS enabled. Users can only access:

  • Their own jobs (background_jobs)
  • Students from their institution (students)
  • Their own profile (profiles)

πŸ§ͺ Testing

# Run unit tests
pnpm test

# Run tests in watch mode
pnpm test --watch

# Type check
pnpm type-check

# Lint
pnpm lint

πŸ“š Documentation


🚒 Deployment

Vercel (Frontend)

# Deploy to Vercel
vercel --prod

Supabase (Backend)

# Deploy database migrations
npx supabase db push

# Deploy Edge Functions
npx supabase functions deploy process-job

πŸ›£ Roadmap

  • Core OCR pipeline (Mock)
  • Student encryption (Privacy Shield)
  • Real-time job monitoring
  • OpenAI GPT-4 Vision integration
  • BNCC-based exam generation
  • Web Push notifications
  • Mobile app (React Native)
  • Analytics dashboard

πŸ“„ License

MIT License - See LICENSE for details.


🀝 Contributing

We welcome contributions! Please read our Contributing Guide first.


πŸ’¬ Support


Built with ❀️ for teachers who deserve their weekends back.

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •