Initial commit: Lamassu modernization project
- Add lamassu-server, lamassu-machine, lamassu-install as submodules - Add CLAUDE.md with development guidance - Add docs/modernization-plan.md with 2026 refactoring roadmap - Add .gitignore for Node.js/Nix development Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
commit
9adee6e37f
7 changed files with 670 additions and 0 deletions
121
CLAUDE.md
Normal file
121
CLAUDE.md
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Repository Overview
|
||||
|
||||
This is the Lamassu Bitcoin ATM system, consisting of three components:
|
||||
|
||||
- **lamassu-server/** - Backend services and admin dashboard (pnpm monorepo with Turbo)
|
||||
- **lamassu-machine/** - ATM kiosk software that runs on the physical machines
|
||||
- **lamassu-install/** - Production installation and upgrade scripts
|
||||
|
||||
## Commands
|
||||
|
||||
### lamassu-server (monorepo)
|
||||
|
||||
```bash
|
||||
cd lamassu-server
|
||||
|
||||
# Install dependencies
|
||||
pnpm install
|
||||
|
||||
# Run all packages in development mode (server + admin-ui)
|
||||
pnpm run dev
|
||||
|
||||
# Build all packages
|
||||
pnpm run build
|
||||
|
||||
# Run tests across all packages
|
||||
pnpm run test
|
||||
|
||||
# Run a single test file
|
||||
cd packages/admin-ui && pnpm vitest run path/to/file.test.js
|
||||
|
||||
# Database migrations
|
||||
node packages/server/bin/lamassu-migrate
|
||||
|
||||
# Generate SSL certificates (first-time setup)
|
||||
bash packages/server/tools/cert-gen.sh
|
||||
|
||||
# Create admin user
|
||||
node packages/server/bin/lamassu-register admin@example.com superuser
|
||||
|
||||
# Regenerate database types (requires running postgres)
|
||||
cd packages/typesafe-db && pnpm run generate-types
|
||||
```
|
||||
|
||||
### lamassu-machine
|
||||
|
||||
```bash
|
||||
cd lamassu-machine
|
||||
|
||||
# Install and build
|
||||
npm install
|
||||
bash ./setup.sh
|
||||
npm run build
|
||||
|
||||
# Run tests
|
||||
npm test
|
||||
|
||||
# Development with mock hardware
|
||||
node bin/fake-bills.js # In one terminal
|
||||
node bin/lamassu-machine --mockBillValidator --mockBillDispenser --mockCam --mockPair '<totem>'
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
### lamassu-server Monorepo Structure
|
||||
|
||||
```
|
||||
packages/
|
||||
├── server/ # Express + Apollo GraphQL backend (CommonJS)
|
||||
├── admin-ui/ # React 18 + Vite + MUI admin dashboard (ESM)
|
||||
├── coins/ # @lamassu/coins - cryptocurrency constants (TypeScript)
|
||||
└── typesafe-db/ # @lamassu/typesafe-db - Kysely database layer (TypeScript)
|
||||
```
|
||||
|
||||
**Dependency flow**: `server` and `admin-ui` depend on `coins` and `typesafe-db`
|
||||
|
||||
**Key server entry points**:
|
||||
- `bin/lamassu-server` - Main HTTPS server (port 3000, client cert auth)
|
||||
- `bin/lamassu-admin-server` - Admin API server
|
||||
- 20+ CLI utilities in `bin/` for operations tasks
|
||||
|
||||
**GraphQL**: Two implementations exist:
|
||||
- `lib/graphql/` - Machine-facing API
|
||||
- `lib/new-admin/graphql/` - Admin dashboard API
|
||||
|
||||
### lamassu-machine
|
||||
|
||||
The ATM kiosk uses a state machine architecture (`machina.js`) in `lib/brain.js` (134KB). The UI is vanilla JavaScript with Babel transpilation.
|
||||
|
||||
**Hardware drivers** in `lib/`: id003, mei, puloon, ccnet (bill validators), printer, leds, camera
|
||||
|
||||
## Code Style
|
||||
|
||||
**Formatting** (enforced by husky pre-commit):
|
||||
- 2-space indent, no semicolons, single quotes, trailing commas
|
||||
- Prettier + ESLint with auto-fix on commit
|
||||
|
||||
**TypeScript**: Only in `packages/coins/` and `packages/typesafe-db/`. Use `@typescript-eslint/consistent-type-imports` for imports.
|
||||
|
||||
**Server code**: CommonJS (`require`/`module.exports`)
|
||||
**Admin UI**: ESM (`import`/`export`)
|
||||
|
||||
## Database
|
||||
|
||||
PostgreSQL with Kysely ORM. Types are auto-generated from the schema.
|
||||
|
||||
**Environment**: Configure postgres connection in `packages/server/.env`
|
||||
|
||||
## Requirements
|
||||
|
||||
- Node.js 22+
|
||||
- pnpm 10+
|
||||
- PostgreSQL
|
||||
- Python 3 (for native dependency builds)
|
||||
|
||||
## Documentation
|
||||
|
||||
- `docs/modernization-plan.md` - 2026 modernization roadmap (Obsidian-compatible)
|
||||
Loading…
Add table
Add a link
Reference in a new issue