Skip to content

AI-powered image generation app with TRMNL e-ink display sync. Generate stunning images using OpenAI's DALL-E 3 and display them on your TRMNL device.

Notifications You must be signed in to change notification settings

kenken64/Promptink

Repository files navigation

PromptInk

AI-powered image generation app with TRMNL e-ink display sync. Generate stunning images using OpenAI's DALL-E 3 and display them on your TRMNL device.

License Bun React

Features

  • AI Image Generation - Create images using OpenAI DALL-E 3 with natural language prompts
  • Voice Input - Speak your prompts using Web Speech API (supports English & Chinese)
  • TRMNL Sync - Push generated images to TRMNL e-ink displays
  • User Authentication - Secure JWT-based authentication with email/password
  • Multi-User Support - Each user has their own TRMNL webhook and device settings
  • Dark/Light Theme - Toggle between themes with persistent preference
  • Bilingual UI - Full English and Chinese language support
  • Mobile Responsive - Optimized for all screen sizes

Screenshots

Chat Interface Settings Page
Generate images with text or voice Configure your TRMNL device

Quick Start

Prerequisites

Installation

# Clone the repository
git clone https://github.com/kenken64/Promptink.git
cd Promptink

# Install dependencies
./scripts/install.sh

# Configure environment
cp .env.example backend/.env
# Edit backend/.env with your API keys

Configuration

Edit backend/.env:

# Required
OPENAI_API_KEY=sk-your-openai-api-key
JWT_SECRET=your-secure-random-string

# Optional (for TRMNL admin operations)
TRMNL_USER_API_KEY=your-trmnl-user-api-key
TRMNL_CUSTOM_PLUGIN_UUID=your-plugin-uuid

Note: TRMNL device settings (Device API Key, MAC Address) are now configured per-user in the Settings page.

Running

# Start all services
./scripts/start.sh

# Check status
./scripts/status.sh

# Stop all services
./scripts/stop.sh

Services:

Architecture

┌─────────────────────────────────────────────────────────────────┐
│                         PromptInk                                │
├─────────────────────────────────────────────────────────────────┤
│                                                                  │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────────┐   │
│  │   Frontend   │◄──►│   Backend    │◄──►│  OpenAI DALL-E   │   │
│  │   (React)    │    │    (Bun)     │    │                  │   │
│  └──────────────┘    └──────┬───────┘    └──────────────────┘   │
│                             │                                    │
│                      ┌──────┴───────┐                           │
│                      │   SQLite DB  │                           │
│                      │  - Users     │                           │
│                      │  - Images    │                           │
│                      │  - Settings  │                           │
│                      └──────┬───────┘                           │
│                             │                                    │
│              /api/trmnl/webhook/:userId                         │
│                             │                                    │
│                      ┌──────┴───────┐                           │
│                      │    TRMNL     │                           │
│                      │   Device     │                           │
│                      └──────────────┘                           │
│                                                                  │
└─────────────────────────────────────────────────────────────────┘

Project Structure

PromptInk/
├── backend/                 # Bun API server
│   ├── src/
│   │   ├── config/         # Environment configuration
│   │   ├── db/             # SQLite database & queries
│   │   ├── middleware/     # Auth middleware
│   │   ├── routes/         # API endpoints
│   │   ├── services/       # Business logic
│   │   └── utils/          # Utilities
│   └── package.json
│
├── frontend/               # React frontend
│   ├── src/
│   │   ├── components/     # UI components
│   │   ├── hooks/          # Custom React hooks
│   │   ├── pages/          # Page components
│   │   └── lib/            # Utilities
│   └── package.json
│
├── peekachoo-trmnl/        # TRMNL plugin
│   └── src/                # Liquid templates
│
├── scripts/                # Management scripts
├── Dockerfile              # Docker deployment
├── railway.toml            # Railway deployment config
└── ARCHITECTURE.md         # Detailed architecture docs

API Endpoints

Authentication

Method Endpoint Description
POST /api/auth/register Register new user
POST /api/auth/login Login user
GET /api/auth/me Get current user
POST /api/auth/logout Logout user

Image Generation

Method Endpoint Description
POST /api/images/generate Generate image from prompt

TRMNL Sync

Method Endpoint Description
POST /api/sync/trmnl Sync image to TRMNL (auth required)
GET /api/trmnl/webhook/:userId Webhook for TRMNL polling
GET /api/sync/status Get sync status

Settings

Method Endpoint Description
GET /api/settings Get user settings
PUT /api/settings Update user settings

TRMNL Integration

Setup

  1. Register/Login to PromptInk
  2. Go to Settings (gear icon)
  3. Enter your TRMNL Device API Key and MAC Address
  4. Copy your webhook URL: https://your-domain/api/trmnl/webhook/{userId}
  5. Configure your TRMNL plugin to poll this URL

Plugin Deployment

cd peekachoo-trmnl
trmnlp login          # First time only
trmnlp push           # Upload to TRMNL server

Deployment

Railway

  1. Connect your GitHub repo to Railway
  2. Set environment variables in Railway dashboard:
    • JWT_SECRET
    • OPENAI_API_KEY
    • TRMNL_USER_API_KEY (optional)
  3. Add a volume mounted at /app/data for SQLite persistence
  4. Deploy

Docker

docker build -t promptink .
docker run -p 3000:3000 \
  -e JWT_SECRET=your-secret \
  -e OPENAI_API_KEY=sk-... \
  -v promptink-data:/app/data \
  promptink

Tech Stack

Layer Technology
Runtime Bun
Backend Bun.serve + SQLite
Frontend React 19 + Tailwind CSS + shadcn/ui
Auth JWT + Argon2id
Database SQLite (bun:sqlite)
AI OpenAI DALL-E 3
E-ink Display TRMNL

Development

Prerequisites

  • Bun v1.0+
  • Node.js (for some dev tools)

Commands

# Start development servers
./scripts/start.sh

# View logs
tail -f logs/backend.log

# Stop servers
./scripts/stop.sh

Frontend Development

The frontend is bundled by Bun's built-in HTML import feature. Changes hot-reload automatically.

Adding API Routes

  1. Create route file in backend/src/routes/
  2. Export routes object
  3. Import and spread in backend/src/routes/index.ts

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments


Made with Claude Code

About

AI-powered image generation app with TRMNL e-ink display sync. Generate stunning images using OpenAI's DALL-E 3 and display them on your TRMNL device.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •