Skip to content

ChrisForti/focus

Repository files navigation

Focus 🚀

Voice-first productivity tool for nautical carpentry and yacht interior manufacturing

Focus allows craftspeople to capture verbal notes hands-free in the workshop and uses AI to extract structured To-Do lists, specifically identifying CNC tasks, assembly, and finishing work.

βœ… Status

Fully functional! The backend is complete with:

  • βœ… Voice transcription working (OpenAI Whisper)
  • βœ… AI task extraction working (GPT-4o)
  • βœ… Database schema deployed to Railway
  • βœ… All API endpoints tested and operational
  • βœ… GitHub Pages landing page live at chrisforti.github.io/focus
  • 🚧 React Native mobile app (coming soon)

πŸ—οΈ Technical Stack

  • Backend: Node.js, Express, TypeScript
  • Database: PostgreSQL (Railway) with Drizzle ORM
  • AI Pipeline: OpenAI Whisper (STT) + GPT-4o (Task Extraction)
  • AI Providers: OpenAI or OpenRouter (supports multiple models)
  • Infrastructure: Railway (Deployment), GitHub (Version Control)

πŸ“‹ Features

  • 🎀 Voice-to-text transcription using OpenAI Whisper
  • πŸ€– AI-powered task extraction optimized for boat building
  • οΏ½ Flexible AI provider support (OpenAI or OpenRouter)
  • 🎯 Multiple model options (GPT-4o, Claude, Llama, etc.)
  • οΏ½πŸ“Š Structured To-Do lists with priority and categories
  • 🏷️ Automatic categorization (CNC, Assembly, Finishing, Carpentry)
  • βœ… Task management with completion tracking

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ installed
  • PostgreSQL database (Railway recommended)
  • OpenAI API key OR OpenRouter account (see OPENROUTER.md)

Installation

  1. Clone the repository

    git clone git@github.com:ChrisForti/focus.git
    cd focus
  2. Install dependencies

    npm install
  3. Configure environment variables

    cp .env.example .env

    Edit .env and add:

    • DATABASE_URL: Your PostgreSQL connection string
    • OPENAI_API_KEY: Your OpenAI API key
    • PORT: Server port (default: 3000)
    • CHAT_MODEL: Model to use (default: gpt-4o)

    Important: If you have OPENAI_API_KEY set in your shell environment (.zshrc or .bashrc), it will override the .env file. Either unset it or remove it from your shell config.

    # Check if you have it set
    echo $OPENAI_API_KEY
    
    # If yes, unset before running the server
    unset OPENAI_API_KEY WHISPER_API_KEY
  4. Generate and push database schema

    npm run db:generate
    npm run db:push
  5. Start development server

    npm run dev

The server will start on http://localhost:3000


πŸ—„οΈ Database Schema

Tables

projects

  • id: Serial primary key
  • name: Project name
  • created_at: Timestamp

voice_logs

  • id: Serial primary key
  • project_id: Foreign key to projects
  • transcript: Full text transcription
  • created_at: Timestamp

todos

  • id: Serial primary key
  • log_id: Foreign key to voice_logs
  • task: Task description
  • is_completed: Boolean (default: false)
  • priority: Enum ('low', 'medium', 'high')
  • category: Text (CNC, Assembly, Finishing, etc.)

πŸ”Œ API Endpoints

Health Check

GET /health

Process Voice Recording

POST /api/process-voice
Content-Type: multipart/form-data

Body:
- audio: Audio file (mp3, wav, m4a, etc.)
- projectId: (optional) Project ID

Response:
{
  "success": true,
  "transcript": "Full transcription...",
  "logId": 123,
  "tasks": [
    {
      "id": 1,
      "task": "Cut transom with CNC router",
      "priority": "high",
      "category": "CNC",
      "isCompleted": false
    }
  ]
}

Get All Projects

GET /api/projects

Get All Todos

GET /api/todos

Update Todo

PATCH /api/todos/:id
Content-Type: application/json

Body:
{
  "isCompleted": true,
  "priority": "high",
  "category": "CNC"
}

πŸš‚ Railway Deployment

Setup

  1. Create a new Railway project

    • Go to railway.app
    • Create a new project
    • Add PostgreSQL database
  2. Connect GitHub repository

    • Link your GitHub repository
    • Railway will auto-detect the Node.js project
  3. Configure environment variables

    • Add DATABASE_URL (auto-populated by Railway)
    • Add OPENAI_API_KEY
    • Add NODE_ENV=production
  4. Deploy

    • Push to main branch
    • Railway will automatically build and deploy

Verify Deployment

Check the health endpoint:

curl https://your-app.railway.app/health

πŸ› οΈ Development

Build for production

npm run build

Run production build

npm start

Database commands

# Generate migration files
npm run db:generate

# Push schema to database
npm run db:push

# Open Drizzle Studio (GUI)
npm run db:studio

πŸ“¦ Project Structure

focus/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ controllers/      # Request handlers
β”‚   β”œβ”€β”€ db/              # Database configuration & schema
β”‚   β”œβ”€β”€ routes/          # API route definitions
β”‚   β”œβ”€β”€ services/        # Business logic (AI, etc.)
β”‚   └── index.ts         # Express app entry point
β”œβ”€β”€ drizzle/             # Generated migration files
β”œβ”€β”€ uploads/             # Temporary audio file storage
β”œβ”€β”€ .env                 # Environment variables (not in git)
β”œβ”€β”€ .env.example         # Environment template
β”œβ”€β”€ drizzle.config.ts    # Drizzle ORM configuration
β”œβ”€β”€ package.json         # Dependencies
β”œβ”€β”€ tsconfig.json        # TypeScript configuration
└── railway.json         # Railway deployment config

πŸ§ͺ Testing the API

Using cURL

# Health check
curl http://localhost:3000/health

# Upload voice recording
curl -X POST http://localhost:3000/api/process-voice \
  -F "audio=@./sample.mp3" \
  -F "projectId=1"

# Get todos
curl http://localhost:3000/api/todos

🎯 AI Task Extraction

The AI is optimized to recognize:

  • CNC Operations: cutting, routing, offsets, toolpaths
  • Cold-molding: lamination techniques
  • Structural Work: transoms, bulkheads, frames
  • Assembly: joinery, fitting, installation
  • Finishing: varnishing, painting, sanding
  • Materials: wood types, epoxy, hardware specifications

Example Input

"Need to cut the transom with a 6mm offset on the CNC, then sand it down to 220 grit before applying the first coat of varnish"

Example Output

[
  {
    "task": "Cut transom with 6mm offset on CNC",
    "priority": "high",
    "category": "CNC"
  },
  {
    "task": "Sand transom to 220 grit",
    "priority": "medium",
    "category": "Finishing"
  },
  {
    "task": "Apply first coat of varnish to transom",
    "priority": "medium",
    "category": "Finishing"
  }
]

πŸ“ License

ISC


🀝 Contributing

This is a specialized tool for boat building workflows. Contributions welcome!


Built for craftspeople who work with their hands πŸ”¨βš“

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors