Development Setup
Get Rarebox running locally for development.
Prerequisites
- Node.js 18+ (LTS recommended)
- npm 9+
- Git
Clone & Install
git clone https://github.com/novaoc/rarebox.git
cd rarebox
npm installStart Dev Server
npm run devOpens at http://localhost:5173. Vite provides instant HMR — changes to Vue components, CSS, and JS reflect immediately.
Test Serverless Functions Locally
The Python serverless functions in api/ can be tested with the Vercel CLI:
npm i -g vercel
vercel devThis starts a combined dev server: Vite handles the frontend, Vercel CLI emulates the serverless function runtime. API endpoints are available at /api/*.
Python Dependencies
The serverless functions require Python 3.9+ with:
pip install httpx beautifulsoup4These are specified in requirements.txt and installed automatically by Vercel during deployment.
Environment Variables
Create a .env file in the project root if needed:
# Optional: pokemontcg.io API key for higher rate limits (20k/day without, more with)
# VITE_POKEMONTCG_API_KEY=your-key-hereTIP
You don't need an API key to develop locally. The default rate limit (20,000 requests/day) is more than enough for development.
Build for Production
npm run buildOutputs to dist/. Preview the production build locally:
npm run previewProject Structure
See Project Structure for a full walkthrough of the codebase.
Key Patterns
Adding a New TCG
- Create a fetcher in
src/services/tcg/cardPreloader.js - Add a provider entry in
src/services/tcg/providers.js - Add search handler in
src/services/tcg/multiSearch.js - Add game constant in
src/components/CardLoadIndicator.vue - Update price refresh routing in
src/stores/portfolio.js - Update data schema docs
Adding a New API Integration
- Create a service in
src/services/following existing patterns - Add caching (in-memory with TTL, 404 caching, request timeouts)
- Add retry with backoff (2 retries, 1s/2s delays)
- Set a 15-second timeout on all fetches
- If server-side is needed (CORS, scraping), add a Python function in
api/ - Document the integration in
docs/architecture/api-integrations.md