A design competition platform built with Loco (Rust) backend and React frontend.
Bit by Design is a web application for hosting design competitions. Participants can submit their designs, and the community can vote on their favorites.
- Loco - Rust web framework (Rails-like)
- SeaORM - Async ORM for database operations
- PostgreSQL - Primary database
- JWT - Authentication
- React - UI library
- TanStack Router - Type-safe routing
- TanStack Query - Data fetching & caching
- Rsbuild - Rust-powered build tool
- Tailwind CSS v4 - Utility-first CSS
- GSAP - Animations
- Rust (stable) - Install via rustup
- Bun (or Node.js 18+) - Install Bun
- PostgreSQL - Local instance or Docker
- Docker (optional) - For running PostgreSQL
git clone https://github.com/your-username/bit-by-design.git
cd bit-by-designcp .env.example .development.envEdit .development.env with your actual values:
DATABASE_URL- PostgreSQL connection stringJWT_SECRET- Secret key for JWT tokens (min 32 characters)MAILER_*- SMTP configuration for emails
Using Docker:
docker run -d --name postgres \
-e POSTGRES_USER=loco \
-e POSTGRES_PASSWORD=loco \
-e POSTGRES_DB=bit-by-design_development \
-p 5432:5432 \
postgres:16Backend:
cargo buildFrontend:
cd frontend
bun installcargo loco db migrateBackend (runs on http://localhost:5150):
cargo loco startFrontend (runs on http://localhost:3000 with hot reload):
cd frontend
bun run devFor production builds, the frontend is served directly by Loco:
cd frontend && bun run build
cd .. && cargo loco startbit-by-design/
├── src/ # Rust backend source
│ ├── bin/ # CLI entry point
│ ├── controllers/ # HTTP request handlers
│ ├── models/ # Database models (SeaORM entities)
│ ├── views/ # Response serialization
│ ├── mailers/ # Email templates
│ ├── workers/ # Background job processors
│ └── tasks/ # CLI tasks
├── migration/ # Database migrations (SeaORM)
├── config/ # Environment configurations
│ ├── development.yaml # Development settings
│ ├── test.yaml # Test settings
│ └── production.yaml # Production settings (gitignored)
├── frontend/ # React frontend
│ ├── src/
│ │ ├── routes/ # TanStack Router pages
│ │ ├── components/ # React components
│ │ ├── hooks/ # Custom React hooks
│ │ ├── api/ # API client & queries
│ │ └── styles/ # CSS styles
│ └── package.json
└── tests/ # Integration tests
# Start the server
cargo loco start
# Run tests
cargo test
# Run linter
cargo clippy
# Generate a new controller
cargo loco generate controller <name>
# Generate a new model
cargo loco generate model <name>
# Run database migrations
cargo loco db migrate
# Rollback last migration
cargo loco db rollback
# Generate migration
cargo loco db generate migration <name>cd frontend
# Start dev server with hot reload
bun run dev
# Build for production
bun run build
# Preview production build
bun run preview
# Lint code
bun run lint- Rust: Uses
rustfmtwith project settings (.rustfmt.toml) - TypeScript/React: Uses Biome for formatting and linting
# Run all backend tests
cargo test
# Run tests with output
cargo test -- --nocapture
# Run specific test
cargo test test_name-
Build the frontend:
cd frontend && bun run build
-
Build the Rust binary:
cargo build --release
-
The binary is at
target/release/bit_by_design-cli
Ensure these are set in production:
DATABASE_URL- PostgreSQL connection stringJWT_SECRET- Secure random string (min 32 chars)MAILER_*- SMTP configurationLOCO_ENV=production- Sets production mode
LOCO_ENV=production ./target/release/bit_by_design-cli start- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow existing code style (run
cargo fmtandbun run lint) - Write tests for new functionality
- Update documentation as needed
- Keep commits focused and atomic
GitHub Actions runs on every push and PR:
rustfmt- Code formatting checkclippy- Rust linter with strict settingstest- Full test suite with PostgreSQL
This project is licensed under the MIT license. Check the LICENSE file.