How bomzj/cryptofair works
Project Type and Purpose
• CryptoFair is a full-stack, single-page application (SPA) built with Vue.js that aggregates peer-to-peer cryptocurrency exchange offers (LocalBitcoins, Paxful, Binance P2P, etc.) and presents them to the user without requiring KYC. It’s hosted as a static site on Netlify and uses serverless functions (AWS Lambda via Netlify) to proxy external APIs and handle dynamic tasks.
Main Components
a. Frontend (Vue.js SPA)
• Located under src/ – key files: app.js, store.js, main.css, layout/, ui/, filter/, offer/, currency/, cryptocurrency/
• Renders the UI, handles routing, state management, user interactions and search/filter forms.
• Uses http-client.js to make AJAX requests.
b. Hosting & CDN
• Netlify for static asset hosting (public/, index.html, CSS, JS bundles) and serving the SPA.
• netlify.toml configures routing and function endpoints.
c. Serverless Functions (Netlify Lambdas)
• src/lambda/currency-rates.js – fetches live forex rates
• src/lambda/proxy-fetch.js – proxies calls to P2P exchange REST endpoints (Binance, LocalBitcoins, etc.) to avoid CORS issues
• src/lambda/send-mail.js – processes contact form submissions and sends emails via an SMTP or transactional email API
d. External Services
• P2P Exchange APIs (Binance-Exchange, LocalBitcoins, Paxful, HodlHodl, LocalCryptos, LocalCoinSwap)
• Currency rates providers (e.g., fixer.io, openexchangerates)
• Email delivery service (SMTP or 3rd-party provider)
Relationships & Data Flow
• User loads the SPA from the Netlify CDN.
• SPA components invoke Vuex store actions → call http-client.js → send HTTP requests to Netlify function endpoints (/ .netlify/functions/*).
• proxy-fetch Lambda forwards requests to external P2P exchange REST APIs → returns raw offers → SPA normalizes and displays them.
• currency-rates Lambda fetches live exchange rates → SPA converts prices into local currencies.
• send-mail Lambda handles form submissions from the ContactForm component → sends email.
Architectural Patterns & Design Principles
• SPA + API-driven architecture
• Serverless microservices: each Lambda does one job (proxy, rates, mail)
• Separation of concerns: UI components vs. service modules (src/exchange, src/currency, src/cryptocurrency) vs. static JSON resources (currencies.json, cryptocurrencies.json, payment-methods.json)
• Modular code: each external exchange wrapped in its own service file under src/exchange/