Overview
The@repo/dally package provides authentication utilities, environment configuration, and API helpers for Openlane applications. It centralizes configuration management and provides type-safe functions for user authentication and AI features.
Installation
Package Exports
| Export | Path | Description |
|---|---|---|
auth | @repo/dally/auth | Environment config and API URLs |
user | @repo/dally/user | User authentication functions |
chat | @repo/dally/chat | Chat configuration |
ai | @repo/dally/ai | AI/LLM configuration |
Authentication Configuration
API URLs and Configuration
Environment Detection
Security Configuration
Feature Flags
Third-party Integration
User Authentication
User Registration
User Verification
User Login Types
Chat Configuration
AI Configuration
AI Feature Detection
Google Vertex AI Configuration
AI Generation Parameters
AI Integration Example
Common Patterns
WebSocket Connection
API Client Configuration
Protected Route Check
Environment Variables
The package expects these environment variables:Authentication
NEXT_PUBLIC_OPENLANE_URL- Openlane API base URLSESSION_COOKIE_NAME- Session cookie nameSESSION_COOKIE_DOMAIN- Session cookie domainCOOKIE_DOMAIN- General cookie domainNEXT_PUBLIC_CSRF_COOKIE_NAME- CSRF token cookieNEXT_PUBLIC_CSRF_HEADER- CSRF header name
Features
NEXT_PUBLIC_INCLUDE_QUESTIONNAIRE_CREATION- Enable questionnaire featuresNEXT_PUBLIC_ENABLE_CHATBOT- Enable chat featuresNEXT_PUBLIC_ENABLE_DEVREV_CHAT- Enable DevRev chatNEXT_PUBLIC_AI_SUGGESTIONS_ENABLED- Enable AI features
Third-party
NEXT_PUBLIC_RECAPTCHA_SITE_KEY- reCAPTCHA site keyNEXT_PUBLIC_CHAT_APP_ID- Chat application IDNEXT_PUBLIC_SURVEYJS_KEY- Survey.js license keyNEXT_PUBLIC_PIRSCH_KEY- Pirsch analytics keySTRIPE_SECRET_KEY- Stripe secret key (server-side)
AI Configuration
GOOGLE_SERVICE_ACCOUNT_KEY_B64- Google service account keyGOOGLE_AI_PROJECT_ID- Google AI project IDGOOGLE_AI_REGION- Google AI regionGOOGLE_AI_MODEL_NAME- Gemini model nameBEDROCK_MODEL_ARN- AWS Bedrock model ARN
Best Practices
- Centralize configuration - Import from
@repo/dallyinstead of accessingprocess.envdirectly - Type safety - Use exported types like
LoginUserandRegisterUser - Error handling - Always check for
.messageproperty in API responses - Feature flags - Check configuration before rendering features
- Server vs Client - Be aware of which values are public vs server-only
Security Considerations
- CSRF tokens are included in API requests
- Session cookies use secure domains
- reCAPTCHA prevents automated abuse
- Environment variables separate public and private config
- Email domain restrictions can be enforced
Related
- @repo/codegen - GraphQL code generation
- @repo/ui - UI component library