Skip to content

Commit cac8fb1

Browse files
authored
docs: Expand project documentation with new guides and updates
1 parent 938b2ae commit cac8fb1

File tree

6 files changed

+2171
-15
lines changed

6 files changed

+2171
-15
lines changed

ACKNOWLEDGMENTS.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Acknowledgments
2+
3+
We would like to thank the following projects, tools, and communities that made Databuddy possible:
4+
5+
## Core Technologies
6+
7+
### Frontend & Framework
8+
- **[Next.js](https://nextjs.org/)** - The React framework for production
9+
- **[React](https://reactjs.org/)** - A JavaScript library for building user interfaces
10+
- **[TypeScript](https://www.typescriptlang.org/)** - Typed JavaScript at scale
11+
- **[Tailwind CSS](https://tailwindcss.com/)** - A utility-first CSS framework
12+
13+
### Build & Development
14+
- **[Turborepo](https://turbo.build/repo)** - High-performance build system for monorepos
15+
- **[Bun](https://bun.sh/)** - Fast all-in-one JavaScript runtime and toolkit
16+
- **[Biome](https://biomejs.dev/)** - Fast formatter and linter for JavaScript and TypeScript
17+
18+
### Database & Storage
19+
- **[PostgreSQL](https://www.postgresql.org/)** - The world's most advanced open source relational database
20+
- **[ClickHouse](https://clickhouse.com/)** - Fast open-source column-oriented database
21+
- **[Redis](https://redis.io/)** - In-memory data structure store
22+
- **[Drizzle ORM](https://orm.drizzle.team/)** - TypeScript ORM
23+
24+
### UI Components & Libraries
25+
- **[Radix UI](https://www.radix-ui.com/)** - Unstyled, accessible components
26+
- **[Phosphor Icons](https://phosphoricons.com/)** - Flexible icon family
27+
- **[Recharts](https://recharts.org/)** - Composable charting library
28+
- **[TanStack Query](https://tanstack.com/query)** - Powerful data synchronization
29+
30+
### Developer Tools
31+
- **[Zod](https://zod.dev/)** - TypeScript-first schema validation
32+
- **[Day.js](https://day.js.org/)** - Fast 2KB alternative to Moment.js
33+
- **[tRPC](https://trpc.io/)** - End-to-end typesafe APIs
34+
35+
### Testing & Quality
36+
- **[Vitest](https://vitest.dev/)** - Blazing fast unit test framework
37+
- **[Playwright](https://playwright.dev/)** - Reliable end-to-end testing
38+
39+
### Infrastructure & Hosting
40+
- **[Vercel](https://vercel.com/)** - Platform for frontend frameworks and static sites
41+
- **[Docker](https://www.docker.com/)** - Containerization platform
42+
43+
## Special Thanks
44+
45+
### Open Source Community
46+
We're grateful to the entire open source community for creating and maintaining the incredible tools and libraries that power Databuddy.
47+
48+
### Contributors
49+
Thank you to all contributors who have helped improve Databuddy through code, documentation, bug reports, and feedback.
50+
51+
### Privacy-First Analytics Movement
52+
Inspired by and grateful to privacy-focused analytics projects that are making the web a better place while respecting user privacy.
53+
54+
### Vercel OSS Program
55+
Special thanks to [Vercel](https://vercel.com/oss) for supporting open source projects through their OSS Program.
56+
57+
## License Acknowledgments
58+
59+
Databuddy is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). All dependencies are used in accordance with their respective licenses.
60+
61+
For a complete list of dependencies and their licenses, see the `package.json` files in each package directory.
62+
63+
---
64+
65+
**Want to be listed here?** We welcome contributions! Check out our [Contributing Guide](CONTRIBUTING.md) to get started.

CONTRIBUTING.md

Lines changed: 209 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,212 @@ Note: Open a pull request to the STAGING branch
128128

129129
## Code Style
130130

131-
- Use Biome for linting and formatting
132-
- Follow the coding standards in the README
133-
- Keep it simple and type-safe
131+
### Linting and Formatting
132+
133+
- **Use Ultracite** for linting (not ESLint)
134+
- **Use Prettier** for code formatting
135+
- **Use Biome** for fast linting and formatting where applicable
136+
- Run `bun run lint` before committing to ensure code quality
137+
- Run `bun run format` to auto-format your code
138+
139+
### Coding Standards
140+
141+
Follow the coding standards outlined in the README and `.cursor/rules/`:
142+
143+
**Required Tools & Libraries:**
144+
- **Bun** - Required for all development (never use npm/pnpm/Node CLI)
145+
- **Zod v4** - Use `zod/v4` everywhere (not Zod v3)
146+
- **Phosphor Icons** - Use only Phosphor icons (not Lucide)
147+
- **Dayjs** - Use for all date handling (never date-fns)
148+
- **TanStack Query** - Use for data fetching hooks (never SWR)
149+
150+
**Style Guidelines:**
151+
- **Border Radius**: Use `rounded` (never `rounded-xl` or `rounded-md`)
152+
- **Type Safety**: Always ensure type-safety and use shared types
153+
- **Error Handling**: Never throw errors in server actions; use try/catch and return errors
154+
- **Error Boundaries**: Always use error boundaries properly
155+
- **Console Usage**: Use appropriate console methods (`console.error`, `console.time`, `console.json`, `console.table`)
156+
- **useEffect**: Almost never use `useEffect` unless critical
157+
- **No Placeholders**: Never add placeholders or mock data
158+
159+
See `.cursor/rules/` for the complete enforced ruleset.
160+
161+
## Testing
162+
163+
### Running Tests
164+
165+
```bash
166+
# Run all tests
167+
bun run test
168+
169+
# Run tests in watch mode
170+
bun run test:watch
171+
172+
# Run tests with coverage
173+
bun run test:coverage
174+
175+
# Run specific test file
176+
bun test path/to/test.test.ts
177+
```
178+
179+
### Writing Tests
180+
181+
**Unit Tests:**
182+
- Use Vitest for unit testing
183+
- Place tests next to the code they test (`*.test.ts`)
184+
- Aim for >80% code coverage
185+
- Mock external dependencies
186+
187+
**Example unit test:**
188+
```typescript
189+
import { describe, it, expect, vi } from 'vitest'
190+
import { calculateMetrics } from './analytics'
191+
192+
describe('calculateMetrics', () => {
193+
it('should calculate basic metrics correctly', () => {
194+
const events = [
195+
{ type: 'pageview', timestamp: Date.now() },
196+
{ type: 'pageview', timestamp: Date.now() }
197+
]
198+
199+
const metrics = calculateMetrics(events)
200+
201+
expect(metrics.pageviews).toBe(2)
202+
})
203+
204+
it('should handle empty events array', () => {
205+
const metrics = calculateMetrics([])
206+
207+
expect(metrics.pageviews).toBe(0)
208+
})
209+
})
210+
```
211+
212+
**Integration Tests:**
213+
- Test API endpoints and database operations
214+
- Use test database and Redis instances
215+
- Clean up test data after each test
216+
217+
**E2E Tests:**
218+
- Use Playwright for end-to-end testing
219+
- Test critical user flows
220+
- Run in CI/CD pipeline
221+
222+
### Test Coverage Requirements
223+
224+
Maintain test coverage above these thresholds:
225+
- **Statements**: 80%
226+
- **Branches**: 75%
227+
- **Functions**: 80%
228+
- **Lines**: 80%
229+
230+
## Code Review Process
231+
232+
All contributions go through code review before merging:
233+
234+
1. **Automated Checks**: CI/CD runs tests, linting, and type checking
235+
2. **CodeRabbit Review**: Automated AI review for common issues
236+
3. **Manual Review**: Maintainer reviews code for:
237+
- Code quality and style adherence
238+
- Test coverage
239+
- Security considerations
240+
- Performance implications
241+
- Documentation completeness
242+
243+
### Review Checklist
244+
245+
Before requesting review, ensure:
246+
- [ ] All tests pass
247+
- [ ] Code is formatted and linted
248+
- [ ] Types are correct (no `any` types)
249+
- [ ] Documentation is updated
250+
- [ ] Changeset created
251+
- [ ] Security considerations addressed
252+
- [ ] Performance impact considered
253+
- [ ] Error handling implemented
254+
255+
## Architecture Guidelines
256+
257+
### Monorepo Structure
258+
259+
```
260+
Databuddy/
261+
├── apps/
262+
│ ├── web/ # Main dashboard application
263+
│ ├── docs/ # Documentation site
264+
│ └── dashboard/ # Analytics dashboard
265+
├── packages/
266+
│ ├── sdk/ # Client-side SDK
267+
│ ├── tracker/ # Event tracking
268+
│ ├── db/ # Database utilities
269+
│ ├── validation/ # Shared validation schemas
270+
│ └── ui/ # Shared UI components
271+
└── infrastructure/ # Deployment configurations
272+
```
273+
274+
### Adding New Features
275+
276+
**1. Plan your feature:**
277+
- Discuss in GitHub Issues first for major features
278+
- Consider backward compatibility
279+
- Plan database migrations if needed
280+
281+
**2. Implement incrementally:**
282+
- Start with types and schemas (Zod v4)
283+
- Implement core logic with tests
284+
- Add UI components
285+
- Update documentation
286+
287+
**3. Database Changes:**
288+
```bash
289+
# Make schema changes in packages/db/schema/
290+
291+
# Generate migration
292+
bun run db:generate
293+
294+
# Apply to local database
295+
bun run db:push
296+
297+
# Test migration
298+
bun run db:migrate
299+
```
300+
301+
**4. Add appropriate tests:**
302+
- Unit tests for utilities and logic
303+
- Integration tests for API endpoints
304+
- E2E tests for user-facing features
305+
306+
### Performance Considerations
307+
308+
- **Database**: Index frequently queried columns
309+
- **Caching**: Use Redis for expensive queries
310+
- **Bundle Size**: Keep client bundles small (<200KB)
311+
- **Batching**: Batch analytics events (use built-in batching)
312+
- **Images**: Use Next.js Image optimization
313+
314+
## Documentation
315+
316+
### When to Update Docs
317+
318+
Update documentation when:
319+
- Adding new features
320+
- Changing APIs or behavior
321+
- Fixing bugs that affect usage
322+
- Adding configuration options
323+
- Changing deployment procedures
324+
325+
### Documentation Files
326+
327+
- **README.md** - Project overview and quick start
328+
- **CONTRIBUTING.md** - This file
329+
- **DEPLOYMENT.md** - Deployment and operations
330+
- **apps/docs/** - User-facing documentation site
331+
- **Code comments** - Document complex logic
332+
333+
### Writing Good Documentation
334+
335+
- Use clear, concise language
336+
- Include code examples
337+
- Add screenshots for UI features
338+
- Keep it up-to-date
339+
- Test all examples

0 commit comments

Comments
 (0)