mirror of https://github.com/buster-so/buster.git
2.3 KiB
2.3 KiB
Buster API Repository Navigation Guide
Row Limit Implementation Notes
All database query functions in the query_engine library have been updated to respect a 5000 row limit by default. The limit can be overridden by passing an explicit limit value. This is implemented in the libs/query_engine directory.
Documentation
The project's detailed documentation is in the /documentation
directory:
handlers.mdc
- Handler patternslibs.mdc
- Library construction guidelinesrest.mdc
- REST API formattingtesting.mdc
- Testing standardstools.mdc
- Tools documentationwebsockets.mdc
- WebSocket patterns
While these files contain best practices for writing tests, REST patterns, etc., each subdirectory should have its own README.md or CLAUDE.md that should be referenced first when working in that specific area. These subdirectory-specific guides often contain implementation details and patterns specific to that component.
Repository Structure
src/
- Main server coderoutes/
- API endpoints (REST, WebSocket)utils/
- Shared utilitiestypes/
- Common type definitions
libs/
- Shared libraries- Each lib has its own Cargo.toml and docs
migrations/
- Database migrationstests/
- Integration testsdocumentation/
- Detailed docsprds/
- Product requirements
Build Commands
make dev
- Start developmentmake stop
- Stop developmentcargo test -- --test-threads=1 --nocapture
- Run testscargo clippy
- Run lintercargo build
- Build project
Core Guidelines
- Use
anyhow::Result
for error handling - Group imports (std lib, external, internal)
- Put shared types in
types/
, route-specific types in route files - Use snake_case for variables/functions, CamelCase for types
- Never log secrets or sensitive data
- All dependencies inherit from workspace using
{ workspace = true }
- Use database connection pool from
get_pg_pool().get().await?
- Write tests with
tokio::test
for async tests
Common Database Pattern
let pool = get_pg_pool();
let mut conn = pool.get().await?;
diesel::update(table)
.filter(conditions)
.set(values)
.execute(&mut conn)
.await?
Common Concurrency Pattern
let futures: Vec<_> = items
.into_iter()
.map(|item| process_item(item))
.collect();
let results = try_join_all(futures).await?;