A full-stack web application for exploring and generating AI images using Fal.ai
FalLab is a modern, feature-rich web application that provides an intuitive interface to explore AI image generation models from Fal.ai. Users can browse available models, view their details organized by category, and generate stunning AI images with custom prompts and parameters.
Key Features:
- ๐จ Model Discovery - Browse 50+ AI image generation models organized by category
- โจ Interactive Playground - Generate images with real-time parameter tuning
- ๐ Model Details - View comprehensive information about each model including descriptions and thumbnails
- ๐ Async Generation - Queue-based image generation with real-time status polling
- ๐พ Conversation History - Save and revisit your generation sessions
- ๐ High Performance - Built with modern technologies for lightning-fast response times
- ๐ Secure - Production-ready backend with proper error handling and validation
| Technology | Purpose |
|---|---|
| Next.js 13+ | React framework with App Router and server components |
| React 18 | UI component library |
| TypeScript | Type-safe JavaScript development |
| TailwindCSS | Utility-first CSS styling |
| Shadcn/ui | High-quality React components |
| React Hook Form | Form state management |
| Zod | Schema validation |
| Technology | Purpose |
|---|---|
| FastAPI | Modern Python web framework |
| Python 3.10+ | Server runtime |
| Celery | Async task queue for image generation |
| Redis | Message broker and caching |
| Fal.ai SDK | AI image generation models integration |
| Pydantic | Data validation and serialization |
| Technology | Purpose |
|---|---|
| Docker | Container orchestration |
| Docker Compose | Multi-container orchestration |
| Postman | API testing and documentation |
| Git | Version control |
- Node.js 18+ and npm/bun
- Python 3.10+
- Docker & Docker Compose (for containerized setup)
- Fal.ai API Key (free tier available at fal.ai)
- Redis (automatically set up with Docker)
git clone https://github.com/yashksaini-coder/FalLab.git
cd FalLabcd backend
# Create Python virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Create .env file
cp .env.local .env
# Add your Fal.ai API key
echo "FAL_KEY=your_api_key_here" >> .envcd ../frontend
# Install dependencies
npm install
# or
bun install
# Create .env.local if needed
# The frontend automatically connects to http://localhost:8000cd backend
# Start all services (FastAPI, Redis, Celery workers)
docker-compose up --build
# In another terminal, start the frontend
cd ../frontend
npm run dev- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Docs: http://localhost:8000/docs
Terminal 1 - Backend:
cd backend
python run.pyTerminal 2 - Celery Worker:
cd backend
celery -A app.workers.celery_app worker --loglevel=infoTerminal 3 - Frontend:
cd frontend
npm run dev- Navigate to
/modelspage - Filter by category using the left sidebar
- Search for specific models
- Click on any model to view full details
- Go to
/playground - Select a model from the dropdown
- Enter your prompt describing the image you want
- Click "Generate"
- Watch real-time status updates
- Your generated image appears in the conversation
- All generated images are saved in your conversation history
- Switch between different chats using the sidebar
- Export conversation history (coming soon)
- Place a single
.envfile at the project root (see below for example). Docker Compose and most cloud platforms will pick this up automatically. - Example
.env:# Backend FAL_API_KEY=your_fal_api_key DEBUG=True REDIS_HOST=redis REDIS_PORT=6379 REDIS_DB=0 REDIS_PASSWORD= FAL_API_BASE_URL=https://fal.run FAL_API_TIMEOUT=300 CORS_ORIGINS=http://localhost:3000,http://frontend:3000 API_V1_PREFIX=/api/v1 # Frontend NEXT_PUBLIC_API_URL=http://localhost:8000/api/v1 API_URL=http://localhost:8000/api/v1 NODE_ENV=production
# From the project root
cd backend
# Build and start all services (backend, worker, redis, frontend)
docker-compose up --build- Access the frontend at http://localhost:3000
- Access the backend API at http://localhost:8000
- Push your frontend code to GitHub (in the
frontend/directory). - Go to Vercel and import your repo.
- Set the project root to
frontend/. - In Vercel dashboard, set the environment variable:
NEXT_PUBLIC_API_URL=https://<your-backend-domain>/api/v1
- Deploy!
Note:
- For local development,
NEXT_PUBLIC_API_URLcan behttp://localhost:8000/api/v1. - For production, set it to your DigitalOcean backendโs public URL.
- Set all secrets and API keys in your cloud providerโs dashboard.
- Use HTTPS for all public endpoints (DigitalOcean App Platform and Vercel handle this automatically).
- Monitor logs and health endpoints (
/api/v1/health). - Scale worker and backend services as needed for load.
cd backend
pytest tests/- Import
backend/FalLab_API_Collection.postman_collection.jsonin Postman - Use
backend/FalLab_API_Environment.postman_environment.jsonfor environment variables - Run the collection to test all endpoints
- Frontend: ~15KB TypeScript/React components
- Backend: FastAPI with async support
- Models: 50+ AI image generation models
- Database: Redis-backed queue system
- Response Time: <100ms API latency
- Async Processing: Queue-based image generation with WebSocket polling
Contributions are welcome! Please read CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.
- Fork the repository
- Create a feature branch:
git checkout -b feat/amazing-feature - Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feat/amazing-feature - Open a Pull Request
Solution: Ensure your FAL_KEY is set in the backend .env file
echo "FAL_KEY=your_key" >> backend/.env
docker-compose restartSolution: Verify backend is running on port 8000
curl http://localhost:8000/api/v1/healthSolution: Restart Docker containers
docker-compose down
docker-compose up --buildSolution: Check Fal.ai API key and network connectivity
curl http://localhost:8000/api/v1/models?limit=5Distributed under the MIT License. See LICENSE for more information.
If you find FalLab helpful, please consider:
Made with โค๏ธ by Yash K. Saini