Implement modular architecture with core services and Nostr integration

- Introduce a modular application structure with a new app configuration file to manage module settings and features.
- Implement a dependency injection container for service management across modules.
- Create a plugin manager to handle module registration, installation, and lifecycle management.
- Develop a global event bus for inter-module communication, enhancing loose coupling between components.
- Add core modules including base functionalities, Nostr feed, and PWA services, with support for dynamic loading and configuration.
- Establish a Nostr client hub for managing WebSocket connections and event handling.
- Enhance user experience with a responsive Nostr feed component, integrating admin announcements and community posts.
- Refactor existing components to align with the new modular architecture, improving maintainability and scalability.
This commit is contained in:
padreug 2025-09-04 23:43:33 +02:00
parent 2d8215a35e
commit 519a9003d4
16 changed files with 2520 additions and 14 deletions

71
src/app.config.ts Normal file
View file

@ -0,0 +1,71 @@
import type { AppConfig } from './core/types'
export const appConfig: AppConfig = {
modules: {
base: {
name: 'base',
enabled: true,
lazy: false,
config: {
nostr: {
relays: JSON.parse(import.meta.env.VITE_NOSTR_RELAYS || '["wss://relay.damus.io", "wss://nos.lol"]')
},
auth: {
sessionTimeout: 24 * 60 * 60 * 1000, // 24 hours
},
pwa: {
autoPrompt: true
}
}
},
'nostr-feed': {
name: 'nostr-feed',
enabled: true,
lazy: false,
config: {
refreshInterval: 30000, // 30 seconds
maxPosts: 100,
adminPubkeys: JSON.parse(import.meta.env.VITE_ADMIN_PUBKEYS || '[]'),
feedTypes: ['announcements', 'general']
}
},
market: {
name: 'market',
enabled: true,
lazy: false,
config: {
defaultCurrency: 'sats',
paymentTimeout: 300000, // 5 minutes
maxOrderHistory: 50
}
},
chat: {
name: 'chat',
enabled: true,
lazy: true, // Load on demand
config: {
maxMessages: 500,
autoScroll: true,
showTimestamps: true
}
},
events: {
name: 'events',
enabled: true,
lazy: false,
config: {
ticketValidationEndpoint: '/api/tickets/validate',
maxTicketsPerUser: 10
}
}
},
features: {
pwa: true,
pushNotifications: true,
electronApp: false,
developmentMode: import.meta.env.DEV
}
}
export default appConfig