Skip to content

The next generation of building software will transform software engineers into engineering managers. Dev Works enables that future.

Notifications You must be signed in to change notification settings

jykim16/DevWorks

Repository files navigation

Spec Builder with OpenAI Chat & SQLite Database

A React application for building project specifications with an AI-powered chatbot assistant and SQLite database for storing customer data and tasks.

Features

  • Form Builder: Interactive form for creating project specifications
  • AI Chatbot: OpenAI-powered assistant that provides contextual help
  • Form Field Tracking: The chatbot knows which form field you're working on
  • Manual Form Selection: Dropdown to manually select which form field to get help with
  • SQLite Database: Persistent storage for customer specs, answers, and tasks
  • Task Management: Create, update, and manage tasks for each project specification
  • Chat History: Persistent chat history for each spec

Database Schema

The application uses SQLite with the following tables:

  • specs: Customer information and spec metadata
  • spec_answers: Individual form field answers for each spec
  • tasks: Task management for each spec
  • chat_history: Persistent chat conversations

Setup

  1. Install dependencies:

    npm install
  2. Set up OpenAI API key:

    • Get your API key from OpenAI
    • Create a .env file in the root directory
    • Add your API key: OPENAI_API_KEY=your_actual_api_key_here
  3. Start the development servers:

    npm run dev

    This will start both the React frontend (port 3000) and the Express backend (port 3001).

Usage

Spec Builder

  1. Enter customer name and email
  2. Click "Create New Spec" to start a new project
  3. Fill out the form fields with AI assistance
  4. Use "Save Form" to persist your answers
  5. Load existing specs by entering the spec ID

Task Manager

  1. Navigate to /task-manager in your browser
  2. Select a project specification from the left panel
  3. Create tasks with title, description, priority, assignee, and due date
  4. Update task status (pending, in-progress, completed)
  5. Delete tasks as needed

AI Chatbot

  • The chatbot provides contextual help based on the current form field
  • Chat history is automatically saved to the database
  • Manual form field selection via dropdown
  • Real-time AI responses using OpenAI's API

API Endpoints

Specs

  • POST /api/specs - Create a new spec
  • GET /api/specs - Get all specs
  • GET /api/specs/:id - Get specific spec with answers
  • POST /api/specs/:id/answers - Save form answers

Tasks

  • POST /api/specs/:id/tasks - Create a task for a spec
  • GET /api/specs/:id/tasks - Get tasks for a spec
  • PUT /api/tasks/:id - Update a task
  • DELETE /api/tasks/:id - Delete a task

Chat

  • POST /api/chat - Get AI response and save to database
  • POST /api/specs/:id/chat - Save chat message
  • GET /api/specs/:id/chat - Get chat history for a spec

Database File

The SQLite database is automatically created as database.sqlite in the project root when you first run the server.

Security Note

⚠️ Important: The API key is stored in the backend environment variables, which is more secure than frontend storage. For production use, consider additional security measures like API rate limiting and user authentication.

About

The next generation of building software will transform software engineers into engineering managers. Dev Works enables that future.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published