Skip to content

Latest commit

Β 

History

History
144 lines (123 loc) Β· 4.89 KB

File metadata and controls

144 lines (123 loc) Β· 4.89 KB

AITutor - Project Structure

πŸ“ Folder Organization

aitutor/
β”œβ”€β”€ πŸ“„ README.md                 # Main project documentation
β”œβ”€β”€ πŸ“„ .gitignore               # Git ignore rules
β”œβ”€β”€ πŸ“ .github/                 # GitHub workflows
β”‚   └── workflows/
β”‚       β”œβ”€β”€ ci.yml             # CI/CD pipeline
β”‚       └── docker.yml         # Docker build and push
β”œβ”€β”€ πŸ“ src/                    # Source code
β”‚   β”œβ”€β”€ πŸ“ backend/            # FastAPI backend application
β”‚   β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”‚   └── api/
β”‚   β”‚   β”œβ”€β”€ venv/               # Python virtual environment
β”‚   β”‚   β”œβ”€β”€ requirements.txt    # Python dependencies
β”‚   β”‚   β”œβ”€β”€ Dockerfile          # Backend Docker configuration
β”‚   β”‚   └── .env.example        # Environment variables template
β”‚   └── πŸ“ frontend/           # Next.js frontend application
β”‚       β”œβ”€β”€ app/
β”‚       β”‚   β”œβ”€β”€ components/
β”‚       β”‚   β”œβ”€β”€ hooks/
β”‚       β”‚   β”œβ”€β”€ lib/
β”‚       β”‚   └── types/
β”‚       β”œβ”€β”€ public/
β”‚       β”œβ”€β”€ Dockerfile          # Frontend Docker configuration
β”‚       β”œβ”€β”€ package.json        # Node.js dependencies
β”‚       └── .env.example        # Environment variables template
β”œβ”€β”€ πŸ“ scripts/                # Utility scripts
β”‚   β”œβ”€β”€ setup.sh               # Initial setup script
β”‚   β”œβ”€β”€ start.sh               # Development startup script
β”‚   β”œβ”€β”€ package.json           # Node.js package management
β”‚   └── package-lock.json      # Locked dependencies
β”œβ”€β”€ πŸ“ deployment/             # Deployment configurations
β”‚   └── docker-compose.yml     # Development Docker setup
β”œβ”€β”€ πŸ“ config/                 # Configuration files
β”‚   └── docker-compose.prod.yml # Production Docker setup
β”œβ”€β”€ πŸ“ docs/                   # Documentation
β”‚   β”œβ”€β”€ README.md              # Main README (copied to root)
β”‚   β”œβ”€β”€ SYSTEM_STATUS.md       # System status guide
β”‚   β”œβ”€β”€ TROUBLESHOOTING.md     # Troubleshooting guide
β”‚   β”œβ”€β”€ SWIPE_CARDS_GUIDE.md   # UI component guide
β”‚   └── [other docs...]        # Additional documentation
β”œβ”€β”€ πŸ“ hackathon/              # Hackathon-specific files
β”‚   └── README.md              # Hackathon project description
β”œβ”€β”€ πŸ“ assets/                 # Static assets
β”‚   └── README.md              # Assets documentation
└── πŸ“ node_modules/           # Node.js dependencies (auto-generated)

Quick Start

1. Setup

# Clone the repository
git clone <repository-url>
cd aitutor

# Run setup script
chmod +x scripts/setup.sh
./scripts/setup.sh

2. Configure

# Add your OpenRouter API key
echo "OPENROUTER_API_KEY=your_key_here" >> src/backend/.env

3. Start Development

# Start both frontend and backend
./scripts/start.sh

4. Access Application

Architecture

Backend (FastAPI)

  • Port: 8000
  • Framework: FastAPI with Python 3.12
  • Main Components:
    • app/core/config.py - Configuration management
    • app/models/schemas.py - Data models
    • app/services/api_service.py - External API integration
    • app/api/routes/tutor.py - API endpoints

Frontend (Next.js)

  • Port: 3000
  • Framework: Next.js 14 with TypeScript
  • Main Components:
    • app/components/ - React components
    • app/hooks/ - Custom React hooks
    • app/lib/ - Utility functions
    • app/types/ - TypeScript definitions

Development Workflow

Local Development

  1. Backend: uvicorn app.main:app --reload --port 8000
  2. Frontend: npm run dev
  3. Both: ./scripts/start.sh

Production Deployment

# Using Docker
docker-compose -f config/docker-compose.prod.yml up -d

CI/CD

  • GitHub Actions: Automated testing and deployment
  • Docker: Containerized deployment
  • Health Checks: Automated monitoring

Key Files

File Purpose
scripts/setup.sh Initial project setup
scripts/start.sh Development server startup
src/backend/.env.example Backend environment template
src/frontend/.env.example Frontend environment template
deployment/docker-compose.yml Development Docker setup
config/docker-compose.prod.yml Production Docker setup

🎯 Next Steps

  1. Environment Setup: Run the setup script
  2. API Configuration: Add your OpenRouter API key
  3. Development: Use start script for local development
  4. Deployment: Use Docker for production deployment

This structure follows GitHub and hackathon best practices for web applications.