A Next.js application that converts natural language business hours descriptions into structured JSON format using OpenAI's API.
-
Install dependencies:
npm install
-
Set up your OpenAI API key:
- Copy
.env.localand add your OpenAI API key:
OPENAI_API_KEY=your_actual_openai_api_key_here - Copy
-
Run the development server:
npm run dev
-
Open http://localhost:3000 in your browser.
- ✅ Secure server-side API calls (API key not exposed to client)
- ✅ Natural language processing of business hours
- ✅ Structured JSON output
- ✅ Demo mode for testing without API key
- ✅ Clean, responsive UI
- ✅ Error handling and validation
- Enter a natural language description of business hours (e.g., "we're open tuesdays and thursdays 9-5, with an hour closed for lunch at 12")
- Click "Parse Hours with AI" to get structured JSON output
- Use "Try Demo Mode" to see example output without using the API
The app includes a Next.js API route at /api/parse-hours that:
- Accepts POST requests with
hoursTextin the body - Returns structured JSON with business hours
- Handles OpenAI API communication securely on the server side