A standardized project template for consistent development workflows across all of PostHog's repositories. This template provides a solid foundation with common scripts, configuration files, license, and project structure that can be customized for your specific needs.
- Clone from Template: Use GitHub's "Use this template" button or clone directly:
git clone https://github.com/PostHog/template.git your-project-name
cd your-project-name
- Initialize as New Repository: Remove the template's git history and start fresh:
rm -rf .git
git init
git add .
git commit -m "Initial commit from template"
- Replace README: Replace this template README with the project-specific one from README.demo.md:
mv README.demo.md README.md
- Customize for Your Project:
- Customize your README including language-specific requirements
- Update configuration files
- Add your source code and dependencies
- Update documentation
This template provides:
- Standardized Scripts: Common development tasks in
bin/
directory - Project Structure: Consistent organization across projects
- Configuration Files: Common
.gitignore
,.gitattributes
, etc. - Documentation: Templates and guides for customization
- Github Configuration: Basic issues/PR templates inside the .github folder
The bin/
directory contains standardized scripts following the "Scripts to Rule Them All" pattern, providing a consistent interface for common development tasks across different projects and languages.
bin/
├── helpers/
│ └── _utils.sh # Common utility functions
├── setup # Initial project setup
├── bootstrap # Resolve dependencies
├── start # Start the application
├── test # Run tests
├── fmt # Format code
├── lint # Run linters
├── build # Build the project
├── clean # Clean build artifacts
└── update # Update dependencies
- Customize scripts for your specific language/framework
- Run scripts from project root:
bin/test
- All scripts should be idempotent
- Include help text with
#/
comments - Source
bin/helpers/_utils.sh
for common functions - Set working directory to project root
- Exit with appropriate status codes
- Keep scripts simple: Each script should do one thing well
- Use helpers: Don't repeat code, add it to
_utils.sh
- Provide feedback: Use print_color to show progress
- Handle errors: Check return codes and fail gracefully
- Document options: Use
#/
comments for help text - Be idempotent: Scripts should be safe to run multiple times