A full-stack application for creating AI-powered presentations using Gemini models. The system consists of a FastAPI backend wrapping MCP tools and a Next.js frontend.
powerit/
├── backend/ # FastAPI backend & MCP tools
│ ├── tools/ # MCP presentation tools
│ ├── config.py # Configuration and environment
│ ├── models.py # Pydantic data models
│ ├── database.py # SQLite database with SQLAlchemy
│ ├── api.py # FastAPI application wrapper
│ ├── server.py # FastMCP server
│ ├── routers/ # FastAPI route modules
│ │ ├── presentations.py
│ │ ├── images.py
│ │ ├── logos.py
│ │ └── pptx.py
│ └── ...
└── frontend/ # Next.js frontend application
├── app/ # Next.js app router
├── components/ # React components
├── lib/ # Utilities and API client
└── ...
- Research: Researches a topic and generates comprehensive markdown content with sources
- Slides: Creates structured presentation slides based on research results
- AI Wizard Assistant: Context-aware AI assistant that helps modify research, slides, and presentations
- Web Interface: Modern UI for managing presentations and running tools
- Background Processing: Tasks run asynchronously with status tracking
- Database Storage: Persistent storage of presentations and results
- Integrated API: Frontend connects to backend via API for seamless operation
- Static Export: Frontend can be built as static HTML/JS/CSS for easy deployment
Run the following commands while your machine still has internet access to download all dependencies:
cd backend
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
deactivate
cd ../frontend && npm install
cd ../testing && npm install && npx playwright install
cd ..-
Navigate to the backend directory:
cd backend -
Create the virtual environment and install dependencies (run while the machine has internet access):
python3 -m venv venv source venv/bin/activate pip install -r requirements.txt deactivate -
Configure environment variables:
cd backend cp .env.example .env # Edit .env with your API keys: # - GEMINI_API_KEY=your_gemini_api_key_here # - OPENAI_API_KEY=your_openai_api_key_here
See
backend/.env.examplefor all available configuration options including AI models, generation parameters, and more.
-
Navigate to the frontend directory:
cd frontend -
Install dependencies:
npm install -
For production builds, create a
.env.productionfile with your backend URL:NEXT_PUBLIC_API_URL=http://your-backend-url:8000
You can run both the backend and frontend together using:
./run.sh
Or run them separately:
To run the backend without internet access, set POWERIT_OFFLINE=1. All calls to
Gemini, OpenAI and logo fetching will be served from the recorded VCR fixtures.
export POWERIT_OFFLINE=1
./run.shcd backend
./venv/bin/python run_api.py
The backend will be available at http://localhost:8000 with API documentation at http://localhost:8000/docs
cd frontend
npm run dev
The frontend will be available at http://localhost:3000
The frontend can be built as a static site for deployment to any static hosting service:
cd frontend
npm run build
This will generate a static build in the build directory. You can then deploy this build to any static hosting service like:
- Netlify
- Vercel
- GitHub Pages
- Amazon S3
- Cloudflare Pages
Example deployment with a simple static server:
cd frontend/build
npx serve
This will serve the static build at http://localhost:3000.
The frontend communicates with the backend through the API. The integration works as follows:
- Frontend makes API calls to the backend using the API client in
frontend/lib/api.ts - Backend processes requests and returns responses in JSON format
- CORS is enabled on the backend to allow requests from the frontend
- Open http://localhost:3000 in your browser
- Create a new presentation with a name and topic
- Wait for the research step to complete
- View and edit research results using the AI Wizard:
- Click on the Research step to view research content
- Use the AI Wizard on the right to request modifications
- Click "Apply" to update the research with suggested changes
- Run the slides generation step
- View and edit the generated slides with the AI Wizard
- Export the final presentation as a PowerPoint file
GET /presentations- List all presentationsPOST /presentations- Create a new presentationGET /presentations/{id}- Get presentation detailsPOST /presentations/{id}/steps/{step_name}/run- Run a presentation stepPUT /presentations/{id}/steps/{step_name}- Update step resultsPOST /presentations/{id}/wizard- Process wizard requests for AI assistancePUT /presentations/{id}/research- Save modified research content
If you encounter an error about missing system libraries when running make setup on Linux, such as:
Host system is missing dependencies to run browsers.
Missing libraries:
libgtk-4.so.1
libwoff2dec.so.1.0.2
libvpx.so.9
...
This is a common issue on Linux systems where Playwright needs additional system dependencies to run browsers.
Quick Fix:
-
Run the provided dependency fix script:
./check_playwright_deps.sh
-
Or manually install the dependencies:
cd testing npx playwright install-deps -
Then continue with normal setup:
make setup
Alternative Solutions:
- Use the Make target:
make install-browser-deps - On Ubuntu/Debian systems, you can also install system dependencies directly:
sudo apt-get update sudo apt-get install -y libgtk-3-0 libgtk-4-1 libasound2 libxss1 libgconf-2-4 libxtst6 libxrandr2 libnss3 libgbm1
If you have issues with Python dependencies:
-
Ensure you're using Python 3.8 or higher:
python3 --version
-
Recreate the virtual environment:
cd backend rm -rf venv python3 -m venv venv source venv/bin/activate pip install --upgrade pip pip install -r requirements.txt
If you encounter Node.js or npm-related errors:
-
Ensure you're using Node.js 16 or higher:
node --version npm --version
-
Clear npm cache and reinstall:
cd frontend # or testing rm -rf node_modules package-lock.json npm install
If you get "port already in use" errors:
-
Check what's using the ports:
lsof -i :3000 # Frontend lsof -i :8000 # Backend
-
Kill the processes or use different ports:
kill -9 <PID>
If you encounter database-related errors:
-
Remove the database file and let it recreate:
rm presentations.db
-
The database will be automatically recreated on the next backend startup.
The project uses pytest for testing with a VCR (Virtual Cassette Recorder) pattern to mock API calls to Gemini and OpenAI. This ensures tests are fast, reliable, and don't incur costs from repeated API calls.
- Use VCR for API calls: All external API calls (Gemini, OpenAI) should use VCR fixtures
- Run tests in isolation: Tests should not depend on each other
- Use virtual environment: Always run tests in the provided virtual environment
- Clean up after tests: Remove temporary files/resources created during tests
- Use valid slide types: Tests should use valid slide types from the
SLIDE_TYPESconfig
By default, tests run in replay mode, using pre-recorded fixtures instead of making real API calls:
cd backend
./run_tests.shTo run specific test files or directories:
./run_tests.sh tests/test_images.py
./run_tests.sh tests/test_integration_research.pyWith specific pytest options:
./run_tests.sh tests/test_images.py -v
./run_tests.sh -k "test_generate_image"When you need to verify tests with actual API calls or record new fixtures:
# Run all tests with real API calls
cd backend
GEMINI_VCR_MODE=record OPENAI_VCR_MODE=record ./run_tests.sh
# Or use the convenience script for a specific test
./record_tests.sh tests/test_images.pyFor comprehensive verification with all types of API calls:
# Run all tests with all real API calls (complete verification)
cd backend
GEMINI_VCR_MODE=record OPENAI_VCR_MODE=record PRESENTATION_VCR_MODE=record \
TOC_FONT_VCR_MODE=record TEMPLATE_PPTX_VCR_MODE=record IMAGE_API_VCR_MODE=record \
./run_tests.shRequirements for using real API calls:
- Valid API keys in
.envfile:GEMINI_API_KEYfor Gemini API testsOPENAI_API_KEYfor OpenAI/image generation tests
- Internet connection
- Note that this will make actual API calls and may incur costs
When adding new tests:
-
Image Generation Tests:
- Always use the VCR fixtures (
mock_openai_responses) - Use valid slide types from
SLIDE_TYPESconfig - Check that result objects match the expected structure
- Always use the VCR fixtures (
-
Gemini API Tests:
- Use the Gemini VCR fixtures (
mock_gemini_responses) - Record fixtures for new test cases
- Use the Gemini VCR fixtures (
-
Slide Tests:
- Make sure test slides have valid types and fields
- Use
SLIDE_TYPESfromtools.slide_configfor reference
Common test issues:
-
Missing fixtures:
- Run the test in record mode:
./record_tests.sh path/to/test.py
- Run the test in record mode:
-
Model schema changes:
- Check if models in
models.pyhave been updated - Update test objects to match the current schema
- Check if models in
-
VCR issues:
- Check the fixtures directory for corrupt/invalid fixtures
- Delete problematic fixtures and re-record
-
API errors in recording mode:
- Verify API keys are valid and have necessary permissions
- Check API quotas and limits
GEMINI_VCR_MODE=record- Records actual Gemini API callsOPENAI_VCR_MODE=record- Records actual OpenAI API calls- Tests use the configuration from
backend/tests/test_config.pyinstead of the real config - Test fixtures are stored in
backend/tests/fixtures/ - Dummy images for testing are in
backend/tests/test_data/