A Next.js full-stack MVP application for the Bria FIBO Hackathon that enables users to generate structured scene compositions with live image previews using AI-powered scene generation.
Smart Scene Composer is an intelligent tool that transforms simple text descriptions into detailed, structured JSON prompts and generates corresponding images. Users can type a scene description, and the application will:
- Generate a structured JSON prompt using Bria AI's FIBO LLM
- Create a live preview image based on the structured prompt
- Allow real-time control adjustments (camera angle, FOV, lighting, color palette, HDR)
- Export both JSON and image files for production use
Hackathon: Bria FIBO Hackathon
- Scene Input: Type natural language descriptions (e.g., "futuristic cyberpunk city at sunset")
- FIBO Integration: Backend API route proxies requests to Bria AI FIBO API, returning structured JSON
- Live Preview: Images update automatically with control changes
- Interactive Controls Panel:
- Camera angle slider (0–360°)
- FOV slider (20–120)
- Lighting intensity slider (0–100)
- Color palette multi-select
- HDR toggle
- Export Functionality: Download JSON + image files for production use
- Responsive Design: Modern UI with dark mode support
- Real-time Updates: Automatic preview generation when controls change
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS 4
- API Integration: Bria AI FIBO API
- Deployment: Vercel-ready
- Node.js 18+
- npm, yarn, pnpm, or bun
- Bria AI API Key (get one at Bria Platform)
git clone <repository-url>
cd smart-scene-composernpm install
# or
yarn install
# or
pnpm installCreate a .env.local file in the root directory:
FIBO_API_KEY=your_bria_api_key_hereGetting Your API Key:
- Visit Bria Platform
- Sign up or log in
- Navigate to API Keys section
- Copy your Production API key
- Paste it in
.env.local
npm run dev
# or
yarn dev
# or
pnpm devOpen http://localhost:3000 in your browser.
smart-scene-composer/
│
├── app/
│ ├── api/
│ │ └── fibo/
│ │ └── route.ts # Backend API route (proxies to Bria AI)
│ ├── page.tsx # Main frontend page
│ ├── layout.tsx # Root layout
│ └── globals.css # Global styles
│
├── components/
│ ├── SceneInput.tsx # Scene description input
│ ├── ControlsPanel.tsx # Sliders & toggles for controls
│ ├── PreviewImage.tsx # Live preview display
│ └── ExportButton.tsx # JSON + image export functionality
│
├── hooks/
│ └── useSceneState.ts # Custom hook for state management
│
├── .env.local # Environment variables (not in git)
├── package.json
├── next.config.ts
└── README.md
- Enter Scene Description: Type a scene description in the text area (e.g., "futuristic cyberpunk city at sunset")
- Click Generate: Click the "Generate" button to create structured JSON and preview image
- Adjust Controls: Use the sliders and toggles to fine-tune:
- Camera angle
- Field of view (FOV)
- Lighting intensity
- Color palette (select multiple colors)
- HDR mode
- View Results:
- See the generated image in the preview panel
- Review the structured JSON below the image
- Export: Click "Export JSON + Image" to download both files
The application uses Bria AI's FIBO API with a two-step process:
-
Structured Prompt Generation (
/v2/structured_prompt/generate):- Converts text input into detailed JSON structured prompts
- Returns comprehensive scene descriptions with objects, lighting, aesthetics, etc.
-
Image Generation (
/v2/image/generate):- Uses the structured prompt to generate high-quality images
- Supports async processing with status polling
- Backend Route:
/api/fibo(POST)- Accepts:
{ prompt: string, controls: object } - Returns:
{ structuredJson: object, imageUrl: string | null }
- Accepts:
- Camera Angle (0–360°): Adjust the viewing angle of the scene
- FOV (20–120): Control the field of view
- Lighting (0–100): Adjust lighting intensity
- Color Palette: Multi-select from predefined color options
- HDR: Toggle high dynamic range mode
The export button downloads:
scene-composition.json: Complete structured JSON with all scene detailsscene-preview.png: Generated preview image
- Push your code to GitHub
- Import project in Vercel
- Add environment variable:
FIBO_API_KEY: Your Bria AI API key
- Deploy!
The app is optimized for Vercel deployment with Next.js App Router.
npm run dev # Start development server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run ESLint- Components: Reusable React components with TypeScript
- Hooks: Custom React hooks for state management
- API Routes: Server-side API routes for secure API key handling
- Styling: Tailwind CSS with dark mode support
Input:
"futuristic cyberpunk city at sunset"
Output:
- Structured JSON with detailed scene description, objects, lighting, aesthetics
- High-quality generated image matching the description
This is a hackathon project. Contributions and improvements are welcome!
This project is created for the Bria FIBO Hackathon.
- Use descriptive scene descriptions for better results
- Experiment with different control combinations
- The structured JSON can be reused for consistent scene generation
- Images are generated asynchronously - be patient during generation
Built with ❤️ for the Bria FIBO Hackathon