Welcome to Browser Pool! This guide will help you set up your development environment and contribute to the project.
The easiest way to get started is to use VS Code Dev Containers. This sets up a complete development environment with all dependencies.
Requirements:
- Docker Desktop or Docker Engine
- VS Code with the Remote - Containers extension
Steps:
- Clone the repository
- Open the project in VS Code
- Click the "Reopen in Container" button when prompted, or:
- Press
Ctrl+Shift+P(orCmd+Shift+Pon Mac) - Type "Dev Containers: Reopen in Container"
- Select the Browser Pool Development container
- Press
VS Code will:
- Build the Docker image
- Start PostgreSQL and Redis containers
- Install all dependencies
- Run database migrations
- Set up the development environment
If you prefer to manage containers manually:
# Start all services
make devcontainer-up
# Open a shell in the dev container
make devcontainer-shell
# Stop all services
make devcontainer-downIf you prefer local development, you'll need:
- Bun 1.3+: https://bun.sh
- Node.js 20+: https://nodejs.org
- PostgreSQL 15+: https://www.postgresql.org
- Redis 7+: https://redis.io
Setup:
# Install dependencies
bun install
# Set up environment variables
cp .env.example .env
cp frontend/.env.example frontend/.env
# Run database migrations
bun run db:migrate
# (Optional) Seed the database
bun run db:seed
# (Optional) Create admin user
bun run create:admin
# Start development servers
bun run devStart both frontend and backend with a single command:
bun run dev
# or use the Makefile
make devThis starts:
- Backend API: http://localhost:3000
- Frontend: http://localhost:5173
- API Docs: http://localhost:3000/api/docs
browser-pool/
├── src/ # Backend source code (Node.js + Hono)
│ ├── index.ts # Application entry point
│ ├── routes/ # API route handlers
│ ├── middleware.ts # Authentication and request middleware
│ ├── email.ts # Email service
│ ├── redis.ts # Redis client
│ ├── queue.ts # BullMQ job queue
│ ├── scheduler.ts # Screenshot scheduler
│ └── ...
├── frontend/ # React SPA frontend
│ ├── src/
│ ├── public/
│ └── package.json
├── prisma/
│ ├── schema.prisma # Database schema
│ └── migrations/
├── scripts/ # Utility scripts
│ ├── create-admin.ts
│ ├── seed.ts
│ └── migrate-security-fields.ts
├── package.json
├── tsconfig.json
├── .devcontainer/ # Dev container configuration
└── Makefile # Development commands
Development:
make dev # Start frontend and backend
make install # Install dependencies
make build # Build for productionTesting:
make test # Run tests
make test-watch # Run tests in watch mode
make test-coverage # Run tests with coverageDatabase:
make db-migrate # Run pending migrations
make db-seed # Seed database
make db-studio # Open Prisma Studio
make db-generate # Generate Prisma clientCode Quality:
make lint # Run linterUtilities:
make create-admin # Create an admin user
make clean # Clean build artifacts- Framework: Hono.js (lightweight web framework)
- Runtime: Bun (JavaScript runtime)
- Database: PostgreSQL with Prisma ORM
- Cache/Queue: Redis with BullMQ
- API Docs: Swagger/OpenAPI
- Authentication: JWT + API Keys
- Email: Nodemailer
- Screenshot: Playwright
- Framework: React 19
- Build Tool: Vite
- Styling: Tailwind CSS v4
- State Management: React Query (TanStack Query)
- Forms: React Hook Form with Zod validation
- UI Components: Radix UI + shadcn/ui
- HTTP Client: Axios
- Router: React Router v7
- Use strict mode
- Add return types to functions
- Prefer types over interfaces for object shapes
- Use const for all variable declarations
- We use Biome for formatting and linting
- Format on save is enabled in dev containers
- Run
make lintbefore committing
-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes
- Keep commits focused and atomic
- Write descriptive commit messages
- Test your changes locally
-
Push and create a PR
git push origin feature/your-feature-name
- Use the PR template
- Link related issues
- Request reviews from maintainers
Follow conventional commits:
feat: Add new screenshot filtering
fix: Resolve race condition in job queue
docs: Update API documentation
refactor: Simplify rate limiting logic
test: Add tests for webhook handler
When you modify prisma/schema.prisma:
-
Create a new migration:
bun run db:migrate
-
Review the generated SQL in
prisma/migrations/ -
Commit the migration with your code changes
Essential variables for development:
| Variable | Purpose | Default |
|---|---|---|
NODE_ENV |
Environment | development |
PORT |
Backend port | 3000 |
DATABASE_URL |
PostgreSQL connection | See .env.example |
REDIS_URL |
Redis connection | See .env.example |
JWT_SECRET |
JWT signing secret | Required |
API_KEY_PREFIX |
API key prefix | bp_ |
See .env.example for all available options.
The dev container includes VS Code debugger support. Add breakpoints and use the debugger configuration in .vscode/launch.json.
Use React DevTools and Vite DevTools in your browser.
Open Prisma Studio:
make db-studiomake test # Run all tests once
make test-watch # Run tests in watch mode
make test-coverage # Generate coverage report- Place test files next to source files with
.test.tsextension - Use Jest for unit/integration tests
- Mock external services (Redis, Database, etc.)
- The dev container uses volume mounts for live code reloading
node_modulesare in separate volumes to avoid disk sync issues- Database is persisted in Docker volumes between sessions
- Check existing issues and discussions
- Review the API documentation at http://localhost:3000/api/docs
- Look at the code comments and types for guidance
- Ask in PRs or discussions for clarification
# Rebuild the image
make devcontainer-build
# Check Docker logs
docker-compose -f .devcontainer/docker-compose.yml logs# Verify PostgreSQL is running
docker-compose -f .devcontainer/docker-compose.yml ps
# Check connection string
echo $DATABASE_URLIf ports are already in use, modify .devcontainer/docker-compose.yml port mappings.
# Clean and reinstall
rm -rf node_modules frontend/node_modules
bun install- Read the project README
- Check out open issues labeled "good first issue"
- Review the API documentation
- Start with a small bug fix or feature
Happy coding! 🚀