ChaCC API - A modular FastAPI application for extensible APIs
Project description
ChaCC API
ChaCC API is a modular FastAPI application platform that allows you to build extensible APIs through pluggable modules.
What is ChaCC API
ChaCC API provides a flexible foundation for building modular applications. Instead of building a monolithic API, you can create separate modules that can be installed, enabled, disabled, and updated independently.
Key Features
- Modular Architecture: Build your API as independent modules that can be added or removed without modifying the core
- Automatic Database Migrations: Modules automatically create and update their database tables using the
@register_modeldecorator - Dependency Management: ChaCC resolves module dependencies automatically before loading modules using Chacc Pip Acelerator Package
- Hot Reload Support: Development mode supports automatic reloading when module files change
- Module Packaging: Build modules as
.chaccfiles for easy distribution and deployment
Use Cases
- Building extensible SaaS platforms
- Creating modular APIs with independently deployable components
- Developing reusable API modules that can be shared across projects
- Rapid prototyping with pluggable functionality
Installation
Prerequisites
- Python 3.10 or higher
- PostgreSQL (optional, SQLite works for development)
- Fast API understanding
Install from PyPI
pip install chacc-api
Install from Source
git clone https://github.com/jonas1015/chacc-api
cd chacc-api
pip install -e .
Docker Installation
docker pull chacc-api:latest
docker run -d -p 8080:8080 chacc-api:latest
Or use Docker Compose:
docker-compose -f deployment/docker/docker-compose.yml up -d
Command Line Interface
The chacc command provides tools for module development and deployment.
Development Environment
# Create a new module
chacc create my_module
# Build a module into a .chacc package
chacc build plugins/my_module
# Deploy a module
chacc deploy mymodule.chacc
# Start development server with auto-reload
chacc run server --dev
# Start development server on custom port
chacc server --host 127.0.0.1 --port 3000
Production Environment
# Start production server (runs tests first)
chacc run server
Deployment Commands
# Deploy a module to a remote server
chacc deploy my_module.chacc
Requires environment variables:
CHACC_DEPLOY_URL- URL of the remote ChaCC API server
Optional:
CHACC_DEPLOY_API_KEY- API key for authenticationCHACC_DEPLOY_TIMEOUT- Request timeout in seconds (default: 30)
Learning More
From Module Scaffolding
The easiest way to understand how modules work is to create one and explore the generated code:
chacc create my_module
ls -la plugins/my_module/
This creates a complete module with:
module_meta.json- Module configurationmodule/main.py- Module entry point withsetup_pluginfunctionmodule/models.py- Database models using@register_modelmodule/routes.py- API endpointsmodule/tests/test_module.py- Unit tests
From Source Code
The source code is extensively documented. Key files to explore:
src/database.py- Database models,@register_modeldecorator, automatic migrationssrc/core_services.py- BackboneContext class that provides services to modulessrc/module_loader.py- Module loading and lifecycle managementchacc_cli/commands.py- CLI command implementations
Authentication Module Example
For a complete example of a working module, see the authentication module in chacc-authentication. It demonstrates:
- Database model definition
- API route creation
- Service registration
- Configuration handling
- Authentication utilities
Environment Variables
Required Variables
| Variable | Description |
|---|---|
SECRET_KEY |
Secret key for JWT token signing. Required in production. Must be 32+ characters. |
Database Configuration
| Variable | Default | Description |
|---|---|---|
DATABASE_ENGINE |
sqlite |
Database type: sqlite or postgresql |
DATABASE_NAME |
chaccapidb |
Database name |
DATABASE_USER |
chacc |
Database username (PostgreSQL only) |
DATABASE_PASSWORD |
(empty) | Database password (PostgreSQL only) |
DATABASE_HOST |
localhost |
Database host (PostgreSQL only) |
DATABASE_PORT |
5432 |
Database port (PostgreSQL only) |
Module Configuration
| Variable | Default | Description |
|---|---|---|
MODULES_INSTALLED_DIR |
modules_installed |
Directory containing .chacc files |
MODULES_LOADED_DIR |
.modules_loaded |
Directory for extracted modules |
PLUGINS_DIR |
plugins |
Directory for development modules |
Development Settings
| Variable | Default | Description |
|---|---|---|
DEVELOPMENT_MODE |
False |
Enable development mode |
ENABLE_PLUGIN_HOT_RELOAD |
True |
Auto-reload modules on file changes |
PLUGIN_AUTO_DISCOVERY |
True |
Automatically discover plugins |
ENABLE_PLUGIN_DEPENDENCY_RESOLUTION |
True |
Auto-resolve module dependencies |
Migration Settings
| Variable | Default | Description |
|---|---|---|
MIGRATION_MODE |
auto |
Migration mode: auto, full, or preview |
MIGRATION_BACKUP |
False |
Create backup before migration |
MIGRATION_BACKUP_DIR |
backups |
Directory for backups |
MIGRATION_AUTO_DROP |
False |
Allow destructive operations |
Redis Configuration
| Variable | Default | Description |
|---|---|---|
REDIS_ENABLED |
True |
Enable Redis |
REDIS_HOST |
localhost |
Redis host |
REDIS_PORT |
6379 |
Redis port |
REDIS_DB |
0 |
Redis database number |
REDIS_PASSWORD |
(none) | Redis password |
Other Settings
| Variable | Default | Description |
|---|---|---|
LOG_LEVEL |
INFO |
Logging level |
CHACC_DEPLOY_URL |
http://localhost:8080 |
Chacc CLI deploy URL |
Quick Start
1. Install and Run
pip install chacc-api
chacc run server --dev
2. Access the API
- API Documentation: http://localhost:8080/docs OR http://localhost:8080/redoc
- Health Check: http://localhost:8080/health
3. Create a Module
chacc create my_module
This creates a new module in plugins/my_module/. Edit the files to add your functionality.
4. Build and Deploy
chacc build plugins/my_module
chacc deploy my_module.chacc
License
Licensed under the Apache License, Version 2.0. See LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chacc_api-1.0.0b1.tar.gz.
File metadata
- Download URL: chacc_api-1.0.0b1.tar.gz
- Upload date:
- Size: 54.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e028355c5e943b514e74c98892d9358c388f13adb345d4ed28ad9121a6ddaf8a
|
|
| MD5 |
9870377f29d33f7425aac9bbd71a902d
|
|
| BLAKE2b-256 |
7da3a7128eaf4cc5c4bcdebef4b994101dad23bd543d9965c6a7e08bc44f7403
|
Provenance
The following attestation bundles were made for chacc_api-1.0.0b1.tar.gz:
Publisher:
release.yml on Jonas1015/chacc-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chacc_api-1.0.0b1.tar.gz -
Subject digest:
e028355c5e943b514e74c98892d9358c388f13adb345d4ed28ad9121a6ddaf8a - Sigstore transparency entry: 1092222832
- Sigstore integration time:
-
Permalink:
Jonas1015/chacc-api@3015350fc9fda2c8986465a727ae7c28588d4110 -
Branch / Tag:
refs/tags/v1.0.0-beta.1 - Owner: https://github.com/Jonas1015
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3015350fc9fda2c8986465a727ae7c28588d4110 -
Trigger Event:
release
-
Statement type:
File details
Details for the file chacc_api-1.0.0b1-py3-none-any.whl.
File metadata
- Download URL: chacc_api-1.0.0b1-py3-none-any.whl
- Upload date:
- Size: 61.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05baccf8e87d4421a61fe9e5ce59b035a3b94e4c0a9522d58acb4d5f8e493dcd
|
|
| MD5 |
061b991a35f727dc478258d096b1cfc8
|
|
| BLAKE2b-256 |
6934fdfed863be92ae6a7cd98bd82d7edd1a7eaf51694f35e7131320e66eacff
|
Provenance
The following attestation bundles were made for chacc_api-1.0.0b1-py3-none-any.whl:
Publisher:
release.yml on Jonas1015/chacc-api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chacc_api-1.0.0b1-py3-none-any.whl -
Subject digest:
05baccf8e87d4421a61fe9e5ce59b035a3b94e4c0a9522d58acb4d5f8e493dcd - Sigstore transparency entry: 1092222909
- Sigstore integration time:
-
Permalink:
Jonas1015/chacc-api@3015350fc9fda2c8986465a727ae7c28588d4110 -
Branch / Tag:
refs/tags/v1.0.0-beta.1 - Owner: https://github.com/Jonas1015
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@3015350fc9fda2c8986465a727ae7c28588d4110 -
Trigger Event:
release
-
Statement type: