Architecture
Interfaces
Interfaces are how modules talk to each other in Antelopejs. Think of them like contracts - they define what one module can expect from another, without either one needing to know exactly how the other works.
Interfaces can have different versions, so you can add new features without breaking existing code. Once a version is published, its structure stays the same, so you can swap out one module for another as long as they implement the same interface version.
Modules
Modules are the building blocks of your app. Each module is like a mini-application that handles a specific part of your system.
Modules can do two things with interfaces:
- Export interfaces (offering services to other modules)
- Import interfaces (using services from other modules)
This way, modules can work together without being tightly coupled to each other.
Core
The Core is like the conductor of an orchestra - it keeps everything running smoothly but doesn't play the music itself. It's intentionally small and stays out of your way.
The Core has three main jobs:
- Module Management: It loads modules, starts them up in the right order, and handles their lifecycle
- Interface Connections: It routes requests between modules, making sure calls to an interface reach the right module
- Dependency Injection: It automatically connects modules that need interfaces with modules that provide them
By keeping business logic in modules and out of the core, Antelopejs lets you customize almost everything without hacking the framework itself.
How It All Works
This diagram shows the key parts of Antelopejs:
- Core: The traffic director that manages everything
- Modules: The pieces that do actual work (like Stripe and your app)
- Interfaces: The contracts that let modules talk to each other
In this example, the Stripe module provides the Payment interface in two versions. Your app module can use either version (or both). The Core handles all the connections behind the scenes.
Why This Matters
Everyone Develops the Same Way
Since the core is minimal, everyone follows the same patterns. This makes teamwork easier and lets you customize anything without changing the framework.
Swap Components Easily
Need to switch payment providers from Stripe to something else? If the new provider uses the same interface, you just plug it in - no need to change your app's code.
Smooth Upgrades
You can run old and new versions of interfaces side by side. This means you can upgrade gradually, and security fixes in newer versions don't force you to rewrite everything.
Update Live Systems
You can reload modules while your app is running. When a module gets updated, calls to it are held until it's ready, so your app stays responsive and stable.