Park Commonbase is a web application that captures voice memos, images, and text notes from people at the park and visualizes them in a UMAP (Uniform Manifold Approximation and Projection) space. The application uses AI to process content and create meaningful connections between entries.
📋 Full Deployment Guide - Step-by-step instructions for Vercel + Supabase deployment
- Multi-modal Input: Accept text notes, voice recordings, and images
- AI Processing:
- Audio transcription using OpenAI Whisper
- Image captioning using OpenAI GPT-4 Vision
- Text embedding generation using OpenAI Embeddings
- UMAP Visualization: Interactive 2D visualization of entries based on semantic similarity
- Collections: Organize entries into different collections/parks
- Comments: Add comments to entries with full admin controls
- CSV Export: Export all data for analysis
- Admin Panel: Secure admin authentication for content management
-
Install dependencies:
npm install
-
Set up environment variables:
cp .env.example .env
Fill in your environment variables:
OPENAI_API_KEY
: Your OpenAI API keyAPI_KEY
: Secure API key for endpoint accessNEXT_PUBLIC_API_KEY
: Same API key for client-side requestsADMIN_USERNAME
: Admin username (default: admin)ADMIN_PASSWORD
: Admin password
-
Set up the database:
npx prisma db push
-
Start the development server:
npm run dev
-
Open your browser to http://localhost:3000
All API endpoints require an x-api-key
header with your API key.
POST /api/add
- Add a text entryPOST /api/add_audio
- Add an audio entry (with file upload)POST /api/add_image
- Add an image entry (with file upload)GET /api/collection/:collection
- Get all entries for a collectionGET /api/export_csv
- Export entries as CSV
POST /api/admin_signin
- Sign in as adminDELETE /api/delete_entry/:id
- Delete an entry (admin only)DELETE /api/delete_comment/:id
- Delete a comment (admin only)
Entries are stored with the following structure:
{
id: string, // UUID
data: string, // Text content, transcription, or caption
metadata: {
type?: 'text' | 'audio' | 'image',
audioFile?: string, // Filename for audio entries
imageFile?: string, // Filename for image entries
author?: {
name?: string,
instagram?: string,
url?: string
},
comment_ids?: string[] // Array of comment IDs
},
embedding: string, // JSON string of 1536-dimension vector
createdAt: datetime,
updatedAt: datetime,
collection: string, // Collection/park name
parentId?: string // For comments, ID of parent entry
}
- View entries as points in 2D UMAP space
- Different types show as different shapes (circles for text, rectangles for images, circles with play icon for audio)
- Click on any point to open the sidebar with full details
- Lines connect comments to their parent entries
Use the API endpoints to add content:
# Add text
curl -X POST http://localhost:3000/api/add \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-d '{"data": "This is a text note", "collection": "central-park"}'
# Add image (requires form data)
curl -X POST http://localhost:3000/api/add_image \
-H "x-api-key: YOUR_API_KEY" \
-F "[email protected]" \
-F "collection=central-park"
# Add audio (requires form data)
curl -X POST http://localhost:3000/api/add_audio \
-H "x-api-key: YOUR_API_KEY" \
-F "[email protected]" \
-F "collection=central-park"
- Click "Admin" button in the top-right corner
- Sign in with your admin credentials
- In admin mode, you can:
- Add comments to entries
- Delete entries and comments
- View all admin controls in the sidebar
- Audio files are stored locally in
public/audio/
- Image files are stored locally in
public/images/
- Database uses PostgreSQL (local or Supabase)
- UploadThing handles file uploads (images and audio)
- Files are served from UploadThing's CDN for better performance
- Database uses Supabase PostgreSQL with pgvector extension
- Built with Next.js 15, TypeScript, and Tailwind CSS
- Uses Prisma ORM for database management
- D3.js and UMAP-js for visualization
- OpenAI APIs for content processing
- UploadThing is pre-configured for file storage (no S3 setup needed)
- Supabase provides PostgreSQL with pgvector extension
- Vercel deployment is fully supported with one-click deploy
- Set up proper environment variables for production
- Consider using Redis for session storage instead of in-memory
- Set up database backups and monitoring through Supabase