A modern Net Promoter Score (NPS) feedback system with email integration, vector database storage, and AI-powered feedback analysis.
- π― NPS Feedback Collection: Easy-to-use form for collecting customer feedback and NPS scores
- π Real-time Analytics: Live NPS score calculation and AI-generated feedback summaries
- π§ Email Integration: Automated email notifications and personalized feedback form links
- π Secure Authentication: JWT-based authentication for form access
- π€ AI-Powered Analysis: OpenAI integration for feedback summarization and analysis
- π¦ Vector Database: Supabase integration for efficient feedback storage and retrieval
- π Data Export: Export feedback data to CSV for further analysis
- π‘οΈ Security Features: Rate limiting, input validation, and API key protection
- Backend: Node.js + Express
- Frontend: Alpine.js + Tailwind CSS
- Database: Supabase (PostgreSQL + Vector extensions)
- AI: OpenAI API (GPT-3.5 + text-embedding-3-small)
- Email: Resend (Production) / Mailpit (Development)
- Security: Helmet, Express Validator, Rate Limiting
- Node.js (v14 or higher)
- npm or yarn
- Supabase account
- OpenAI API key
- Resend API key (for production)
- Mailpit (for local development)
-
Clone the repository
git clone https://github.com/Zeb88/prometheus-nps.git cd prometheus-nps
-
Install dependencies
npm install
-
Environment variables Create a
.env
file in the root directory:PORT=3002 NODE_ENV=development SUPABASE_URL=your_supabase_url SUPABASE_ANON_KEY=your_supabase_anon_key OPENAI_API_KEY=your_openai_api_key RESEND_API_KEY=your_resend_api_key JWT_SECRET=your_jwt_secret ADMIN_API_KEY=your_admin_api_key
-
Database Setup Run the following SQL in your Supabase database:
-- Enable required extensions CREATE EXTENSION IF NOT EXISTS moddatetime SCHEMA extensions; CREATE EXTENSION IF NOT EXISTS vector SCHEMA extensions; -- Create the feedback table with timestamp management and vector support CREATE TABLE feedback ( id uuid default uuid_generate_v4() primary key, inserted_at timestamptz DEFAULT timezone('utc'::text, now()) NOT NULL, updated_at timestamptz DEFAULT timezone('utc'::text, now()) NOT NULL, name text NOT NULL, email text NOT NULL, nps_score smallint NOT NULL, feedback text NOT NULL, embedding vector(768) ); -- Create trigger for automatic updated_at timestamp CREATE TRIGGER handle_updated_at BEFORE UPDATE ON feedback FOR EACH ROW EXECUTE PROCEDURE moddatetime(updated_at);
-
Start the development server
npm run dev
-
Generate Form Link
- Access the admin interface
- Enter customer name and email
- Generate and send personalized feedback form link
-
Submit Feedback
- Customer receives email with unique form link
- Fills out NPS score (0-10) and feedback
- Submission stored in database with vector embedding
- View Summary
- Access
/summary
endpoint - View current NPS score
- Read AI-generated feedback summary
- Download complete feedback data as CSV
- Access
POST /api/feedback
- Submit feedbackGET /api/summary
- Get NPS score and AI analysisPOST /api/generate-send-form-link
- Generate and send personalized form linkPOST /api/verify-token
- Verify form access tokenGET /api/download-csv
- Download feedback data as CSV
- API endpoints protected with API key authentication
- Rate limiting on form submissions and API requests
- Input validation and sanitization
- Secure headers with Helmet
- JWT-based form access
For local development:
- Install Mailpit for email testing
- Set
NODE_ENV=development
- Run
npm run dev
- Access Mailpit interface at
http://localhost:8025
For production deployment:
- Set
NODE_ENV=production
- Configure Resend API key
- Set secure JWT and Admin API keys
- Run
npm start
MIT License - see LICENSE file for details
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
The API documentation is available through Swagger UI at /api-docs
. This interactive documentation includes:
- Detailed endpoint descriptions
- Request/response schemas
- Authentication requirements
- Try-it-out functionality
Access the documentation at http://localhost:3002/api-docs
when running locally.
You can run the application using Docker and Docker Compose:
-
Build and start the containers
docker compose up --build
-
Access the services
- Application:
http://localhost:3002
- Mailpit UI:
http://localhost:8025
- Application:
-
Stop the containers
docker compose down
- The application code is mounted as a volume, so changes will trigger automatic reload
- Emails sent by the application can be viewed in Mailpit UI
- Node modules are stored in a named volume for better performance
-
Create a production Docker Compose file:
cp docker-compose.yml docker-compose.prod.yml
-
Modify the production configuration:
# docker-compose.prod.yml version: '3.8' services: app: build: . ports: - "3002:3002" environment: - NODE_ENV=production - PORT=3002 # Add your production environment variables command: ["npm", "start"]
-
Deploy using production configuration:
docker compose -f docker-compose.prod.yml up -d
prometheus-nps/
βββ public/
β βββ app.js
βββ templates/
β βββ layouts/
β β βββ base.html
β βββ partials/
β β βββ nav.html
β β βββ footer.html
β βββ index.html
β βββ form.html
β βββ summary.html
β βββ docs.html
βββ .dockerignore
βββ .env.example
βββ .gitignore
βββ docker-compose.yml
βββ Dockerfile
βββ LICENSE
βββ package.json
βββ README.md
βββ server.js
-
public/
: Static assets and client-side JavaScriptapp.js
: Main client-side application logic
-
templates/
: HTML templates and componentslayouts/
: Base template layoutsbase.html
: Main layout template with common structure
partials/
: Reusable template componentsnav.html
: Navigation bar componentfooter.html
: Footer component
index.html
: Marketing/landing pageform.html
: NPS feedback formsummary.html
: Feedback analysis dashboarddocs.html
: API documentation page
-
server.js
: Main application server -
docker-compose.yml
: Docker Compose configuration -
Dockerfile
: Docker container configuration -
.env.example
: Example environment variables