Quickstart¶
This guide will show you how to integrate Xcore into a FastAPI application, load a simple plugin, and call its methods.
1. Project Structure¶
Create a new project directory with the following structure:
2. Configuration¶
Create an xcore.yaml file to configure the framework:
3. Create a Plugin¶
Manifest (plugin.yaml)¶
Define your plugin's metadata and entry point.
- Trusted Mode: Runs in the main process with full access.
- Fail-closed: An empty list means no special permissions are granted.
Logic (src/main.py)¶
Implement the TrustedBase contract.
4. Integrate with FastAPI¶
In your main.py, initialize and boot the Xcore kernel.
5. Run the Application¶
Start the server using Uvicorn:
Now, visit http://127.0.0.1:8000/hello/Xcore in your browser. You should see:
Common Pitfalls¶
Production Boot Failure
If you set app.env: "production", Xcore will raise a RuntimeError if your secret_key is set to the default value (b"change-me-in-production"). Always use a secure, unique key in production.
Permissions are fail-closed
If your plugin needs to access certain services or perform restricted actions, you must explicitly declare them in the plugin.yaml manifest.
Next Steps¶
- You have a running Xcore application.
- Learn about Execution Modes (Trusted vs. Sandboxed).
- Explore the Service Container to access Databases and Cache.
- Understand the Plugin Lifecycle.