Getting Started
Prerequisites
Ensure you have the following installed:- Node.js: >= 20
- Bun: Latest version (recommended) or npm/pnpm
- Git: For version control
- PostgreSQL: Via Neon (cloud) or local instance
Initial Setup
- Clone the repository:
- Install dependencies:
- Set up environment variables:
- Set up the database:
- Start development servers:
Hosts Configuration
For local subdomain testing, add to/etc/hosts:
- Main app:
http://app.localhost:3000 - Workspace:
http://test.localhost:3000(replacetestwith your workspace slug)
Development Workflow
Creating a Feature
- Create a feature branch:
- Make your changes:
- API changes:
packages/api/src/router/ - Database changes:
packages/db/schema/ - UI components:
packages/ui/src/ - App features:
apps/app/src/
- Test your changes:
- Commit your changes:
feat:- New featurefix:- Bug fixdocs:- Documentation changesstyle:- Code style changes (formatting)refactor:- Code refactoringtest:- Adding testschore:- Build process or tooling changes
- Push and create a PR:
Database Changes
-
Modify schema files in
packages/db/schema/ - Generate migration:
-
Review generated SQL in
packages/db/drizzle/ - Test migration:
- Commit both schema and migration files
Adding a New API Endpoint
- Create validator in
packages/api/src/validators/:
- Add router in
packages/api/src/router/:
- Register router in
packages/api/src/index.ts:
- Use in frontend:
Adding a UI Component
- Create component in
packages/ui/src/:
- Export from package:
- Use in app:
Code Standards
TypeScript
- Use strict mode: All packages use
strict: true - No
any: Avoid usingany, useunknownif necessary - Explicit types: Define interfaces and types for complex objects
- Null safety: Use optional chaining and nullish coalescing
React
- Use hooks: Prefer functional components with hooks
- Server Components: Use React Server Components by default in Next.js
- Client Components: Mark with
"use client"only when needed - Composition: Prefer composition over inheritance
Database
- Use transactions: For multi-step operations
- Add indexes: For frequently queried columns
- Validate constraints: Use database constraints, not just app logic
- Cascading deletes: Define foreign key cascade behavior
API Design
- RESTful naming: Use resource-based names
- Input validation: Validate all inputs with Zod
- Error handling: Return appropriate HTTP status codes
- Response consistency: Use consistent response formats
Styling
- Tailwind CSS: Use utility classes
- Component variants: Use
class-variance-authorityfor variants - Responsive: Mobile-first responsive design
- Dark mode: Support dark mode with
next-themes
Testing Guidelines
While not currently implemented, here’s the recommended approach:Unit Tests
Integration Tests
Pull Request Guidelines
Before Submitting
- Code follows style guidelines
- Type checking passes (
bun run check-types) - Linting passes (
bun run lint) - Code is formatted (
bun run format) - Tested locally
- Database migrations included (if schema changed)
- Documentation updated (if needed)
PR Description Template
Code Review Process
- Automated checks must pass (types, lint, build)
- At least one approval required
- Address all feedback
- Squash and merge to main
Community
Getting Help
- GitHub Issues: Bug reports and feature requests
- GitHub Discussions: Questions and community support
- Discord: Real-time chat (if available)
Reporting Bugs
When reporting bugs, include:- Description: Clear description of the issue
- Steps to reproduce: Minimal steps to reproduce
- Expected behavior: What you expected to happen
- Actual behavior: What actually happened
- Environment: OS, Node version, browser
- Screenshots: If applicable
Suggesting Features
When suggesting features:- Use case: Describe the problem you’re solving
- Proposed solution: How you think it should work
- Alternatives: Other solutions you considered
- Additional context: Mockups, examples, etc.