How adonisjs/core works
Main Components Organization
a) Core Framework Layer
• Container/IoC System (modules/container.ts)
• Application Core (modules/app.ts)
• Configuration System (modules/config.ts)
• Service Providers (providers/ directory)
b) HTTP Layer
• Server (services/server.ts)
• Router (services/router.ts)
• Middleware System (commands/make/middleware.ts)
• Controllers (commands/make/controller.ts)
• Body Parser (modules/bodyparser/)
c) Security Layer
• Encryption (modules/encryption.ts)
• Hashing (modules/hash/)
• Authentication (implied by structure)
d) Developer Tools
• CLI (modules/ace/)
• REPL (commands/repl.ts)
• Testing Utils (src/test_utils/)
• Development Server (commands/serve.ts)
Component Relationships
HTTP Request Flow:
Server → Router → Middleware → Controller → Response
Service Layer:
Controllers ←→ Services
Services ←→ Events System
Services ←→ Database (external)
Provider System:
Service Providers → Container
Container → Framework Services
Key Architectural Patterns to Highlight
• Dependency Injection (shown by the Container's relationships)
• Event-driven architecture (modules/events.ts)
• MVC pattern (controllers, views, implied models)
• Middleware pipeline
• Service Provider pattern
Important Details
a) Framework Bootstrap Flow:
Ignitor (src/ignitor/) → App Provider → Service Providers → Application
b) Command System Structure:
Ace Kernel → Commands → Command Handlers
c) Development Tools Integration:
CLI Tools ←→ Application Core
Testing Utils ←→ HTTP Layer
REPL ←→ Application Context