# π CocoBase v2.0 - Self-Hosted Backend as a Service
A **production-ready**, self-hosted Backend as a Service framework with **real-time capabilities**, **event system**, **file uploads**, and **SQL power**. Built with FastAPI and SQLModel for modern Python applications.
## β¨ What Makes CocoBase Special
- ποΈ **Real SQL Tables** - Traditional database architecture (not JSON storage)
- π― **Event-Driven** - 13 lifecycle hooks for custom business logic
- π‘ **Real-time** - WebSocket subscriptions with filtering
- π **File Storage** - Built-in with cloud provider support (S3, Cloudinary, B2)
- π» **SQL Editor** - Execute queries from the dashboard
- π **Extensible** - Add custom routes with full database access
- π€ **Built-in Auth** - User model with bcrypt password hashing
- π **Zero Config** - Works immediately out of the box
- π¨ **Web Dashboard** - Visual interface for everything
- π **Auto Docs** - Interactive API documentation
---
## π New in v2.0
### 1. **Event System**
Register callbacks for lifecycle events:
```python
@cocobase.events.on(EventType.AFTER_CREATE, collection="users")
async def on_user_created(ctx: EventContext):
print(f"New user: {ctx.data['username']}")
```
### 2. **Real-time WebSocket**
Watch collections for live updates:
```javascript
ws.send(
JSON.stringify({
action: "subscribe",
collection: "users",
filters: { is_admin: true },
})
);
```
### 3. **SQL Editor**
Execute raw SQL from the dashboard with query history!
### 4. **File Uploads**
Built-in file handling with local/cloud storage.
### 5. **Database Access**
Use the database directly in custom routes:
```python
@app.get("/custom")
async def my_route(session: Session = Depends(cocobase.get_db)):
return session.exec(text("SELECT * FROM users"))
```
---
## π¦ Installation
```bash
pip install cocobase
```
Or from source:
```bash
git clone https://github.com/lordace-coder/cocobase_framework.git
cd cocobase
pip install -e .
```
---
## β‘ Quick Start
### 1. Create `app.py`
```python
from cocobase import CocoBase
cocobase = CocoBase()
app = cocobase.app
if __name__ == "__main__":
cocobase.run()
```
### 2. Run
```bash
python app.py
```
### 3. Access
- **Dashboard**: http://localhost:8000
- **API Docs**: http://localhost:8000/docs
- **SQL Editor**: Dashboard β SQL Editor tab
---
## π― Core Features
### Traditional Database Tables
Each collection is a **real SQL table** with proper columns and types:
```python
# Create a collection via API
{
"name": "products",
"columns": [
{"name": "id", "type": "integer", "primary_key": true, "auto_increment": true},
{"name": "name", "type": "string", "required": true},
{"name": "price", "type": "float"},
{"name": "in_stock", "type": "boolean", "default": true}
]
}
```
**Supported Types**: `string`, `integer`, `float`, `boolean`, `datetime`, `text`, `json`, `file`, `files`
### Built-in User Model
Ready-to-use authentication with password hashing:
```python
# Create user (password auto-hashed)
POST /collections/users/documents
{
"username": "john",
"email": "john@example.com",
"password": "secret123"
}
```
### Event-Driven Architecture
Hook into document lifecycle:
```python
from cocobase import EventType, EventContext
# Validate before save
@cocobase.events.on(EventType.BEFORE_CREATE, collection="users")
async def validate_user(ctx: EventContext):
if not ctx.data.get('email'):
ctx.cancel() # Prevent creation
# Send notification after save
@cocobase.events.on(EventType.AFTER_CREATE, collection="orders")
async def send_confirmation(ctx: EventContext):
# Send email, update inventory, etc.
pass
```
**Available Events**:
- `APP_START`, `APP_SHUTDOWN`
- `BEFORE_CREATE`, `AFTER_CREATE`
- `BEFORE_UPDATE`, `AFTER_UPDATE`
- `BEFORE_DELETE`, `AFTER_DELETE`
- `COLLECTION_CREATED`, `COLLECTION_DELETED`
- `FILE_UPLOADED`, `FILE_DELETED`
### Real-time Subscriptions
Watch collections with WebSocket:
```javascript
const ws = new WebSocket("ws://localhost:8000/ws");
// Subscribe to collection
ws.send(
JSON.stringify({
action: "subscribe",
collection: "users",
filters: {
age_gte: 18, // Age >= 18
status: "active",
},
events: ["create", "update", "delete"],
})
);
// Receive updates
ws.onmessage = (event) => {
const message = JSON.parse(event.data);
if (message.type === "event") {
console.log("Update:", message.data);
}
};
```
**Filter Operators**: `_eq`, `_ne`, `_gt`, `_gte`, `_lt`, `_lte`, `_contains`, `_in`
### File Upload System
Upload files with automatic storage:
```python
# Upload endpoint
POST /files/upload
Content-Type: multipart/form-data
# Collection with file field
{
"name": "posts",
"columns": [
{"name": "id", "type": "integer", "primary_key": true},
{"name": "title", "type": "string"},
{"name": "featured_image", "type": "file"},
{"name": "attachments", "type": "files"} // Multiple files
]
}
```
Access files at `/uploads/filename.jpg`
### Custom Routes with Database Access
Extend CocoBase with custom endpoints:
```python
from sqlmodel import Session, text
from fastapi import Depends
@app.get("/api/stats")
async def get_stats(session: Session = Depends(cocobase.get_db)):
"""Custom endpoint with direct database access"""
result = session.execute(text("""
SELECT COUNT(*) as total_users,
SUM(CASE WHEN is_admin THEN 1 ELSE 0 END) as admins
FROM users
"""))
row = result.first()
return {"total_users": row[0], "admins": row[1]}
```
---
## π API Endpoints
### Collections
```bash
GET /collections # List all collections
POST /collections # Create collection
DELETE /collections/{name} # Delete collection
PATCH /collections/{name}/add-column # Add column dynamically
```
### Documents
```bash
GET /collections/{name}/documents # List documents
POST /collections/{name}/documents # Create document
GET /collections/{name}/documents/{id} # Get document
PATCH /collections/{name}/documents/{id} # Update document
DELETE /collections/{name}/documents/{id} # Delete document
```
### Files
```bash
POST /files/upload # Upload file
POST /files/upload-multiple # Upload multiple files
GET /files/{filename} # Get file
DELETE /files/{filename} # Delete file
```
### Real-time
```bash
WS /ws # WebSocket endpoint
GET /realtime/stats # Connection statistics
```
### SQL
```bash
POST /sql/execute # Execute SQL query
```
---
## π‘ Complete Examples
### Example 1: Blog with Events
```python
from cocobase import CocoBase, EventType, EventContext
cocobase = CocoBase()
app = cocobase.app
# Auto-generate slug from title
@cocobase.events.on(EventType.BEFORE_CREATE, collection="posts")
async def generate_slug(ctx: EventContext):
title = ctx.data.get('title', '')
ctx.data['slug'] = title.lower().replace(' ', '-')
ctx.data['view_count'] = 0
# Notify followers
@cocobase.events.on(EventType.AFTER_CREATE, collection="posts")
async def notify_followers(ctx: EventContext):
# Send notifications to followers
print(f"New post: {ctx.data['title']}")
# Custom view counter
@app.post("/api/posts/{post_id}/view")
async def increment_views(post_id: int, session: Session = Depends(cocobase.get_db)):
query = text("UPDATE posts SET view_count = view_count + 1 WHERE id = :id")
session.execute(query, {"id": post_id})
session.commit()
return {"message": "View counted"}
if __name__ == "__main__":
cocobase.run()
```
### Example 2: Real-time Dashboard
```html
<!DOCTYPE html>
<html>
<head>
<title>Live Dashboard</title>
</head>
<body>
<h1>Live User Activity</h1>
<div id="activity"></div>
<script>
const ws = new WebSocket("ws://localhost:8000/ws");
ws.onopen = () => {
ws.send(
JSON.stringify({
action: "subscribe",
collection: "users",
events: ["create", "update"],
})
);
};
ws.onmessage = (event) => {
const msg = JSON.parse(event.data);
if (msg.type === "event") {
document
.getElementById("activity")
.insertAdjacentHTML(
"afterbegin",
`<div>${msg.event} in ${msg.collection}: ${JSON.stringify(
msg.data
)}</div>`
);
}
};
</script>
</body>
</html>
```
### Example 3: Data Validation
```python
@cocobase.events.on(EventType.BEFORE_CREATE, collection="users")
async def validate_user(ctx: EventContext):
email = ctx.data.get('email', '')
# Validate email
if '@' not in email:
ctx.cancel()
return
# Check for duplicates
with Session(cocobase.engine) as session:
query = text("SELECT COUNT(*) FROM users WHERE email = :email")
result = session.execute(query, {"email": email})
if result.scalar() > 0:
ctx.cancel()
print(f"Email already exists: {email}")
```
---
## ποΈ Database Support
```python
# SQLite (default)
CocoBase(database_url="sqlite:///myapp.db")
# PostgreSQL
CocoBase(database_url="postgresql://user:pass@localhost/mydb")
# MySQL
CocoBase(database_url="mysql+pymysql://user:pass@localhost/mydb")
```
---
## π§ Configuration
```python
cocobase = CocoBase(
database_url="sqlite:///myapp.db", # Database connection
dev_mode=True, # Development mode
enable_dashboard=True, # Enable web dashboard
upload_dir="uploads" # File upload directory
)
```
---
## π Documentation
- **Quick Reference**: [`QUICK_REFERENCE.md`](QUICK_REFERENCE.md)
- **Developer Guide**: [`docs/DEVELOPER_GUIDE.md`](docs/DEVELOPER_GUIDE.md)
- **Relationships & Files**: [`docs/RELATIONSHIPS_AND_FILES.md`](docs/RELATIONSHIPS_AND_FILES.md)
- **Features Summary**: [`FEATURES_SUMMARY.md`](FEATURES_SUMMARY.md)
- **Example App**: [`example_usage.py`](example_usage.py)
---
## π Learning Resources
1. **Start Here**: Read [QUICK_REFERENCE.md](QUICK_REFERENCE.md)
2. **Run Example**: `python example_usage.py`
3. **Deep Dive**: Read [docs/DEVELOPER_GUIDE.md](docs/DEVELOPER_GUIDE.md)
4. **Build Your App**: Use the patterns and extend!
---
## ποΈ Architecture
```
βββββββββββββββββββββββββββββββββββββββββββββββ
β CocoBase v2.0 β
βββββββββββββββββββββββββββββββββββββββββββββββ€
β FastAPI + SQLModel + WebSocket + Events β
β β
β βββββββββββ βββββββββββ ββββββββββββ β
β β Events β βReal-timeβ β Storage β β
β β System β βWebSocketβ β Service β β
β βββββββββββ βββββββββββ ββββββββββββ β
β β
β βββββββββββββββββββββββββββββββββββββββββ β
β β Real SQL Tables (Not JSON) β β
β β users | posts | products | ... β β
β βββββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββββββ
```
---
## π Security
β οΈ **For Production**:
1. Add authentication (JWT/OAuth2)
2. Enable HTTPS
3. Configure CORS properly
4. Add rate limiting
5. Validate all inputs
6. Use strong passwords
7. Keep dependencies updated
---
## π Deployment
### Using Uvicorn
```bash
uvicorn app:app --host 0.0.0.0 --port 8000 --workers 4
```
### Using Docker
```dockerfile
FROM python:3.12
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
```
---
## π€ Contributing
Contributions welcome! Areas to improve:
- Additional storage providers (AWS S3, Azure Blob, etc.)
- Authentication providers (OAuth2, JWT, etc.)
- More event types
- Performance optimizations
- UI enhancements
---
## π License
MIT License - Free for personal and commercial use!
---
## π Summary
CocoBase v2.0 gives you:
β
Traditional SQL database (not JSON storage)
β
Event-driven architecture (13 lifecycle hooks)
β
Real-time WebSocket subscriptions
β
File upload & storage
β
SQL editor in dashboard
β
Custom routes with database access
β
Built-in authentication
β
Zero configuration
β
Production ready
**Build your backend in minutes, not days!** π
---
## π Links
- **GitHub**: [github.com/yourusername/cocobase](https://github.com/yourusername/cocobase)
- **Documentation**: [Read the Docs](https://cocobase.readthedocs.io)
- **PyPI**: [pypi.org/project/cocobase](https://pypi.org/project/cocobase)
---
Built with β€οΈ using FastAPI, SQLModel, and WebSockets
Raw data
{
"_id": null,
"home_page": "https://github.com/yourusername/cocobase",
"name": "cocobase-framework",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "CocoBase Team <cocobase85@gmail.com>",
"keywords": "backend, baas, fastapi, sqlmodel, database, api, cocobase, rest, real-time, websocket, events, self-hosted",
"author": "Patrick Chidera",
"author_email": "CocoBase Team <cocobase85@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/2f/d9/a0ffa7a939604faefe2763fc266c9f6095a4a9660cae0a8a1d8a2b3edc84/cocobase_framework-0.1.0.tar.gz",
"platform": null,
"description": "# \ud83d\ude80 CocoBase v2.0 - Self-Hosted Backend as a Service\n\nA **production-ready**, self-hosted Backend as a Service framework with **real-time capabilities**, **event system**, **file uploads**, and **SQL power**. Built with FastAPI and SQLModel for modern Python applications.\n\n## \u2728 What Makes CocoBase Special\n\n- \ud83d\uddc4\ufe0f **Real SQL Tables** - Traditional database architecture (not JSON storage)\n- \ud83c\udfaf **Event-Driven** - 13 lifecycle hooks for custom business logic\n- \ud83d\udce1 **Real-time** - WebSocket subscriptions with filtering\n- \ud83d\udcc1 **File Storage** - Built-in with cloud provider support (S3, Cloudinary, B2)\n- \ud83d\udcbb **SQL Editor** - Execute queries from the dashboard\n- \ud83d\udd0c **Extensible** - Add custom routes with full database access\n- \ud83d\udc64 **Built-in Auth** - User model with bcrypt password hashing\n- \ud83d\udcca **Zero Config** - Works immediately out of the box\n- \ud83c\udfa8 **Web Dashboard** - Visual interface for everything\n- \ud83d\udcd6 **Auto Docs** - Interactive API documentation\n\n---\n\n## \ud83c\udf89 New in v2.0\n\n### 1. **Event System**\n\nRegister callbacks for lifecycle events:\n\n```python\n@cocobase.events.on(EventType.AFTER_CREATE, collection=\"users\")\nasync def on_user_created(ctx: EventContext):\n print(f\"New user: {ctx.data['username']}\")\n```\n\n### 2. **Real-time WebSocket**\n\nWatch collections for live updates:\n\n```javascript\nws.send(\n JSON.stringify({\n action: \"subscribe\",\n collection: \"users\",\n filters: { is_admin: true },\n })\n);\n```\n\n### 3. **SQL Editor**\n\nExecute raw SQL from the dashboard with query history!\n\n### 4. **File Uploads**\n\nBuilt-in file handling with local/cloud storage.\n\n### 5. **Database Access**\n\nUse the database directly in custom routes:\n\n```python\n@app.get(\"/custom\")\nasync def my_route(session: Session = Depends(cocobase.get_db)):\n return session.exec(text(\"SELECT * FROM users\"))\n```\n\n---\n\n## \ud83d\udce6 Installation\n\n```bash\npip install cocobase\n```\n\nOr from source:\n\n```bash\ngit clone https://github.com/lordace-coder/cocobase_framework.git\ncd cocobase\npip install -e .\n```\n\n---\n\n## \u26a1 Quick Start\n\n### 1. Create `app.py`\n\n```python\nfrom cocobase import CocoBase\n\ncocobase = CocoBase()\napp = cocobase.app\n\nif __name__ == \"__main__\":\n cocobase.run()\n```\n\n### 2. Run\n\n```bash\npython app.py\n```\n\n### 3. Access\n\n- **Dashboard**: http://localhost:8000\n- **API Docs**: http://localhost:8000/docs\n- **SQL Editor**: Dashboard \u2192 SQL Editor tab\n\n---\n\n## \ud83c\udfaf Core Features\n\n### Traditional Database Tables\n\nEach collection is a **real SQL table** with proper columns and types:\n\n```python\n# Create a collection via API\n{\n \"name\": \"products\",\n \"columns\": [\n {\"name\": \"id\", \"type\": \"integer\", \"primary_key\": true, \"auto_increment\": true},\n {\"name\": \"name\", \"type\": \"string\", \"required\": true},\n {\"name\": \"price\", \"type\": \"float\"},\n {\"name\": \"in_stock\", \"type\": \"boolean\", \"default\": true}\n ]\n}\n```\n\n**Supported Types**: `string`, `integer`, `float`, `boolean`, `datetime`, `text`, `json`, `file`, `files`\n\n### Built-in User Model\n\nReady-to-use authentication with password hashing:\n\n```python\n# Create user (password auto-hashed)\nPOST /collections/users/documents\n{\n \"username\": \"john\",\n \"email\": \"john@example.com\",\n \"password\": \"secret123\"\n}\n```\n\n### Event-Driven Architecture\n\nHook into document lifecycle:\n\n```python\nfrom cocobase import EventType, EventContext\n\n# Validate before save\n@cocobase.events.on(EventType.BEFORE_CREATE, collection=\"users\")\nasync def validate_user(ctx: EventContext):\n if not ctx.data.get('email'):\n ctx.cancel() # Prevent creation\n\n# Send notification after save\n@cocobase.events.on(EventType.AFTER_CREATE, collection=\"orders\")\nasync def send_confirmation(ctx: EventContext):\n # Send email, update inventory, etc.\n pass\n```\n\n**Available Events**:\n\n- `APP_START`, `APP_SHUTDOWN`\n- `BEFORE_CREATE`, `AFTER_CREATE`\n- `BEFORE_UPDATE`, `AFTER_UPDATE`\n- `BEFORE_DELETE`, `AFTER_DELETE`\n- `COLLECTION_CREATED`, `COLLECTION_DELETED`\n- `FILE_UPLOADED`, `FILE_DELETED`\n\n### Real-time Subscriptions\n\nWatch collections with WebSocket:\n\n```javascript\nconst ws = new WebSocket(\"ws://localhost:8000/ws\");\n\n// Subscribe to collection\nws.send(\n JSON.stringify({\n action: \"subscribe\",\n collection: \"users\",\n filters: {\n age_gte: 18, // Age >= 18\n status: \"active\",\n },\n events: [\"create\", \"update\", \"delete\"],\n })\n);\n\n// Receive updates\nws.onmessage = (event) => {\n const message = JSON.parse(event.data);\n if (message.type === \"event\") {\n console.log(\"Update:\", message.data);\n }\n};\n```\n\n**Filter Operators**: `_eq`, `_ne`, `_gt`, `_gte`, `_lt`, `_lte`, `_contains`, `_in`\n\n### File Upload System\n\nUpload files with automatic storage:\n\n```python\n# Upload endpoint\nPOST /files/upload\nContent-Type: multipart/form-data\n\n# Collection with file field\n{\n \"name\": \"posts\",\n \"columns\": [\n {\"name\": \"id\", \"type\": \"integer\", \"primary_key\": true},\n {\"name\": \"title\", \"type\": \"string\"},\n {\"name\": \"featured_image\", \"type\": \"file\"},\n {\"name\": \"attachments\", \"type\": \"files\"} // Multiple files\n ]\n}\n```\n\nAccess files at `/uploads/filename.jpg`\n\n### Custom Routes with Database Access\n\nExtend CocoBase with custom endpoints:\n\n```python\nfrom sqlmodel import Session, text\nfrom fastapi import Depends\n\n@app.get(\"/api/stats\")\nasync def get_stats(session: Session = Depends(cocobase.get_db)):\n \"\"\"Custom endpoint with direct database access\"\"\"\n result = session.execute(text(\"\"\"\n SELECT COUNT(*) as total_users,\n SUM(CASE WHEN is_admin THEN 1 ELSE 0 END) as admins\n FROM users\n \"\"\"))\n row = result.first()\n return {\"total_users\": row[0], \"admins\": row[1]}\n```\n\n---\n\n## \ud83d\udcda API Endpoints\n\n### Collections\n\n```bash\nGET /collections # List all collections\nPOST /collections # Create collection\nDELETE /collections/{name} # Delete collection\nPATCH /collections/{name}/add-column # Add column dynamically\n```\n\n### Documents\n\n```bash\nGET /collections/{name}/documents # List documents\nPOST /collections/{name}/documents # Create document\nGET /collections/{name}/documents/{id} # Get document\nPATCH /collections/{name}/documents/{id} # Update document\nDELETE /collections/{name}/documents/{id} # Delete document\n```\n\n### Files\n\n```bash\nPOST /files/upload # Upload file\nPOST /files/upload-multiple # Upload multiple files\nGET /files/{filename} # Get file\nDELETE /files/{filename} # Delete file\n```\n\n### Real-time\n\n```bash\nWS /ws # WebSocket endpoint\nGET /realtime/stats # Connection statistics\n```\n\n### SQL\n\n```bash\nPOST /sql/execute # Execute SQL query\n```\n\n---\n\n## \ud83d\udca1 Complete Examples\n\n### Example 1: Blog with Events\n\n```python\nfrom cocobase import CocoBase, EventType, EventContext\n\ncocobase = CocoBase()\napp = cocobase.app\n\n# Auto-generate slug from title\n@cocobase.events.on(EventType.BEFORE_CREATE, collection=\"posts\")\nasync def generate_slug(ctx: EventContext):\n title = ctx.data.get('title', '')\n ctx.data['slug'] = title.lower().replace(' ', '-')\n ctx.data['view_count'] = 0\n\n# Notify followers\n@cocobase.events.on(EventType.AFTER_CREATE, collection=\"posts\")\nasync def notify_followers(ctx: EventContext):\n # Send notifications to followers\n print(f\"New post: {ctx.data['title']}\")\n\n# Custom view counter\n@app.post(\"/api/posts/{post_id}/view\")\nasync def increment_views(post_id: int, session: Session = Depends(cocobase.get_db)):\n query = text(\"UPDATE posts SET view_count = view_count + 1 WHERE id = :id\")\n session.execute(query, {\"id\": post_id})\n session.commit()\n return {\"message\": \"View counted\"}\n\nif __name__ == \"__main__\":\n cocobase.run()\n```\n\n### Example 2: Real-time Dashboard\n\n```html\n<!DOCTYPE html>\n<html>\n <head>\n <title>Live Dashboard</title>\n </head>\n <body>\n <h1>Live User Activity</h1>\n <div id=\"activity\"></div>\n\n <script>\n const ws = new WebSocket(\"ws://localhost:8000/ws\");\n\n ws.onopen = () => {\n ws.send(\n JSON.stringify({\n action: \"subscribe\",\n collection: \"users\",\n events: [\"create\", \"update\"],\n })\n );\n };\n\n ws.onmessage = (event) => {\n const msg = JSON.parse(event.data);\n if (msg.type === \"event\") {\n document\n .getElementById(\"activity\")\n .insertAdjacentHTML(\n \"afterbegin\",\n `<div>${msg.event} in ${msg.collection}: ${JSON.stringify(\n msg.data\n )}</div>`\n );\n }\n };\n </script>\n </body>\n</html>\n```\n\n### Example 3: Data Validation\n\n```python\n@cocobase.events.on(EventType.BEFORE_CREATE, collection=\"users\")\nasync def validate_user(ctx: EventContext):\n email = ctx.data.get('email', '')\n\n # Validate email\n if '@' not in email:\n ctx.cancel()\n return\n\n # Check for duplicates\n with Session(cocobase.engine) as session:\n query = text(\"SELECT COUNT(*) FROM users WHERE email = :email\")\n result = session.execute(query, {\"email\": email})\n if result.scalar() > 0:\n ctx.cancel()\n print(f\"Email already exists: {email}\")\n```\n\n---\n\n## \ud83d\uddc4\ufe0f Database Support\n\n```python\n# SQLite (default)\nCocoBase(database_url=\"sqlite:///myapp.db\")\n\n# PostgreSQL\nCocoBase(database_url=\"postgresql://user:pass@localhost/mydb\")\n\n# MySQL\nCocoBase(database_url=\"mysql+pymysql://user:pass@localhost/mydb\")\n```\n\n---\n\n## \ud83d\udd27 Configuration\n\n```python\ncocobase = CocoBase(\n database_url=\"sqlite:///myapp.db\", # Database connection\n dev_mode=True, # Development mode\n enable_dashboard=True, # Enable web dashboard\n upload_dir=\"uploads\" # File upload directory\n)\n```\n\n---\n\n## \ud83d\udcd6 Documentation\n\n- **Quick Reference**: [`QUICK_REFERENCE.md`](QUICK_REFERENCE.md)\n- **Developer Guide**: [`docs/DEVELOPER_GUIDE.md`](docs/DEVELOPER_GUIDE.md)\n- **Relationships & Files**: [`docs/RELATIONSHIPS_AND_FILES.md`](docs/RELATIONSHIPS_AND_FILES.md)\n- **Features Summary**: [`FEATURES_SUMMARY.md`](FEATURES_SUMMARY.md)\n- **Example App**: [`example_usage.py`](example_usage.py)\n\n---\n\n## \ud83c\udf93 Learning Resources\n\n1. **Start Here**: Read [QUICK_REFERENCE.md](QUICK_REFERENCE.md)\n2. **Run Example**: `python example_usage.py`\n3. **Deep Dive**: Read [docs/DEVELOPER_GUIDE.md](docs/DEVELOPER_GUIDE.md)\n4. **Build Your App**: Use the patterns and extend!\n\n---\n\n## \ud83c\udfd7\ufe0f Architecture\n\n```\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502 CocoBase v2.0 \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 FastAPI + SQLModel + WebSocket + Events \u2502\n\u2502 \u2502\n\u2502 \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502\n\u2502 \u2502 Events \u2502 \u2502Real-time\u2502 \u2502 Storage \u2502 \u2502\n\u2502 \u2502 System \u2502 \u2502WebSocket\u2502 \u2502 Service \u2502 \u2502\n\u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n\u2502 \u2502\n\u2502 \u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510 \u2502\n\u2502 \u2502 Real SQL Tables (Not JSON) \u2502 \u2502\n\u2502 \u2502 users | posts | products | ... \u2502 \u2502\n\u2502 \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518 \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n```\n\n---\n\n## \ud83d\udd10 Security\n\n\u26a0\ufe0f **For Production**:\n\n1. Add authentication (JWT/OAuth2)\n2. Enable HTTPS\n3. Configure CORS properly\n4. Add rate limiting\n5. Validate all inputs\n6. Use strong passwords\n7. Keep dependencies updated\n\n---\n\n## \ud83d\ude80 Deployment\n\n### Using Uvicorn\n\n```bash\nuvicorn app:app --host 0.0.0.0 --port 8000 --workers 4\n```\n\n### Using Docker\n\n```dockerfile\nFROM python:3.12\nWORKDIR /app\nCOPY . .\nRUN pip install -r requirements.txt\nCMD [\"uvicorn\", \"app:app\", \"--host\", \"0.0.0.0\", \"--port\", \"8000\"]\n```\n\n---\n\n## \ud83e\udd1d Contributing\n\nContributions welcome! Areas to improve:\n\n- Additional storage providers (AWS S3, Azure Blob, etc.)\n- Authentication providers (OAuth2, JWT, etc.)\n- More event types\n- Performance optimizations\n- UI enhancements\n\n---\n\n## \ud83d\udcc4 License\n\nMIT License - Free for personal and commercial use!\n\n---\n\n## \ud83c\udf89 Summary\n\nCocoBase v2.0 gives you:\n\n\u2705 Traditional SQL database (not JSON storage) \n\u2705 Event-driven architecture (13 lifecycle hooks) \n\u2705 Real-time WebSocket subscriptions \n\u2705 File upload & storage \n\u2705 SQL editor in dashboard \n\u2705 Custom routes with database access \n\u2705 Built-in authentication \n\u2705 Zero configuration \n\u2705 Production ready\n\n**Build your backend in minutes, not days!** \ud83d\ude80\n\n---\n\n## \ud83d\udd17 Links\n\n- **GitHub**: [github.com/yourusername/cocobase](https://github.com/yourusername/cocobase)\n- **Documentation**: [Read the Docs](https://cocobase.readthedocs.io)\n- **PyPI**: [pypi.org/project/cocobase](https://pypi.org/project/cocobase)\n\n---\n\nBuilt with \u2764\ufe0f using FastAPI, SQLModel, and WebSockets\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Self-hosted Backend as a Service with real-time, events, and SQL power",
"version": "0.1.0",
"project_urls": {
"Changelog": "https://github.com/lordace-coder/cocobase_framework/blob/main/CHANGELOG.md",
"Documentation": "https://github.com/lordace-coder/cocobase_framework/blob/main/docs/DEVELOPER_GUIDE.md",
"Homepage": "https://github.com/lordace-coder/cocobase_framework",
"Issues": "https://github.com/lordace-coder/cocobase_framework/issues",
"Repository": "https://github.com/lordace-coder/cocobase_framework"
},
"split_keywords": [
"backend",
" baas",
" fastapi",
" sqlmodel",
" database",
" api",
" cocobase",
" rest",
" real-time",
" websocket",
" events",
" self-hosted"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "992aa9366e915956446eef89225e541ff9fdcd4f3b23ecbcac5a691204301af0",
"md5": "cbe5f810da108d90eb5c028353067a49",
"sha256": "c83b136e1af268c779c84176a8f45167f179404c847ae2ac4fada14c82b6aa50"
},
"downloads": -1,
"filename": "cocobase_framework-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cbe5f810da108d90eb5c028353067a49",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 76928,
"upload_time": "2025-10-27T20:22:54",
"upload_time_iso_8601": "2025-10-27T20:22:54.912806Z",
"url": "https://files.pythonhosted.org/packages/99/2a/a9366e915956446eef89225e541ff9fdcd4f3b23ecbcac5a691204301af0/cocobase_framework-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "2fd9a0ffa7a939604faefe2763fc266c9f6095a4a9660cae0a8a1d8a2b3edc84",
"md5": "b81425b1adcb57c58ff78cc99ae54433",
"sha256": "842e623e788a4aee884888ffdb1366bb7ba6c014b56378ebd5eb7d0f94accb6d"
},
"downloads": -1,
"filename": "cocobase_framework-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "b81425b1adcb57c58ff78cc99ae54433",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 71958,
"upload_time": "2025-10-27T20:22:58",
"upload_time_iso_8601": "2025-10-27T20:22:58.443077Z",
"url": "https://files.pythonhosted.org/packages/2f/d9/a0ffa7a939604faefe2763fc266c9f6095a4a9660cae0a8a1d8a2b3edc84/cocobase_framework-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-10-27 20:22:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "yourusername",
"github_project": "cocobase",
"github_not_found": true,
"lcname": "cocobase-framework"
}