Backend API for wallet authentication using SIWE (Sign-In with Ethereum).
# Install dependencies
bun install
# Start PostgreSQL database
docker-compose up -d
# Generate database migrations
bun run db:generate
# Run migrations
bun run db:migrate
# Start development server
bun dev
# API runs on http://localhost:8080GET /api/health- Check API status
GET /api/auth/nonce- Get authentication noncePOST /api/auth/verify- Verify wallet signaturePOST /api/auth/logout- Logout userGET /api/auth/status- Check auth status
GET /api/a/profile- User profile data
- Get nonce from
/api/auth/nonce - Sign message with wallet
- Send signature to
/api/auth/verify - Access protected routes under
/api/a/*
Create a .env file:
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/evm_wallet # your db url
PORT=8080# Start PostgreSQL with Docker
docker-compose up -d
# Generate migration files
bun run db:generate
# Apply migrations to database
bun run db:migrate
# Open database GUI (optional)
bun run db:studio- SIWE message verification
- HTTP-only cookies
- Persistent session management with PostgreSQL
- Database-backed user authentication
- Framework: Hono.js
- Database: PostgreSQL
- ORM: Drizzle ORM
- Crypto: Viem
- Runtime: Bun