A comprehensive monorepo for decentralized finance applications built on Stacks, featuring advanced trading tools, token infrastructure, and real-time data services.
Charisma uses a modern monorepo architecture powered by Turborepo and pnpm workspaces. The codebase is organized for clarity, scalability, and developer velocity.
/apps/ # Application entrypoints (Next.js, CLI, etc.)
/modules/ # Internal shared logic, adapters, business logic, types (not published)
/services/ # Deployable backend services (APIs, workers, daemons, etc.)
/packages/ # Public packages (SDKs, libraries, config, for external npm publishing)
/docs/ # Technical documentation and API references
/scripts/ # Utility scripts for development and automation
| Directory | Purpose | Publishes to npm? | Example Contents |
|---|---|---|---|
| apps/ | User-facing applications | No | simple-swap, dex-cache |
| modules/ | Internal shared logic/modules | No | db-adapter, types, core |
| services/ | Deployable backend services | No | user-api, party-service |
| packages/ | Public packages/libraries | Yes | blaze-sdk, dexterity |
- simple-swap: Main DEX interface with limit orders, DCA strategies, and advanced trading features
- pro-interface: Professional trading tools with charts and analytics
- dex-cache: Price discovery, liquidity analysis, and market data caching
- token-cache: Token metadata caching and validation service
- metadata: Token and contract metadata management
- charisma-party: Real-time data feeds powered by PartyKit
- blaze-signer: Experimental playground for transaction signing, verification, and intent management concepts
- contract-search: Smart contract discovery and analysis
- launchpad: Token creation and contract deployment tools
- meme-roulette: Gaming application with token mechanics
- discovery: Environment/hostname discovery and validation
- (Add more as your codebase evolves)
- (Add more as your backend grows)
- @repo/blaze-sdk: Stacks blockchain SDK for external developers
- @repo/tx-monitor-client: Transaction monitoring client
- @repo/tokens: Token metadata library and caching utilities
- @repo/ui: Shared UI component library
- @repo/eslint-config: ESLint configurations for external use
- @repo/typescript-config: TypeScript configurations for external use
- Framework: Next.js 15 with App Router
- Language: TypeScript (strict mode)
- Styling: Tailwind CSS
- UI Components: shadcn/ui with custom extensions
- Charts: Lightweight Charts for trading interfaces
- State Management: React Context
- Database: Vercel KV (Redis-compatible key-value store)
- File Storage: Vercel Blob
- Real-time: PartyKit for WebSocket connections
- Blockchain: Stacks integration via Blaze SDK
- APIs: RESTful endpoints with Next.js API routes
- Monorepo: Turborepo for build optimization and caching
- Package Manager: pnpm with workspaces
- Deployment: Vercel for all applications
- CI/CD: Automated builds and testing pipelines
- Node.js 18+
- pnpm (recommended)
- Git
git clone <repository-url>
cd charisma
pnpm installCopy and configure environment variables for each app/service as needed:
cp apps/simple-swap/.env.example apps/simple-swap/.env.local
cp apps/dex-cache/.env.example apps/dex-cache/.env.local
# ...repeat for other apps/services# Start all development servers
pnpm dev
# Or start specific applications/services
pnpm dev --filter=apps/simple-swap
pnpm dev --filter=services/party-servicepnpm dev # Start all applications/services
pnpm build # Build all packages, modules, services, and apps
pnpm test # Run all tests
pnpm lint # Lint all packages
pnpm clean # Clean all build artifacts
# Add dependency to a specific workspace
pnpm add <pkg> --filter=modules/business-logic- apps/: User-facing applications (web, CLI, etc.)
- modules/: Internal, reusable logic (business logic, adapters, types)
- services/: Deployable backend services (APIs, workers)
- packages/: Public, versioned packages for external use
- Prefer direct imports from
modules/for internal logic sharing (type-safe, no HTTP overhead) - Use HTTP/WebSocket APIs only for cross-service boundaries or external integrations
- Shared types/interfaces live in
modules/shared-types
- services/dex-cache: Fetches and processes market data
- Vercel KV: Caches processed price information
- services/party-service: Broadcasts real-time updates
- apps/simple-swap: Consumes data for trading interface
- services/token-cache: Maintains metadata cache
- services/metadata: Enriches token information
- modules/shared-types: Provides typed interfaces
- All Apps/Services: Consume consistent token data
# Terminal 1: Start shared services
pnpm dev --filter=services/token-cache --filter=services/party-service
# Terminal 2: Start main applications
pnpm dev --filter=apps/simple-swap --filter=apps/dex-cachepnpm test --filter=apps/simple-swap
pnpm test --filter=modules/business-logicpnpm build --filter=packages/*
pnpm build --filter=apps/simple-swap- Shared logic: Place in
modules/ - App-specific code: Keep within
apps/ - Deployable services: In
services/ - Public packages: In
packages/ - API integrations: Centralize in
modules/orpackages/as appropriate
# Create a new module
pnpm create-module <module-name>
# Create a new service
pnpm create-service <service-name>(Add scripts or templates as needed for consistency)
- Token Cache API:
/api/v1/tokens/*- Token metadata and validation - Price API:
/api/v1/prices/*- Real-time and historical pricing - Order API:
/api/v1/orders/*- Order management and execution
- Stacks API: Blockchain data and transaction broadcasting
- PartyKit: Real-time WebSocket connections
- Vercel Storage: KV and Blob storage operations
Each application and service deploys independently to Vercel or your chosen platform:
cd apps/simple-swap
vercel deploy
cd services/party-service
vercel deploy- Packages, modules, and services are built automatically during deployment
- Turborepo handles build optimization and caching
- Dependencies are resolved across the entire monorepo
- Production variables configured in Vercel dashboard
- Staging environments use separate KV and Blob instances
- PartyKit environments isolated per deployment
- Unit Tests: Individual component and utility testing
- Integration Tests: Cross-module/service functionality
- E2E Tests: Full application workflows
- API Tests: Backend service validation
pnpm test
pnpm test --filter=apps/simple-swap
pnpm test --filter=modules/business-logic
pnpm test:watch --filter=apps/simple-swap- Follow TypeScript strict typing
- Use shared UI components from
@repo/ui - Maintain test coverage for new features
- Update documentation for API changes
- Follow conventional commit messages
- Create feature branch from
main - Implement changes with tests
- Run
pnpm lintandpnpm test - Update relevant documentation
- Submit PR with clear description
- ESLint and Prettier enforce consistent formatting
- TypeScript ensures type safety across packages
- Automated testing validates functionality
- Performance monitoring tracks application health
- Application READMEs: Each app/service/module has specific setup instructions
- API Documentation: Available in
/docsapplication - Component Library: Documented in
packages/ui - Technical Guides: Located in
/docsfor complex integrations
- Build Errors: Run
pnpm cleanthenpnpm install - Type Errors: Ensure shared modules/packages are built first
- Environment Variables: Check all required variables are set
- Port Conflicts: Applications/services use different ports by default
Set DEBUG=true in environment variables for detailed logging across all applications and services.
Built by the Charisma team for the Stacks ecosystem.