Development
Contributing to PromptPulse development
Development Guide
Welcome to PromptPulse development! This guide covers everything you need to know about contributing to the project.
Quick Start
Prerequisites
- Node.js 18.0.0 or higher
- npm or yarn
- Git
- SQLite Cloud account (for database)
Development Setup
| |
This starts both the API server (port 3000) and the dashboard (port 3001).
Project Architecture
Core Components
- CLI Tool (
bin/promptpulse.js) - Command-line interface - API Server (
server.js) - Express.js backend - Dashboard (
client/) - Next.js frontend - Library (
lib/) - Shared utilities
Directory Structure
promptpulse/
├── bin/ # CLI executable
├── lib/ # Core libraries
├── client/ # Next.js dashboard
├── routes/ # API routes
├── migrations/ # Database migrations
├── scripts/ # Development scripts
└── docs/ # Hugo documentation
Development Commands
Core Development
| |
CLI Development
| |
Documentation
| |
Code Style
JavaScript/Node.js
- Use ES modules (
type: "module"in package.json) - Prefer async/await over callbacks
- Use consistent error handling
- Follow Express.js middleware patterns
React/Next.js
- Use TypeScript for type safety
- Follow React hooks patterns
- Use Tailwind CSS for styling
- Implement proper error boundaries
Database
- Use modular migrations
- Implement proper indexes
- Use KSUID for primary keys
- Follow data isolation patterns
Testing
Running Tests
| |
Test Structure
- Unit tests in
__tests__/directories - Integration tests for API endpoints
- End-to-end tests for CLI commands
- Browser tests for dashboard features
Database Development
Migrations
Create new migrations using Goose:
| |
Migration file structure:
| |
Database Schema
Key tables:
users- User accounts with KSUID IDsusage_data- Token usage and coststeams- Team informationteam_members- Team membershipemail_preferences- Notification settings
API Development
Adding New Endpoints
- Create route file in
routes/ - Implement authentication middleware
- Add proper error handling
- Update API documentation
Example route:
| |
Authentication
All API endpoints require authentication:
| |
Dashboard Development
Adding New Pages
- Create page in
client/src/app/ - Add navigation links
- Implement authentication checks
- Add responsive design
Component Structure
| |
CLI Development
Adding New Commands
- Add command in
bin/promptpulse.js - Implement logic in
lib/modules - Add proper error handling
- Update help documentation
Example command:
| |
Deployment
API Server Deployment
The API server can be deployed to:
- Railway
- Heroku
- DigitalOcean App Platform
- AWS/GCP/Azure
Environment variables required:
| |
Dashboard Deployment
The dashboard can be deployed to:
- Vercel (recommended)
- Netlify
- AWS Amplify
Configure build settings:
| |
Contributing
Pull Request Process
- Fork the repository
- Create feature branch
- Make changes with tests
- Update documentation
- Submit pull request
Code Review Guidelines
- All code must pass CI/CD checks
- Include tests for new features
- Update documentation as needed
- Follow existing code patterns
- Ensure backward compatibility
Issue Reporting
When reporting issues:
- Use issue templates
- Provide reproduction steps
- Include environment details
- Add relevant logs/screenshots
Security
Security Considerations
- Never commit API keys or secrets
- Use proper input validation
- Implement rate limiting
- Follow OWASP guidelines
- Regular dependency updates
Reporting Security Issues
Report security vulnerabilities to:
- Email: security@promptpulse.dev
- Follow responsible disclosure
- Provide detailed reproduction steps
Release Process
Version Management
| |
Release Checklist
- Update version numbers
- Update CHANGELOG.md
- Run full test suite
- Update documentation
- Test deployment
- Publish to npm
- Create GitHub release
- Announce release
Getting Help
Development Questions
- Check existing documentation
- Search GitHub issues
- Ask in discussions
- Contact maintainers