Foxie is an AI-powered code scaffolding platform designed to supercharge your FastAPI development workflow.
It automatically generates complete CRUD modules β models, schemas, CRUD logic, endpoints, routers, and more β with a hybrid approach combining AI generation and template-based code.
β¨ Latest Features: Hybrid generation approach - template-based authentication for speed and reliability, combined with AI-powered core CRUD generation!
Powered by Google Gemini, Foxie brings intelligent code generation to your fingertips β following best practices for scalable, production-ready FastAPI applications.
Foxie uses a hybrid generation strategy for optimal speed, quality, and cost-effectiveness:
| Component | Method | Speed | Quality | Benefits |
|---|---|---|---|---|
| Core CRUD | AI-powered (Gemini) | β‘β‘β‘ Fast | ββββ Excellent | Flexible, adapts to your needs |
| Authentication | Template-based (Jinja2) | β‘β‘β‘β‘ Fastest | βββββ Perfect | Consistent, reliable, cost-free |
Why Hybrid?
- β Faster: Templates generate auth files instantly (no API calls)
- β Cheaper: Reduces LLM API usage by ~40% when auth is enabled
- β More Reliable: Templates ensure consistent, tested auth code
- β Database-Aware: Templates automatically adapt to SQL or MongoDB
- β Production-Ready: Auth code follows security best practices
Foxie follows a microservice architecture for flexibility, maintainability, and scalability β all managed with Docker Compose.
The backend service handles all AI-related operations.
- Built with FastAPI
- Exposes REST APIs to receive scaffolding requests
- Uses Google Gemini and RAG (Retrieval-Augmented Generation) for structured code generation
- β¨ Main endpoint:
/scaffold- Hybrid generation (AI for core CRUD + templates for auth)
- Produces full CRUD modules (models, schemas, endpoints, etc.)
The command-line interface (CLI) provides the developer-facing interaction.
- Built with Typer (for CLI UX) and Rich (for output styling)
- β¨ Interactive mode - Prompts for all configuration options
- Calls appropriate
foxie-backendAPI endpoint - Writes generated files locally
- Shows generation progress and file summaries
- Outputs setup instructions for the new project
π‘ This separation ensures the AI-heavy backend can scale independently, while the CLI remains lightweight and portable.
| Layer | Technologies |
|---|---|
| Backend | FastAPI, Google Generative AI SDK, Pydantic, python-dotenv, Uvicorn, Jinja2 |
| CLI | Typer[rich], Requests, Pydantic |
| AI Model | Google Gemini (via API) |
| Templates | Jinja2 templates for authentication files |
| Orchestration | Docker, Docker Compose |
| Package Management | uv |
Before getting started, ensure you have:
- π Python 3.11+ installed
- π Backend deployed (or running locally) - See Backend Setup below
- π A Google Gemini API key β Get your API key
Foxie needs a Google Gemini API key to function. You have multiple options to provide it:
foxie configThis saves your key to ~/.config/foxie/config.env for future use.
Set the GOOGLE_API_KEY environment variable:
Windows (PowerShell):
$env:GOOGLE_API_KEY="your-api-key-here"Linux/macOS:
export GOOGLE_API_KEY="your-api-key-here"Create a .env file in your project directory:
# .env
GOOGLE_API_KEY=your-api-key-hereCreate ~/.config/foxie/config.env manually (follows XDG Base Directory specification):
Windows:
New-Item -Path "$HOME\.config\foxie" -ItemType Directory -Force
Set-Content -Path "$HOME\.config\foxie\config.env" -Value "GOOGLE_API_KEY=your-api-key-here"Linux/macOS:
mkdir -p ~/.config/foxie
echo "GOOGLE_API_KEY=your-api-key-here" > ~/.config/foxie/config.envFoxie checks for your API key in this order (highest priority first):
- β
GOOGLE_API_KEYenvironment variable - β
.envfile in current directory - β
~/.config/foxie/config.envfile (standard config location) - β Interactive prompt (if none found)
The Foxie backend can be run in two ways:
- Deploy the
foxie-backendservice on Render - Set environment variables (if needed):
HOST(default:0.0.0.0)PORT(default:8000)GEMINI_MODEL(default:gemini-2.5-flash)
- Configure your CLI to use the deployed backend URL (see above)
Note: The backend doesn't require GOOGLE_API_KEY - users provide their own keys via the CLI.
For local development:
# Clone the repository
git clone https://github.com/Nalin7parihar/Foxie.git
cd Foxie
# Start the backend
docker-compose up -d backend
# Set the backend URL for local development
export FOXIE_BACKEND_URL="http://127.0.0.1:8000"See foxie-backend/README.md for more details.
Foxie/
βββ foxie-backend/ # FastAPI microservice ("Kitchen")
β βββ app/
β βββ Dockerfile
β βββ ...
βββ foxie-cli/ # Typer CLI ("Waiter")
β βββ src/foxie_cli/
β βββ Dockerfile
β βββ ...
βββ docker-compose.yml
βββ .env
# Just run the command and answer the prompts
foxie scaffold fastapi-crud
# The CLI will ask:
# - Project name
# - Resource name
# - Fields
# - Database type (SQL or MongoDB)
# - Enable authentication?Standard Mode:
foxie scaffold fastapi-crud \
-p blog-api \
-r post \
-f "title:str,content:str,author:str,published:bool"With Authentication:
foxie scaffold fastapi-crud \
-p ecommerce-api \
-r product \
-f "name:str,price:float,stock:int,category:str" \
-d sql \
--enable-authWhen you run Foxie, here's what happens:
-
Core CRUD Generation (AI-powered):
- Models, schemas, CRUD operations, endpoints
- Uses Google Gemini with RAG examples
- Adapts to your database type (SQL/MongoDB)
-
Authentication Generation (if enabled, template-based):
- User model, auth endpoints, JWT utilities
- Generated from Jinja2 templates (instant, no API calls)
- Automatically adapts to your database type
-
Configuration Files (static templates):
pyproject.toml- Project dependencies and configuration.env- Environment variables (database URL, secrets, etc.)- Generated automatically based on your selections
-
File Writing:
- All files written to your project directory
- Python files formatted with Black
- Ready to use!
### Multiple Resources
Generate scaffolding for different resources by running the command multiple times:
```bash
# Generate User resource
foxie scaffold fastapi-crud \
-p my-app \
-r user \
-f "username:str,email:str,age:int"
# Generate Product resource
foxie scaffold fastapi-crud \
-p my-app \
-r product \
-f "name:str,price:float,stock:int"
```
---
## π― Features
- π€ **AI-Powered Generation** β Leverages Google Gemini for intelligent code scaffolding
- π **Template-Based Auth** β Jinja2 templates for fast, reliable authentication code
- π **Full CRUD Boilerplate** β Models, schemas, CRUD operations, routers, and endpoints
- ποΈ **Multi-Database Support** β SQL (PostgreSQL/MySQL/SQLite) and MongoDB
- π **Complete Authentication** β User model, JWT tokens, protected routes
- π¨ **Auto-Formatting** β Generated code is automatically formatted with Black
- π³ **Dockerized Workflow** β Isolated, reproducible environment with Docker Compose
- π **Microservice Architecture** β Scalable backend + lightweight CLI
- π¦ **Production-Ready** β Follows FastAPI best practices out of the box
- π° **Cost-Effective** β Hybrid approach reduces API costs by ~40% when auth is enabled
## π οΈ Development
### Running Locally
For local development, you can run both backend and CLI using Docker:
```bash
# Clone the repository
git clone https://github.com/Nalin7parihar/Foxie.git
cd Foxie
# Start the backend
docker-compose up -d backend
# Run CLI commands
docker-compose run --rm cli scaffold fastapi-crud
```
### Running Tests
```bash
# Backend tests
docker-compose run --rm backend pytest
# CLI tests (from foxie-cli directory)
cd foxie-cli
pytest
```
### Hot Reload Development
For backend development with hot reload:
```bash
docker-compose up backend
```
The backend will automatically reload on code changes.
---
## π Troubleshooting
### Backend Not Starting
Check if the API key is set correctly:
```bash
docker-compose run --rm backend env | grep GOOGLE_API_KEY
```
### Permission Issues
If you encounter permission issues with generated files:
```bash
sudo chown -R $USER:$USER ./my-generated-project
```
### CLI Connection Errors
Ensure the backend is running:
```bash
docker-compose ps
```
---
## π€ Contributing
Contributions are welcome! Here's how you can help:
1. π΄ Fork the repository
2. πΏ Create a feature branch (`git checkout -b feature/amazing-feature`)
3. βοΈ Commit your changes (`git commit -m 'Add amazing feature'`)
4. π€ Push to the branch (`git push origin feature/amazing-feature`)
5. π Open a Pull Request
Please ensure your code follows the existing style and includes appropriate tests.
---
## π License
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
---
## π Acknowledgments
- [FastAPI](https://fastapi.tiangolo.com/) β Modern, fast web framework
- [Google Gemini API](https://ai.google.dev/) β Powerful AI code generation
- [Typer](https://typer.tiangolo.com/) β CLI framework with great UX
- [Docker](https://www.docker.com/) β Containerization platform
- [LangGraph](https://github.com/langchain-ai/langgraph) β Future agent orchestration
---
## π¬ Support
- π§ **Email:** nalin7parihar@gmail.com
- π **Issues:** [GitHub Issues](https://github.com/Nalin7parihar/Foxie/issues)
- π‘ **Discussions:** [GitHub Discussions](https://github.com/Nalin7parihar/Foxie/discussions)
---
<div align="center">
**π¦ Built with β€οΈ for Developers Who Code Smarter, Not Harder**
β Star this repo if you find it helpful!
</div>