Skip to content

sprinklelabs/sprinkle-api

Repository files navigation

sprinkle-api

REST API backend for the Sprinkle developer cloud platform.

Built with Express 5, Drizzle ORM, OpenAI SDK, and Ethers.js. Handles authentication, AI inference proxying, smart wallet operations, relay networking, billing, and domain management.

Stack

  • Runtime: Node.js 20+, TypeScript
  • Framework: Express 5
  • Database: PostgreSQL via Drizzle ORM (see sprinkle-db)
  • AI: OpenAI SDK (compatible with any OpenAI-compatible provider)
  • Onchain: Ethers.js, ERC-4337 smart accounts
  • Logging: Pino + pino-http
  • Auth: JWT, express-session, OAuth (GitHub, Google)

Routes

Prefix Description
/v1/auth Sign up, sign in, OAuth callbacks, session management
/v1/ai Chat completions, image generation, speech, embeddings
/v1/wallets Smart account creation, signing, session keys
/v1/relay Intent submission and status tracking
/v1/keys API key management
/v1/projects Project CRUD and configuration
/v1/billing Usage, credits, and onchain billing
/v1/domains Domain provisioning and DNS management
/v1/analytics Usage stats and activity logs

Getting started

git clone https://github.com/sprinklelabs/sprinkle-api
cd sprinkle-api
pnpm install
cp .env.example .env
# Fill in your environment variables
pnpm dev

The server starts on http://localhost:3000 by default.

Environment variables

See .env.example for the full list. Required keys:

DATABASE_URL=
SESSION_SECRET=
OPENAI_API_KEY=
BACKEND_SIGNER_KEY=
TREASURY_ADDRESS=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=

Development

pnpm dev        # Start with hot reload
pnpm build      # Compile TypeScript
pnpm typecheck  # Type-check without emit

Contributing

  1. Fork the repo and create a feature branch.
  2. Run pnpm typecheck before committing.
  3. Open a pull request with a clear description of the change.

License

MIT. See LICENSE.

About

Express REST API backend for the Sprinkle developer cloud platform

Topics

Resources

License

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors